#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_INTERCEPTING_CANVAS_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_GRAPHICS_INTERCEPTING_CANVAS_H_
#include "base/check_op.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_record.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
namespace blink {
class InterceptingCanvasBase : public SkCanvas { … };
template <typename DerivedCanvas>
class CanvasInterceptor { … };
template <typename DerivedCanvas,
typename Interceptor = CanvasInterceptor<DerivedCanvas>>
class InterceptingCanvas : public InterceptingCanvasBase {
protected:
explicit InterceptingCanvas(SkBitmap bitmap)
: … { … }
InterceptingCanvas(int width, int height)
: … { … }
void onDrawPaint(const SkPaint& paint) override { … }
void onDrawPoints(PointMode mode,
size_t count,
const SkPoint pts[],
const SkPaint& paint) override { … }
void onDrawRect(const SkRect& rect, const SkPaint& paint) override { … }
void onDrawOval(const SkRect& rect, const SkPaint& paint) override { … }
void onDrawRRect(const SkRRect& rrect, const SkPaint& paint) override { … }
void onDrawPath(const SkPath& path, const SkPaint& paint) override { … }
void onDrawImage2(const SkImage* image,
SkScalar x,
SkScalar y,
const SkSamplingOptions& sampling,
const SkPaint* paint) override { … }
void onDrawImageRect2(const SkImage* image,
const SkRect& src,
const SkRect& dst,
const SkSamplingOptions& sampling,
const SkPaint* paint,
SrcRectConstraint constraint) override { … }
void onDrawVerticesObject(const SkVertices* vertices,
SkBlendMode bmode,
const SkPaint& paint) override { … }
void onDrawDRRect(const SkRRect& outer,
const SkRRect& inner,
const SkPaint& paint) override { … }
void onDrawTextBlob(const SkTextBlob* blob,
SkScalar x,
SkScalar y,
const SkPaint& paint) override { … }
void onClipRect(const SkRect& rect,
SkClipOp op,
ClipEdgeStyle edge_style) override { … }
void onClipRRect(const SkRRect& rrect,
SkClipOp op,
ClipEdgeStyle edge_style) override { … }
void onClipPath(const SkPath& path,
SkClipOp op,
ClipEdgeStyle edge_style) override { … }
void onClipRegion(const SkRegion& region, SkClipOp op) override { … }
void onDrawPicture(const SkPicture* picture,
const SkMatrix* matrix,
const SkPaint* paint) override { … }
void didSetM44(const SkM44&) override { … }
void didConcat44(const SkM44&) override { … }
void didScale(SkScalar x, SkScalar y) override { … }
void didTranslate(SkScalar x, SkScalar y) override { … }
void willSave() override { … }
SkCanvas::SaveLayerStrategy getSaveLayerStrategy(
const SaveLayerRec& rec) override { … }
void willRestore() override { … }
};
}
#endif