/src/skia/include/utils/SkNoDrawCanvas.h
Line | Count | Source (jump to first uncovered line) |
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 | | |
11 | | #include "include/core/SkCanvas.h" |
12 | | #include "include/core/SkCanvasVirtualEnforcer.h" |
13 | | |
14 | | struct 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 | | // |
24 | | class SK_API SkNoDrawCanvas : public SkCanvasVirtualEnforcer<SkCanvas> { |
25 | | public: |
26 | | SkNoDrawCanvas(int width, int height); |
27 | | SkNoDrawCanvas(const SkIRect&); |
28 | | |
29 | | // Optimization to reset state to be the same as after construction. |
30 | 0 | void resetCanvas(int w, int h) { this->resetForNextPicture(SkIRect::MakeWH(w, h)); } |
31 | 191k | void resetCanvas(const SkIRect& rect) { this->resetForNextPicture(rect); } |
32 | | |
33 | | protected: |
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 | 0 | void onDrawAnnotation(const SkRect&, const char[], SkData*) override {} |
39 | 0 | void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override {} |
40 | 0 | void onDrawDrawable(SkDrawable*, const SkMatrix*) override {} |
41 | 7 | void onDrawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const SkPaint&) override {} |
42 | | void onDrawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4], SkBlendMode, |
43 | 0 | const SkPaint&) override {} |
44 | | |
45 | 1 | void onDrawPaint(const SkPaint&) override {} |
46 | 0 | void onDrawBehind(const SkPaint&) override {} |
47 | 1 | void onDrawPoints(PointMode, size_t, const SkPoint[], const SkPaint&) override {} |
48 | 3 | void onDrawRect(const SkRect&, const SkPaint&) override {} |
49 | 0 | void onDrawRegion(const SkRegion&, const SkPaint&) override {} |
50 | 1 | void onDrawOval(const SkRect&, const SkPaint&) override {} |
51 | 0 | void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override {} |
52 | 0 | void onDrawRRect(const SkRRect&, const SkPaint&) override {} |
53 | 22 | void onDrawPath(const SkPath&, const SkPaint&) override {} |
54 | | |
55 | | void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&, |
56 | 0 | const SkPaint*) override {} |
57 | | void onDrawImageRect2(const SkImage*, const SkRect&, const SkRect&, const SkSamplingOptions&, |
58 | 2 | const SkPaint*, SrcRectConstraint) override {} |
59 | | void onDrawImageLattice2(const SkImage*, const Lattice&, const SkRect&, SkFilterMode, |
60 | 0 | const SkPaint*) override {} |
61 | | void onDrawAtlas2(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int, |
62 | 0 | SkBlendMode, const SkSamplingOptions&, const SkRect*, const SkPaint*) override {} |
63 | | |
64 | 0 | void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override {} |
65 | 0 | void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override {} |
66 | 0 | void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override {} |
67 | | |
68 | | void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&, |
69 | 0 | SkBlendMode) override {} |
70 | | void onDrawEdgeAAImageSet2(const ImageSetEntry[], int, const SkPoint[], const SkMatrix[], |
71 | | const SkSamplingOptions&, const SkPaint*, |
72 | 0 | SrcRectConstraint) override {} |
73 | | |
74 | | private: |
75 | | using INHERITED = SkCanvasVirtualEnforcer<SkCanvas>; |
76 | | }; |
77 | | |
78 | | #endif // SkNoDrawCanvas_DEFINED |