Flutter Engine
The Flutter Engine
SkNoDrawCanvas.h
Go to the documentation of this file.
1/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkNoDrawCanvas_DEFINED
9#define SkNoDrawCanvas_DEFINED
10
13
14struct SkIRect;
15
16// SkNoDrawCanvas is a helper for SkCanvas subclasses which do not need to
17// actually rasterize (e.g., analysis of the draw calls).
18//
19// It provides the following simplifications:
20//
21// * not backed by any device/pixels
22// * conservative clipping (clipping calls only use rectangles)
23//
25public:
26 SkNoDrawCanvas(int width, int height);
27 SkNoDrawCanvas(const SkIRect&);
28
29 // Optimization to reset state to be the same as after construction.
30 void resetCanvas(int w, int h) { this->resetForNextPicture(SkIRect::MakeWH(w, h)); }
31 void resetCanvas(const SkIRect& rect) { this->resetForNextPicture(rect); }
32
33protected:
34 SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& rec) override;
35 bool onDoSaveBehind(const SkRect*) override;
36
37 // No-op overrides for aborting rasterization earlier than SkNullBlitter.
38 void onDrawAnnotation(const SkRect&, const char[], SkData*) override {}
39 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override {}
40 void onDrawDrawable(SkDrawable*, const SkMatrix*) override {}
41 void onDrawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const SkPaint&) override {}
42 void onDrawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4], SkBlendMode,
43 const SkPaint&) override {}
44
45 void onDrawPaint(const SkPaint&) override {}
46 void onDrawBehind(const SkPaint&) override {}
47 void onDrawPoints(PointMode, size_t, const SkPoint[], const SkPaint&) override {}
48 void onDrawRect(const SkRect&, const SkPaint&) override {}
49 void onDrawRegion(const SkRegion&, const SkPaint&) override {}
50 void onDrawOval(const SkRect&, const SkPaint&) override {}
51 void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override {}
52 void onDrawRRect(const SkRRect&, const SkPaint&) override {}
53 void onDrawPath(const SkPath&, const SkPaint&) override {}
54
56 const SkPaint*) override {}
57 void onDrawImageRect2(const SkImage*, const SkRect&, const SkRect&, const SkSamplingOptions&,
58 const SkPaint*, SrcRectConstraint) override {}
60 const SkPaint*) override {}
61 void onDrawAtlas2(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int,
62 SkBlendMode, const SkSamplingOptions&, const SkRect*, const SkPaint*) override {}
63
64 void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override {}
65 void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override {}
66 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override {}
67
68 void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&,
69 SkBlendMode) override {}
70 void onDrawEdgeAAImageSet2(const ImageSetEntry[], int, const SkPoint[], const SkMatrix[],
71 const SkSamplingOptions&, const SkPaint*,
72 SrcRectConstraint) override {}
73
74private:
76};
77
78#endif // SkNoDrawCanvas_DEFINED
#define SK_API
Definition: SkAPI.h:35
SkBlendMode
Definition: SkBlendMode.h:38
uint32_t SkColor
Definition: SkColor.h:37
#define INHERITED(method,...)
Definition: SkRecorder.cpp:128
SkFilterMode
SrcRectConstraint
Definition: SkCanvas.h:1541
Definition: SkData.h:25
void onDrawImageLattice2(const SkImage *, const Lattice &, const SkRect &, SkFilterMode, const SkPaint *) override
void onDrawEdgeAAImageSet2(const ImageSetEntry[], int, const SkPoint[], const SkMatrix[], const SkSamplingOptions &, const SkPaint *, SrcRectConstraint) override
void onDrawBehind(const SkPaint &) override
void onDrawPicture(const SkPicture *, const SkMatrix *, const SkPaint *) override
void onDrawPoints(PointMode, size_t, const SkPoint[], const SkPaint &) override
void onDrawRegion(const SkRegion &, const SkPaint &) override
void onDrawPaint(const SkPaint &) override
void onDrawTextBlob(const SkTextBlob *, SkScalar, SkScalar, const SkPaint &) override
void resetCanvas(const SkIRect &rect)
void onDrawAnnotation(const SkRect &, const char[], SkData *) override
void onDrawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4], SkBlendMode, const SkPaint &) override
void onDrawArc(const SkRect &, SkScalar, SkScalar, bool, const SkPaint &) override
void onDrawShadowRec(const SkPath &, const SkDrawShadowRec &) override
void onDrawImageRect2(const SkImage *, const SkRect &, const SkRect &, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint) override
void onDrawRRect(const SkRRect &, const SkPaint &) override
void onDrawImage2(const SkImage *, SkScalar, SkScalar, const SkSamplingOptions &, const SkPaint *) override
void resetCanvas(int w, int h)
void onDrawDrawable(SkDrawable *, const SkMatrix *) override
void onDrawRect(const SkRect &, const SkPaint &) override
void onDrawDRRect(const SkRRect &, const SkRRect &, const SkPaint &) override
void onDrawOval(const SkRect &, const SkPaint &) override
void onDrawAtlas2(const SkImage *, const SkRSXform[], const SkRect[], const SkColor[], int, SkBlendMode, const SkSamplingOptions &, const SkRect *, const SkPaint *) override
void onDrawPath(const SkPath &, const SkPaint &) override
void onDrawEdgeAAQuad(const SkRect &, const SkPoint[4], QuadAAFlags, const SkColor4f &, SkBlendMode) override
void onDrawVerticesObject(const SkVertices *, SkBlendMode, const SkPaint &) override
Definition: SkPath.h:59
float SkScalar
Definition: extension.cpp:12
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
SkScalar w
SkScalar h
int32_t height
int32_t width
Definition: SkRect.h:32
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
Definition: SkRect.h:56