#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "skia/ext/benchmarking_canvas.h"
#include <array>
#include <memory>
#include <sstream>
#include <utility>
#include "base/check_op.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "base/values.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColorFilter.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageFilter.h"
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/core/SkRRect.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "third_party/skia/include/core/SkString.h"
#include "third_party/skia/include/core/SkTextBlob.h"
namespace {
class FlagsBuilder { … };
base::Value AsValue(bool b) { … }
base::Value AsValue(SkScalar scalar) { … }
base::Value AsValue(const SkSize& size) { … }
base::Value AsValue(const SkPoint& point) { … }
base::Value AsValue(const SkRect& rect) { … }
base::Value AsValue(const SkRRect& rrect) { … }
base::Value AsValue(const SkMatrix& matrix) { … }
base::Value AsValue(SkColor color) { … }
base::Value AsValue(SkBlendMode mode) { … }
base::Value AsValue(SkCanvas::PointMode mode) { … }
base::Value AsValue(const SkColorFilter& filter) { … }
base::Value AsValue(const SkImageFilter& filter) { … }
base::Value AsValue(const SkPaint& paint) { … }
base::Value SaveLayerFlagsAsValue(SkCanvas::SaveLayerFlags flags) { … }
base::Value AsValue(SkClipOp op) { … }
base::Value AsValue(const SkRegion& region) { … }
base::Value AsValue(const SkImage& image) { … }
base::Value AsValue(const SkTextBlob& blob) { … }
base::Value AsValue(const SkPath& path) { … }
template <typename T>
base::Value AsListValue(const T array[], size_t count) { … }
}
namespace skia {
class BenchmarkingCanvas::AutoOp { … };
BenchmarkingCanvas::BenchmarkingCanvas(SkCanvas* canvas)
: … { … }
BenchmarkingCanvas::~BenchmarkingCanvas() = default;
size_t BenchmarkingCanvas::CommandCount() const { … }
const base::Value::List& BenchmarkingCanvas::Commands() const { … }
double BenchmarkingCanvas::GetTime(size_t index) { … }
void BenchmarkingCanvas::willSave() { … }
SkCanvas::SaveLayerStrategy BenchmarkingCanvas::getSaveLayerStrategy(
const SaveLayerRec& rec) { … }
void BenchmarkingCanvas::willRestore() { … }
void BenchmarkingCanvas::didConcat44(const SkM44& m) { … }
void BenchmarkingCanvas::didScale(SkScalar x, SkScalar y) { … }
void BenchmarkingCanvas::didTranslate(SkScalar x, SkScalar y) { … }
void BenchmarkingCanvas::didSetM44(const SkM44& m) { … }
void BenchmarkingCanvas::onClipRect(const SkRect& rect,
SkClipOp region_op,
SkCanvas::ClipEdgeStyle style) { … }
void BenchmarkingCanvas::onClipRRect(const SkRRect& rrect,
SkClipOp region_op,
SkCanvas::ClipEdgeStyle style) { … }
void BenchmarkingCanvas::onClipPath(const SkPath& path,
SkClipOp region_op,
SkCanvas::ClipEdgeStyle style) { … }
void BenchmarkingCanvas::onClipRegion(const SkRegion& region,
SkClipOp region_op) { … }
void BenchmarkingCanvas::onDrawPaint(const SkPaint& paint) { … }
void BenchmarkingCanvas::onDrawPoints(PointMode mode, size_t count,
const SkPoint pts[], const SkPaint& paint) { … }
void BenchmarkingCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { … }
void BenchmarkingCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) { … }
void BenchmarkingCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { … }
void BenchmarkingCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
const SkPaint& paint) { … }
void BenchmarkingCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { … }
void BenchmarkingCanvas::onDrawPicture(const SkPicture* picture,
const SkMatrix* matrix,
const SkPaint* paint) { … }
void BenchmarkingCanvas::onDrawImage2(const SkImage* image,
SkScalar left,
SkScalar top,
const SkSamplingOptions& sampling,
const SkPaint* paint) { … }
void BenchmarkingCanvas::onDrawImageRect2(const SkImage* image,
const SkRect& src,
const SkRect& dst,
const SkSamplingOptions& sampling,
const SkPaint* paint,
SrcRectConstraint constraint) { … }
void BenchmarkingCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) { … }
}