Flutter Engine
The Flutter Engine
SkOverdrawCanvas.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 SkOverdrawCanvas_DEFINED
9#define SkOverdrawCanvas_DEFINED
10
19
20#include <cstddef>
21
22class SkData;
23class SkDrawable;
24class SkImage;
25class SkMatrix;
26class SkPath;
27class SkPicture;
28class SkRRect;
29class SkRegion;
30class SkTextBlob;
31class SkVertices;
32enum class SkBlendMode;
33namespace sktext { class GlyphRunList; }
34struct SkDrawShadowRec;
35struct SkPoint;
36struct SkRSXform;
37struct 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 */
44class SK_API SkOverdrawCanvas : public SkCanvasVirtualEnforcer<SkNWayCanvas> {
45public:
46 /* Does not take ownership of canvas */
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
86private:
87 inline SkPaint overdrawPaint(const SkPaint& paint);
88
89 SkPaint fPaint;
90
92};
93
94#endif
int count
Definition: FontMgrTest.cpp:50
#define SK_API
Definition: SkAPI.h:35
SkBlendMode
Definition: SkBlendMode.h:38
uint32_t SkColor
Definition: SkColor.h:37
SkFilterMode
void onDrawPoints(SkCanvas::PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint) override=0
void onDrawRect(const SkRect &rect, const SkPaint &paint) override=0
void onDrawRegion(const SkRegion &region, const SkPaint &paint) override=0
void onDrawShadowRec(const SkPath &, const SkDrawShadowRec &) override=0
void onDrawPicture(const SkPicture *picture, const SkMatrix *matrix, const SkPaint *paint) override=0
void onDrawBehind(const SkPaint &) override
void onDrawRRect(const SkRRect &rrect, const SkPaint &paint) override=0
void onDrawTextBlob(const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint) override=0
void onDrawAnnotation(const SkRect &rect, const char key[], SkData *value) override=0
void onDrawOval(const SkRect &rect, const SkPaint &paint) override=0
void onDrawDrawable(SkDrawable *drawable, const SkMatrix *matrix) override=0
void onDrawArc(const SkRect &rect, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const SkPaint &paint) override=0
void onDrawDRRect(const SkRRect &outer, const SkRRect &inner, const SkPaint &paint) override=0
void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], SkBlendMode mode, const SkPaint &paint) override=0
void onDrawPath(const SkPath &path, const SkPaint &paint) override=0
void onDrawPaint(const SkPaint &paint) override=0
void onDrawEdgeAAQuad(const SkRect &rect, const SkPoint clip[4], SkCanvas::QuadAAFlags aaFlags, const SkColor4f &color, SkBlendMode mode) override=0
SrcRectConstraint
Definition: SkCanvas.h:1541
Definition: SkData.h:25
Definition: SkPath.h:59
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
uint8_t value