Skia
2D Graphics Library
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 
11 #include "include/core/SkCanvas.h"
13 #include "include/core/SkColor.h"
14 #include "include/core/SkPaint.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 
44 class SK_API SkOverdrawCanvas : public SkCanvasVirtualEnforcer<SkNWayCanvas> {
45 public:
46  /* Does not take ownership of canvas */
48 
49  void onDrawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const SkPaint&) override;
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 
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 
92 };
93 
94 #endif
SkBlendMode
Blends are operators that take in two colors (source, destination) and return a new color.
Definition: SkBlendMode.h:38
Types, consts, functions, and macros for colors.
uint32_t SkColor
32-bit ARGB color value, unpremultiplied.
Definition: SkColor.h:37
SkFilterMode
Definition: SkSamplingOptions.h:16
float SkScalar
Definition: SkScalar.h:14
Definition: SkCanvasVirtualEnforcer.h:17
SkCanvas provides an interface for drawing, and how the drawing is clipped and transformed.
Definition: SkCanvas.h:99
QuadAAFlags
Experimental.
Definition: SkCanvas.h:1585
SkData holds an immutable data buffer.
Definition: SkData.h:25
Base-class for objects that draw into SkCanvas.
Definition: SkDrawable.h:37
SkImage describes a two dimensional array of pixels to draw.
Definition: SkImage.h:270
SkMatrix holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:53
Captures all drawing commands.
Definition: SkOverdrawCanvas.h:44
void onDrawImage2(const SkImage *, SkScalar, SkScalar, const SkSamplingOptions &, const SkPaint *) override
void onDrawTextBlob(const SkTextBlob *, SkScalar, SkScalar, const SkPaint &) override
void onDrawAnnotation(const SkRect &, const char key[], SkData *value) override
void onDrawImageRect2(const SkImage *, const SkRect &, const SkRect &, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint) override
void onDrawImageLattice2(const SkImage *, const Lattice &, const SkRect &, SkFilterMode, const SkPaint *) override
void onDrawOval(const SkRect &, const SkPaint &) override
void onDrawPoints(PointMode, size_t, const SkPoint[], const SkPaint &) override
void onDrawPath(const SkPath &, const SkPaint &) override
void onDrawRRect(const SkRRect &, const SkPaint &) override
void onDrawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4], SkBlendMode, const SkPaint &) override
void onDrawShadowRec(const SkPath &, const SkDrawShadowRec &) override
void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[], const SkSamplingOptions &, const SkPaint *, SrcRectConstraint) override
void onDrawVerticesObject(const SkVertices *, SkBlendMode, const SkPaint &) override
void onDrawGlyphRunList(const sktext::GlyphRunList &glyphRunList, const SkPaint &paint) override
void onDrawRegion(const SkRegion &, const SkPaint &) override
void onDrawEdgeAAQuad(const SkRect &, const SkPoint[4], SkCanvas::QuadAAFlags, const SkColor4f &, SkBlendMode) override
void onDrawArc(const SkRect &, SkScalar, SkScalar, bool, const SkPaint &) override
void onDrawPaint(const SkPaint &) override
void onDrawRect(const SkRect &, const SkPaint &) override
void onDrawDrawable(SkDrawable *, const SkMatrix *) override
void onDrawPicture(const SkPicture *, const SkMatrix *, const SkPaint *) override
void onDrawDRRect(const SkRRect &, const SkRRect &, const SkPaint &) override
void onDrawBehind(const SkPaint &paint) override
void onDrawAtlas2(const SkImage *, const SkRSXform[], const SkRect[], const SkColor[], int, SkBlendMode, const SkSamplingOptions &, const SkRect *, const SkPaint *) override
SkOverdrawCanvas(SkCanvas *)
SkPaint controls options applied when drawing.
Definition: SkPaint.h:44
SkPath contain geometry.
Definition: SkPath.h:58
SkPicture records drawing commands made to SkCanvas.
Definition: SkPicture.h:44
SkRRect describes a rounded rectangle with a bounds and a pair of radii for each corner.
Definition: SkRRect.h:35
SkRegion describes the set of pixels used to clip SkCanvas.
Definition: SkRegion.h:30
SkTextBlob combines multiple text runs into an immutable container.
Definition: SkTextBlob.h:41
An immutable set of vertex data that can be used with SkCanvas::drawVertices.
Definition: SkVertices.h:24
Definition: SkCanvas.h:42
RGBA color value, holding four floating point components.
A compressed form of a rotation+scale matrix.
Definition: SkRSXform.h:21
SkRect holds four float coordinates describing the upper and lower bounds of a rectangle.
Definition: SkRect.h:582
Definition: SkSamplingOptions.h:58