Debian Codegraph @

include/core/SkOverdrawCanvas.h

raw
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 SkOverdrawCanvas_DEFINED
9 #define SkOverdrawCanvas_DEFINED
10
11 #include "include/core/SkCanvas.h"
12 #include "include/core/SkCanvasVirtualEnforcer.h"
13 #include "include/core/SkColor.h"
14 #include "include/core/SkPaint.h"
15 #include "include/core/SkSamplingOptions.h"
16 #include "include/core/SkScalar.h"
17 #include "include/private/base/SkAPI.h"
18 #include "include/utils/SkNWayCanvas.h"
19
20 #include <cstddef>
21
22 class SkData;
23 class SkDrawable;
24 class SkImage;
25 class SkMatrix;
26 class SkPath;
27 class SkPicture;
28 class SkRRect;
29 class SkRegion;
30 class SkTextBlob;
31 class SkVertices;
32 enum class SkBlendMode;
33 namespace sktext { class GlyphRunList; }
34 struct SkDrawShadowRec;
35 struct SkPoint;
36 struct SkRSXform;
37 struct SkRect;
38
39 /**
40 * Captures all drawing commands. Rather than draw the actual content, this device
41 * increments the alpha channel of each pixel every time it would have been touched
42 * by a draw call. This is useful for detecting overdraw.
43 */
44 class SK_API SkOverdrawCanvas : public SkCanvasVirtualEnforcer<SkNWayCanvas> {
45 public:
46 /* Does not take ownership of canvas */
47 explicit SkOverdrawCanvas(SkCanvas*);
48
49 void onDrawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const SkPaint&) override;
50 void onDrawGlyphRunList(
51 const sktext::GlyphRunList& glyphRunList, const SkPaint& paint) override;
52 void onDrawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4], SkBlendMode,
53 const SkPaint&) override;
54 void onDrawPaint(const SkPaint&) override;
55 void onDrawBehind(const SkPaint& paint) override;
56 void onDrawRect(const SkRect&, const SkPaint&) override;
57 void onDrawRegion(const SkRegion&, const SkPaint&) override;
58 void onDrawOval(const SkRect&, const SkPaint&) override;
59 void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override;
60 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override;
61 void onDrawRRect(const SkRRect&, const SkPaint&) override;
62 void onDrawPoints(PointMode, size_t, const SkPoint[], const SkPaint&) override;
63 void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override;
64 void onDrawPath(const SkPath&, const SkPaint&) override;
65
66 void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&,
67 const SkPaint*) override;
68 void onDrawImageRect2(const SkImage*, const SkRect&, const SkRect&, const SkSamplingOptions&,
69 const SkPaint*, SrcRectConstraint) override;
70 void onDrawImageLattice2(const SkImage*, const Lattice&, const SkRect&, SkFilterMode,
71 const SkPaint*) override;
72 void onDrawAtlas2(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int,
73 SkBlendMode, const SkSamplingOptions&, const SkRect*, const SkPaint*) override;
74
75 void onDrawDrawable(SkDrawable*, const SkMatrix*) override;
76 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
77
78 void onDrawAnnotation(const SkRect&, const char key[], SkData* value) override;
79 void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override;
80
81 void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], SkCanvas::QuadAAFlags, const SkColor4f&,
82 SkBlendMode) override;
83 void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[],
84 const SkSamplingOptions&,const SkPaint*, SrcRectConstraint) override;
85
86 private:
87 inline SkPaint overdrawPaint(const SkPaint& paint);
88
89 SkPaint fPaint;
90
91 using INHERITED = SkCanvasVirtualEnforcer<SkNWayCanvas>;
92 };
93
94 #endif