Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Friends | List of all members
SkPaintFilterCanvas Class Referenceabstract

#include <SkPaintFilterCanvas.h>

Inheritance diagram for SkPaintFilterCanvas:
SkCanvasVirtualEnforcer< SkNWayCanvas > SkNWayCanvas SkCanvasVirtualEnforcer< SkNoDrawCanvas > SkNoDrawCanvas SkCanvasVirtualEnforcer< SkCanvas > SkCanvas DebugPaintFilterCanvas OveridePaintFilterCanvas

Classes

class  AutoPaintFilter
 

Public Types

enum  Type { kPicture_Type }
 
- Public Types inherited from SkCanvas
enum  SaveLayerFlagsSet { kPreserveLCDText_SaveLayerFlag = 1 << 1 , kInitWithPrevious_SaveLayerFlag = 1 << 2 , kF16ColorType = 1 << 4 }
 
enum  PointMode { kPoints_PointMode , kLines_PointMode , kPolygon_PointMode }
 
enum  SrcRectConstraint { kStrict_SrcRectConstraint , kFast_SrcRectConstraint }
 
enum  QuadAAFlags : unsigned {
  kLeft_QuadAAFlag = 0b0001 , kTop_QuadAAFlag = 0b0010 , kRight_QuadAAFlag = 0b0100 , kBottom_QuadAAFlag = 0b1000 ,
  kNone_QuadAAFlags = 0b0000 , kAll_QuadAAFlags = 0b1111
}
 
using SaveLayerFlags = uint32_t
 
using FilterSpan = SkSpan< sk_sp< SkImageFilter > >
 

Public Member Functions

 SkPaintFilterCanvas (SkCanvas *canvas)
 
SkISize getBaseLayerSize () const override
 
GrRecordingContextrecordingContext () const override
 
- Public Member Functions inherited from SkNWayCanvas
 SkNWayCanvas (int width, int height)
 
 ~SkNWayCanvas () override
 
virtual void addCanvas (SkCanvas *)
 
virtual void removeCanvas (SkCanvas *)
 
virtual void removeAll ()
 
- Public Member Functions inherited from SkNoDrawCanvas
 SkNoDrawCanvas (int width, int height)
 
 SkNoDrawCanvas (const SkIRect &)
 
void resetCanvas (int w, int h)
 
void resetCanvas (const SkIRect &rect)
 
- Public Member Functions inherited from SkCanvas
 SkCanvas ()
 
 SkCanvas (int width, int height, const SkSurfaceProps *props=nullptr)
 
 SkCanvas (sk_sp< SkDevice > device)
 
 SkCanvas (const SkBitmap &bitmap)
 
 SkCanvas (const SkBitmap &bitmap, const SkSurfaceProps &props)
 
virtual ~SkCanvas ()
 
SkImageInfo imageInfo () const
 
bool getProps (SkSurfaceProps *props) const
 
SkSurfaceProps getBaseProps () const
 
SkSurfaceProps getTopProps () const
 
sk_sp< SkSurfacemakeSurface (const SkImageInfo &info, const SkSurfaceProps *props=nullptr)
 
virtual skgpu::graphite::Recorderrecorder () const
 
SkSurfacegetSurface () const
 
void * accessTopLayerPixels (SkImageInfo *info, size_t *rowBytes, SkIPoint *origin=nullptr)
 
SkRasterHandleAllocator::Handle accessTopRasterHandle () const
 
bool peekPixels (SkPixmap *pixmap)
 
bool readPixels (const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY)
 
bool readPixels (const SkPixmap &pixmap, int srcX, int srcY)
 
bool readPixels (const SkBitmap &bitmap, int srcX, int srcY)
 
bool writePixels (const SkImageInfo &info, const void *pixels, size_t rowBytes, int x, int y)
 
bool writePixels (const SkBitmap &bitmap, int x, int y)
 
int save ()
 
int saveLayer (const SkRect *bounds, const SkPaint *paint)
 
int saveLayer (const SkRect &bounds, const SkPaint *paint)
 
int saveLayerAlphaf (const SkRect *bounds, float alpha)
 
int saveLayerAlpha (const SkRect *bounds, U8CPU alpha)
 
int saveLayer (const SaveLayerRec &layerRec)
 
void restore ()
 
int getSaveCount () const
 
void restoreToCount (int saveCount)
 
void translate (SkScalar dx, SkScalar dy)
 
void scale (SkScalar sx, SkScalar sy)
 
void rotate (SkScalar degrees)
 
void rotate (SkScalar degrees, SkScalar px, SkScalar py)
 
void skew (SkScalar sx, SkScalar sy)
 
void concat (const SkMatrix &matrix)
 
void concat (const SkM44 &)
 
void setMatrix (const SkM44 &matrix)
 
void setMatrix (const SkMatrix &matrix)
 
void resetMatrix ()
 
void clipRect (const SkRect &rect, SkClipOp op, bool doAntiAlias)
 
void clipRect (const SkRect &rect, SkClipOp op)
 
void clipRect (const SkRect &rect, bool doAntiAlias=false)
 
void clipIRect (const SkIRect &irect, SkClipOp op=SkClipOp::kIntersect)
 
void androidFramework_setDeviceClipRestriction (const SkIRect &rect)
 
void clipRRect (const SkRRect &rrect, SkClipOp op, bool doAntiAlias)
 
void clipRRect (const SkRRect &rrect, SkClipOp op)
 
void clipRRect (const SkRRect &rrect, bool doAntiAlias=false)
 
void clipPath (const SkPath &path, SkClipOp op, bool doAntiAlias)
 
void clipPath (const SkPath &path, SkClipOp op)
 
void clipPath (const SkPath &path, bool doAntiAlias=false)
 
void clipShader (sk_sp< SkShader >, SkClipOp=SkClipOp::kIntersect)
 
void clipRegion (const SkRegion &deviceRgn, SkClipOp op=SkClipOp::kIntersect)
 
bool quickReject (const SkRect &rect) const
 
bool quickReject (const SkPath &path) const
 
SkRect getLocalClipBounds () const
 
bool getLocalClipBounds (SkRect *bounds) const
 
SkIRect getDeviceClipBounds () const
 
bool getDeviceClipBounds (SkIRect *bounds) const
 
void drawColor (SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
 
void drawColor (const SkColor4f &color, SkBlendMode mode=SkBlendMode::kSrcOver)
 
void clear (SkColor color)
 
void clear (const SkColor4f &color)
 
void discard ()
 
void drawPaint (const SkPaint &paint)
 
void drawPoints (PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint)
 
void drawPoint (SkScalar x, SkScalar y, const SkPaint &paint)
 
void drawPoint (SkPoint p, const SkPaint &paint)
 
void drawLine (SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint &paint)
 
void drawLine (SkPoint p0, SkPoint p1, const SkPaint &paint)
 
void drawRect (const SkRect &rect, const SkPaint &paint)
 
void drawIRect (const SkIRect &rect, const SkPaint &paint)
 
void drawRegion (const SkRegion &region, const SkPaint &paint)
 
void drawOval (const SkRect &oval, const SkPaint &paint)
 
void drawRRect (const SkRRect &rrect, const SkPaint &paint)
 
void drawDRRect (const SkRRect &outer, const SkRRect &inner, const SkPaint &paint)
 
void drawCircle (SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
 
void drawCircle (SkPoint center, SkScalar radius, const SkPaint &paint)
 
void drawArc (const SkRect &oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, const SkPaint &paint)
 
void drawArc (const SkArc &arc, const SkPaint &paint)
 
void drawRoundRect (const SkRect &rect, SkScalar rx, SkScalar ry, const SkPaint &paint)
 
void drawPath (const SkPath &path, const SkPaint &paint)
 
void drawImage (const SkImage *image, SkScalar left, SkScalar top)
 
void drawImage (const sk_sp< SkImage > &image, SkScalar left, SkScalar top)
 
void drawImage (const SkImage *, SkScalar x, SkScalar y, const SkSamplingOptions &, const SkPaint *=nullptr)
 
void drawImage (const sk_sp< SkImage > &image, SkScalar x, SkScalar y, const SkSamplingOptions &sampling, const SkPaint *paint=nullptr)
 
void drawImageRect (const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
 
void drawImageRect (const SkImage *, const SkRect &dst, const SkSamplingOptions &, const SkPaint *=nullptr)
 
void drawImageRect (const sk_sp< SkImage > &image, const SkRect &src, const SkRect &dst, const SkSamplingOptions &sampling, const SkPaint *paint, SrcRectConstraint constraint)
 
void drawImageRect (const sk_sp< SkImage > &image, const SkRect &dst, const SkSamplingOptions &sampling, const SkPaint *paint=nullptr)
 
void drawImageNine (const SkImage *image, const SkIRect &center, const SkRect &dst, SkFilterMode filter, const SkPaint *paint=nullptr)
 
void drawImageLattice (const SkImage *image, const Lattice &lattice, const SkRect &dst, SkFilterMode filter, const SkPaint *paint=nullptr)
 
void drawImageLattice (const SkImage *image, const Lattice &lattice, const SkRect &dst)
 
void experimental_DrawEdgeAAQuad (const SkRect &rect, const SkPoint clip[4], QuadAAFlags aaFlags, const SkColor4f &color, SkBlendMode mode)
 
void experimental_DrawEdgeAAQuad (const SkRect &rect, const SkPoint clip[4], QuadAAFlags aaFlags, SkColor color, SkBlendMode mode)
 
void experimental_DrawEdgeAAImageSet (const ImageSetEntry imageSet[], int cnt, const SkPoint dstClips[], const SkMatrix preViewMatrices[], const SkSamplingOptions &, const SkPaint *paint=nullptr, SrcRectConstraint constraint=kStrict_SrcRectConstraint)
 
void drawSimpleText (const void *text, size_t byteLength, SkTextEncoding encoding, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
 
void drawString (const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
 
void drawString (const SkString &str, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
 
void drawGlyphs (int count, const SkGlyphID glyphs[], const SkPoint positions[], const uint32_t clusters[], int textByteCount, const char utf8text[], SkPoint origin, const SkFont &font, const SkPaint &paint)
 
void drawGlyphs (int count, const SkGlyphID glyphs[], const SkPoint positions[], SkPoint origin, const SkFont &font, const SkPaint &paint)
 
void drawGlyphs (int count, const SkGlyphID glyphs[], const SkRSXform xforms[], SkPoint origin, const SkFont &font, const SkPaint &paint)
 
void drawTextBlob (const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint)
 
void drawTextBlob (const sk_sp< SkTextBlob > &blob, SkScalar x, SkScalar y, const SkPaint &paint)
 
void drawPicture (const SkPicture *picture)
 
void drawPicture (const sk_sp< SkPicture > &picture)
 
void drawPicture (const SkPicture *picture, const SkMatrix *matrix, const SkPaint *paint)
 
void drawPicture (const sk_sp< SkPicture > &picture, const SkMatrix *matrix, const SkPaint *paint)
 
void drawVertices (const SkVertices *vertices, SkBlendMode mode, const SkPaint &paint)
 
void drawVertices (const sk_sp< SkVertices > &vertices, SkBlendMode mode, const SkPaint &paint)
 
void drawMesh (const SkMesh &mesh, sk_sp< SkBlender > blender, const SkPaint &paint)
 
void drawPatch (const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], SkBlendMode mode, const SkPaint &paint)
 
void drawAtlas (const SkImage *atlas, const SkRSXform xform[], const SkRect tex[], const SkColor colors[], int count, SkBlendMode mode, const SkSamplingOptions &sampling, const SkRect *cullRect, const SkPaint *paint)
 
void drawDrawable (SkDrawable *drawable, const SkMatrix *matrix=nullptr)
 
void drawDrawable (SkDrawable *drawable, SkScalar x, SkScalar y)
 
void drawAnnotation (const SkRect &rect, const char key[], SkData *value)
 
void drawAnnotation (const SkRect &rect, const char key[], const sk_sp< SkData > &value)
 
virtual bool isClipEmpty () const
 
virtual bool isClipRect () const
 
SkM44 getLocalToDevice () const
 
SkMatrix getLocalToDeviceAs3x3 () const
 
SkMatrix getTotalMatrix () const
 
void temporary_internal_getRgnClip (SkRegion *region)
 
void private_draw_shadow_rec (const SkPath &, const SkDrawShadowRec &)
 

Protected Member Functions

virtual bool onFilter (SkPaint &paint) const =0
 
void onDrawPaint (const SkPaint &) override
 
void onDrawBehind (const SkPaint &) override
 
void onDrawPoints (PointMode, size_t count, const SkPoint pts[], const SkPaint &) override
 
void onDrawRect (const SkRect &, const SkPaint &) override
 
void onDrawRRect (const SkRRect &, const SkPaint &) override
 
void onDrawDRRect (const SkRRect &, const SkRRect &, const SkPaint &) override
 
void onDrawRegion (const SkRegion &, const SkPaint &) override
 
void onDrawOval (const SkRect &, const SkPaint &) override
 
void onDrawArc (const SkRect &, SkScalar, SkScalar, bool, const SkPaint &) override
 
void onDrawPath (const SkPath &, const SkPaint &) override
 
void onDrawImage2 (const SkImage *, SkScalar, SkScalar, const SkSamplingOptions &, const SkPaint *) 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 onDrawAtlas2 (const SkImage *, const SkRSXform[], const SkRect[], const SkColor[], int, SkBlendMode, const SkSamplingOptions &, const SkRect *, const SkPaint *) override
 
void onDrawVerticesObject (const SkVertices *, SkBlendMode, const SkPaint &) override
 
void onDrawPatch (const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], SkBlendMode, const SkPaint &paint) override
 
void onDrawPicture (const SkPicture *, const SkMatrix *, const SkPaint *) override
 
void onDrawDrawable (SkDrawable *, const SkMatrix *) override
 
void onDrawGlyphRunList (const sktext::GlyphRunList &, const SkPaint &) override
 
void onDrawTextBlob (const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint) override
 
void onDrawAnnotation (const SkRect &rect, const char key[], SkData *value) override
 
void onDrawShadowRec (const SkPath &path, const SkDrawShadowRec &rec) override
 
void onDrawEdgeAAQuad (const SkRect &, const SkPoint[4], QuadAAFlags, const SkColor4f &, SkBlendMode) override
 
void onDrawEdgeAAImageSet2 (const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[], const SkSamplingOptions &, const SkPaint *, SrcRectConstraint) override
 
sk_sp< SkSurfaceonNewSurface (const SkImageInfo &, const SkSurfaceProps &) override
 
bool onPeekPixels (SkPixmap *pixmap) override
 
bool onAccessTopLayerPixels (SkPixmap *pixmap) override
 
SkImageInfo onImageInfo () const override
 
bool onGetProps (SkSurfaceProps *props, bool top) const override
 
- Protected Member Functions inherited from SkNWayCanvas
void willSave () override
 
SaveLayerStrategy getSaveLayerStrategy (const SaveLayerRec &) override
 
bool onDoSaveBehind (const SkRect *) override
 
void willRestore () override
 
void didConcat44 (const SkM44 &) override
 
void didSetM44 (const SkM44 &) override
 
void didScale (SkScalar, SkScalar) override
 
void didTranslate (SkScalar, SkScalar) override
 
void onDrawSlug (const sktext::gpu::Slug *slug, const SkPaint &paint) override
 
void onClipRect (const SkRect &, SkClipOp, ClipEdgeStyle) override
 
void onClipRRect (const SkRRect &, SkClipOp, ClipEdgeStyle) override
 
void onClipPath (const SkPath &, SkClipOp, ClipEdgeStyle) override
 
void onClipShader (sk_sp< SkShader >, SkClipOp) override
 
void onClipRegion (const SkRegion &, SkClipOp) override
 
void onResetClip () override
 
- Protected Member Functions inherited from SkCanvas
virtual void didRestore ()
 
virtual void onDrawMesh (const SkMesh &, sk_sp< SkBlender >, const SkPaint &)
 
virtual void onDiscard ()
 
virtual sk_sp< sktext::gpu::SlugonConvertGlyphRunListToSlug (const sktext::GlyphRunList &glyphRunList, const SkPaint &paint)
 
 SkCanvas (const SkIRect &bounds)
 

Private Member Functions

SkPaintFilterCanvasinternal_private_asPaintFilterCanvas () const override
 

Friends

class SkAndroidFrameworkUtils
 

Additional Inherited Members

- Static Public Member Functions inherited from SkCanvas
static std::unique_ptr< SkCanvasMakeRasterDirect (const SkImageInfo &info, void *pixels, size_t rowBytes, const SkSurfaceProps *props=nullptr)
 
static std::unique_ptr< SkCanvasMakeRasterDirectN32 (int width, int height, SkPMColor *pixels, size_t rowBytes)
 
- Static Public Attributes inherited from SkCanvas
static constexpr int kMaxFiltersPerLayer = 16
 
- Protected Types inherited from SkCanvas
enum  SaveLayerStrategy { kFullLayer_SaveLayerStrategy , kNoLayer_SaveLayerStrategy }
 
enum  ClipEdgeStyle { kHard_ClipEdgeStyle , kSoft_ClipEdgeStyle }
 
- Protected Attributes inherited from SkNWayCanvas
SkTDArray< SkCanvas * > fList
 

Detailed Description

A utility proxy base class for implementing draw/paint filters.

Definition at line 54 of file SkPaintFilterCanvas.h.

Member Enumeration Documentation

◆ Type

Enumerator
kPicture_Type 

Definition at line 62 of file SkPaintFilterCanvas.h.

Constructor & Destructor Documentation

◆ SkPaintFilterCanvas()

SkPaintFilterCanvas::SkPaintFilterCanvas ( SkCanvas canvas)

The new SkPaintFilterCanvas is configured for forwarding to the specified canvas. Also copies the target canvas matrix and clip bounds.

Definition at line 51 of file SkPaintFilterCanvas.cpp.

53 canvas->imageInfo().height()) {
54
55 // Transfer matrix & clip state before adding the target canvas.
57 this->setMatrix(canvas->getLocalToDevice());
58
59 this->addCanvas(canvas);
60}
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
SkM44 getLocalToDevice() const
SkIRect getDeviceClipBounds() const
void setMatrix(const SkM44 &matrix)
SkImageInfo imageInfo() const
virtual void addCanvas(SkCanvas *)
int width() const
int height() const
static SkRect Make(const SkISize &size)
Definition SkRect.h:669

Member Function Documentation

◆ getBaseLayerSize()

SkISize SkPaintFilterCanvas::getBaseLayerSize ( ) const
inlineoverridevirtual

Gets the size of the base or root layer in global canvas coordinates. The origin of the base layer is always (0,0). The area available for drawing may be smaller (due to clipping or saveLayer).

Returns
integral width and height of base layer

example: https://fiddle.skia.org/c/@Canvas_getBaseLayerSize

Reimplemented from SkCanvas.

Definition at line 67 of file SkPaintFilterCanvas.h.

67{ return proxy()->getBaseLayerSize(); }
virtual SkISize getBaseLayerSize() const
Definition SkCanvas.cpp:373

◆ internal_private_asPaintFilterCanvas()

SkPaintFilterCanvas * SkPaintFilterCanvas::internal_private_asPaintFilterCanvas ( ) const
inlineoverrideprivatevirtual

Reimplemented from SkCanvas.

Definition at line 133 of file SkPaintFilterCanvas.h.

133 {
134 return const_cast<SkPaintFilterCanvas*>(this);
135 }

◆ onAccessTopLayerPixels()

bool SkPaintFilterCanvas::onAccessTopLayerPixels ( SkPixmap pixmap)
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 279 of file SkPaintFilterCanvas.cpp.

279 {
281 size_t rowBytes;
282
283 void* addr = this->proxy()->accessTopLayerPixels(&info, &rowBytes);
284 if (!addr) {
285 return false;
286 }
287
288 pixmap->reset(info, addr, rowBytes);
289 return true;
290}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
void * accessTopLayerPixels(SkImageInfo *info, size_t *rowBytes, SkIPoint *origin=nullptr)
void reset()
Definition SkPixmap.cpp:32

◆ onDrawAnnotation()

void SkPaintFilterCanvas::onDrawAnnotation ( const SkRect rect,
const char  key[],
SkData value 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 237 of file SkPaintFilterCanvas.cpp.

237 {
238 this->SkNWayCanvas::onDrawAnnotation(rect, key, value);
239}
void onDrawAnnotation(const SkRect &, const char[], SkData *) override

◆ onDrawArc()

void SkPaintFilterCanvas::onDrawArc ( const SkRect rect,
SkScalar  startAngle,
SkScalar  sweepAngle,
bool  useCenter,
const SkPaint paint 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 120 of file SkPaintFilterCanvas.cpp.

121 {
122 AutoPaintFilter apf(this, paint);
123 if (apf.shouldDraw()) {
124 this->SkNWayCanvas::onDrawArc(rect, startAngle, sweepAngle, useCenter, apf.paint());
125 }
126}
void onDrawArc(const SkRect &, SkScalar, SkScalar, bool, const SkPaint &) override
const Paint & paint

◆ onDrawAtlas2()

void SkPaintFilterCanvas::onDrawAtlas2 ( const SkImage image,
const SkRSXform  xform[],
const SkRect  tex[],
const SkColor  colors[],
int  count,
SkBlendMode  bmode,
const SkSamplingOptions sampling,
const SkRect cull,
const SkPaint paint 
)
overrideprotectedvirtual

Reimplemented from SkNWayCanvas.

Definition at line 226 of file SkPaintFilterCanvas.cpp.

229 {
230 AutoPaintFilter apf(this, paint);
231 if (apf.shouldDraw()) {
232 this->SkNWayCanvas::onDrawAtlas2(image, xform, tex, colors, count, bmode, sampling, cull,
233 &apf.paint());
234 }
235}
int count
void onDrawAtlas2(const SkImage *, const SkRSXform[], const SkRect[], const SkColor[], int, SkBlendMode, const SkSamplingOptions &, const SkRect *, const SkPaint *) override

◆ onDrawBehind()

void SkPaintFilterCanvas::onDrawBehind ( const SkPaint paint)
overrideprotectedvirtual

Reimplemented from SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 69 of file SkPaintFilterCanvas.cpp.

69 {
70 AutoPaintFilter apf(this, paint);
71 if (apf.shouldDraw()) {
72 this->SkNWayCanvas::onDrawBehind(apf.paint());
73 }
74}
void onDrawBehind(const SkPaint &) override

◆ onDrawDrawable()

void SkPaintFilterCanvas::onDrawDrawable ( SkDrawable drawable,
const SkMatrix matrix 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 200 of file SkPaintFilterCanvas.cpp.

200 {
201 // There is no paint to filter in this case, but we can still filter on type.
202 // Subclasses need to unroll the drawable explicity (by overriding this method) in
203 // order to actually filter nested content.
204 AutoPaintFilter apf(this, nullptr);
205 if (apf.shouldDraw()) {
206 this->SkNWayCanvas::onDrawDrawable(drawable, matrix);
207 }
208}
void onDrawDrawable(SkDrawable *, const SkMatrix *) override

◆ onDrawDRRect()

void SkPaintFilterCanvas::onDrawDRRect ( const SkRRect outer,
const SkRRect inner,
const SkPaint paint 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 98 of file SkPaintFilterCanvas.cpp.

99 {
100 AutoPaintFilter apf(this, paint);
101 if (apf.shouldDraw()) {
102 this->SkNWayCanvas::onDrawDRRect(outer, inner, apf.paint());
103 }
104}
void onDrawDRRect(const SkRRect &, const SkRRect &, const SkPaint &) override

◆ onDrawEdgeAAImageSet2()

void SkPaintFilterCanvas::onDrawEdgeAAImageSet2 ( const ImageSetEntry  set[],
int  count,
const SkPoint  dstClips[],
const SkMatrix  preViewMatrices[],
const SkSamplingOptions sampling,
const SkPaint paint,
SrcRectConstraint  constraint 
)
overrideprotectedvirtual

Reimplemented from SkNWayCanvas.

Definition at line 257 of file SkPaintFilterCanvas.cpp.

262 {
263 AutoPaintFilter apf(this, paint);
264 if (apf.shouldDraw()) {
266 set, count, dstClips, preViewMatrices, sampling, &apf.paint(), constraint);
267 }
268}
void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[], const SkSamplingOptions &, const SkPaint *, SrcRectConstraint) override

◆ onDrawEdgeAAQuad()

void SkPaintFilterCanvas::onDrawEdgeAAQuad ( const SkRect rect,
const SkPoint  clip[4],
QuadAAFlags  aa,
const SkColor4f color,
SkBlendMode  mode 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 245 of file SkPaintFilterCanvas.cpp.

246 {
248 paint.setColor(color);
249 paint.setBlendMode(mode);
250 AutoPaintFilter apf(this, paint);
251 if (apf.shouldDraw()) {
252 this->SkNWayCanvas::onDrawEdgeAAQuad(rect, clip, aa, apf.paint().getColor4f(),
253 apf.paint().getBlendMode_or(SkBlendMode::kSrcOver));
254 }
255}
SkColor4f color
@ kSrcOver
r = s + (1-sa)*d
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition SkPath.cpp:3824
void onDrawEdgeAAQuad(const SkRect &, const SkPoint[4], QuadAAFlags, const SkColor4f &, SkBlendMode) override

◆ onDrawGlyphRunList()

void SkPaintFilterCanvas::onDrawGlyphRunList ( const sktext::GlyphRunList list,
const SkPaint paint 
)
overrideprotectedvirtual

Reimplemented from SkNWayCanvas.

Definition at line 210 of file SkPaintFilterCanvas.cpp.

211 {
212 AutoPaintFilter apf(this, paint);
213 if (apf.shouldDraw()) {
214 this->SkNWayCanvas::onDrawGlyphRunList(list, apf.paint());
215 }
216}
void onDrawGlyphRunList(const sktext::GlyphRunList &, const SkPaint &) override

◆ onDrawImage2()

void SkPaintFilterCanvas::onDrawImage2 ( const SkImage image,
SkScalar  left,
SkScalar  top,
const SkSamplingOptions sampling,
const SkPaint paint 
)
overrideprotectedvirtual

Reimplemented from SkNWayCanvas.

Definition at line 135 of file SkPaintFilterCanvas.cpp.

136 {
137 AutoPaintFilter apf(this, paint);
138 if (apf.shouldDraw()) {
139 this->SkNWayCanvas::onDrawImage2(image, left, top, sampling, &apf.paint());
140 }
141}
static bool left(const SkPoint &p0, const SkPoint &p1)
void onDrawImage2(const SkImage *, SkScalar, SkScalar, const SkSamplingOptions &, const SkPaint *) override

◆ onDrawImageLattice2()

void SkPaintFilterCanvas::onDrawImageLattice2 ( const SkImage image,
const Lattice lattice,
const SkRect dst,
SkFilterMode  filter,
const SkPaint paint 
)
overrideprotectedvirtual

Reimplemented from SkNWayCanvas.

Definition at line 152 of file SkPaintFilterCanvas.cpp.

154 {
155 AutoPaintFilter apf(this, paint);
156 if (apf.shouldDraw()) {
157 this->SkNWayCanvas::onDrawImageLattice2(image, lattice, dst, filter, &apf.paint());
158 }
159}
void onDrawImageLattice2(const SkImage *, const Lattice &, const SkRect &, SkFilterMode, const SkPaint *) override

◆ onDrawImageRect2()

void SkPaintFilterCanvas::onDrawImageRect2 ( const SkImage image,
const SkRect src,
const SkRect dst,
const SkSamplingOptions sampling,
const SkPaint paint,
SrcRectConstraint  constraint 
)
overrideprotectedvirtual

Reimplemented from SkNWayCanvas.

Definition at line 143 of file SkPaintFilterCanvas.cpp.

145 {
146 AutoPaintFilter apf(this, paint);
147 if (apf.shouldDraw()) {
148 this->SkNWayCanvas::onDrawImageRect2(image, src, dst, sampling, &apf.paint(), constraint);
149 }
150}
void onDrawImageRect2(const SkImage *, const SkRect &, const SkRect &, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint) override

◆ onDrawOval()

void SkPaintFilterCanvas::onDrawOval ( const SkRect rect,
const SkPaint paint 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 113 of file SkPaintFilterCanvas.cpp.

113 {
114 AutoPaintFilter apf(this, paint);
115 if (apf.shouldDraw()) {
116 this->SkNWayCanvas::onDrawOval(rect, apf.paint());
117 }
118}
void onDrawOval(const SkRect &, const SkPaint &) override

◆ onDrawPaint()

void SkPaintFilterCanvas::onDrawPaint ( const SkPaint paint)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 62 of file SkPaintFilterCanvas.cpp.

62 {
63 AutoPaintFilter apf(this, paint);
64 if (apf.shouldDraw()) {
65 this->SkNWayCanvas::onDrawPaint(apf.paint());
66 }
67}
void onDrawPaint(const SkPaint &) override

◆ onDrawPatch()

void SkPaintFilterCanvas::onDrawPatch ( const SkPoint  cubics[12],
const SkColor  colors[4],
const SkPoint  texCoords[4],
SkBlendMode  bmode,
const SkPaint paint 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 169 of file SkPaintFilterCanvas.cpp.

171 {
172 AutoPaintFilter apf(this, paint);
173 if (apf.shouldDraw()) {
174 this->SkNWayCanvas::onDrawPatch(cubics, colors, texCoords, bmode, apf.paint());
175 }
176}
void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], SkBlendMode, const SkPaint &paint) override

◆ onDrawPath()

void SkPaintFilterCanvas::onDrawPath ( const SkPath path,
const SkPaint paint 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 128 of file SkPaintFilterCanvas.cpp.

128 {
129 AutoPaintFilter apf(this, paint);
130 if (apf.shouldDraw()) {
131 this->SkNWayCanvas::onDrawPath(path, apf.paint());
132 }
133}
void onDrawPath(const SkPath &, const SkPaint &) override

◆ onDrawPicture()

void SkPaintFilterCanvas::onDrawPicture ( const SkPicture picture,
const SkMatrix m,
const SkPaint originalPaint 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 178 of file SkPaintFilterCanvas.cpp.

179 {
180 AutoPaintFilter apf(this, originalPaint);
181 if (apf.shouldDraw()) {
182 const SkPaint* newPaint = &apf.paint();
183
184 // Passing a paint (-vs- passing null) makes drawPicture draw into a layer...
185 // much slower, and can produce different blending. Thus we should only do this
186 // if the filter's effect actually impacts the picture.
187 if (originalPaint == nullptr) {
188 if ( newPaint->getAlphaf() == 1.0f
189 && newPaint->getColorFilter() == nullptr
190 && newPaint->getImageFilter() == nullptr
191 && newPaint->asBlendMode() == SkBlendMode::kSrcOver) {
192 // restore the original nullptr
193 newPaint = nullptr;
194 }
195 }
196 this->SkNWayCanvas::onDrawPicture(picture, m, newPaint);
197 }
198}
void onDrawPicture(const SkPicture *, const SkMatrix *, const SkPaint *) override
SkColorFilter * getColorFilter() const
Definition SkPaint.h:426
float getAlphaf() const
Definition SkPaint.h:261
SkImageFilter * getImageFilter() const
Definition SkPaint.h:564
std::optional< SkBlendMode > asBlendMode() const
Definition SkPaint.cpp:138

◆ onDrawPoints()

void SkPaintFilterCanvas::onDrawPoints ( PointMode  mode,
size_t  count,
const SkPoint  pts[],
const SkPaint paint 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 76 of file SkPaintFilterCanvas.cpp.

77 {
78 AutoPaintFilter apf(this, paint);
79 if (apf.shouldDraw()) {
80 this->SkNWayCanvas::onDrawPoints(mode, count, pts, apf.paint());
81 }
82}
void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint &) override

◆ onDrawRect()

void SkPaintFilterCanvas::onDrawRect ( const SkRect rect,
const SkPaint paint 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 84 of file SkPaintFilterCanvas.cpp.

84 {
85 AutoPaintFilter apf(this, paint);
86 if (apf.shouldDraw()) {
87 this->SkNWayCanvas::onDrawRect(rect, apf.paint());
88 }
89}
void onDrawRect(const SkRect &, const SkPaint &) override

◆ onDrawRegion()

void SkPaintFilterCanvas::onDrawRegion ( const SkRegion region,
const SkPaint paint 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 106 of file SkPaintFilterCanvas.cpp.

106 {
107 AutoPaintFilter apf(this, paint);
108 if (apf.shouldDraw()) {
109 this->SkNWayCanvas::onDrawRegion(region, apf.paint());
110 }
111}
void onDrawRegion(const SkRegion &, const SkPaint &) override

◆ onDrawRRect()

void SkPaintFilterCanvas::onDrawRRect ( const SkRRect rrect,
const SkPaint paint 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 91 of file SkPaintFilterCanvas.cpp.

91 {
92 AutoPaintFilter apf(this, paint);
93 if (apf.shouldDraw()) {
94 this->SkNWayCanvas::onDrawRRect(rrect, apf.paint());
95 }
96}
void onDrawRRect(const SkRRect &, const SkPaint &) override

◆ onDrawShadowRec()

void SkPaintFilterCanvas::onDrawShadowRec ( const SkPath path,
const SkDrawShadowRec rec 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 241 of file SkPaintFilterCanvas.cpp.

241 {
242 this->SkNWayCanvas::onDrawShadowRec(path, rec);
243}
void onDrawShadowRec(const SkPath &, const SkDrawShadowRec &) override

◆ onDrawTextBlob()

void SkPaintFilterCanvas::onDrawTextBlob ( const SkTextBlob blob,
SkScalar  x,
SkScalar  y,
const SkPaint paint 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkNWayCanvas >.

Definition at line 218 of file SkPaintFilterCanvas.cpp.

219 {
220 AutoPaintFilter apf(this, paint);
221 if (apf.shouldDraw()) {
222 this->SkNWayCanvas::onDrawTextBlob(blob, x, y, apf.paint());
223 }
224}
void onDrawTextBlob(const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint) override
double y
double x

◆ onDrawVerticesObject()

void SkPaintFilterCanvas::onDrawVerticesObject ( const SkVertices vertices,
SkBlendMode  bmode,
const SkPaint paint 
)
overrideprotectedvirtual

Reimplemented from SkNWayCanvas.

Definition at line 161 of file SkPaintFilterCanvas.cpp.

162 {
163 AutoPaintFilter apf(this, paint);
164 if (apf.shouldDraw()) {
165 this->SkNWayCanvas::onDrawVerticesObject(vertices, bmode, apf.paint());
166 }
167}
void onDrawVerticesObject(const SkVertices *, SkBlendMode, const SkPaint &) override

◆ onFilter()

virtual bool SkPaintFilterCanvas::onFilter ( SkPaint paint) const
protectedpure virtual

Called with the paint that will be used to draw the specified type. The implementation may modify the paint as they wish.

The result bool is used to determine whether the draw op is to be executed (true) or skipped (false).

Note: The base implementation calls onFilter() for top-level/explicit paints only. To also filter encapsulated paints (e.g. SkPicture, SkTextBlob), clients may need to override the relevant methods (i.e. drawPicture, drawTextBlob).

Implemented in DebugPaintFilterCanvas, and OveridePaintFilterCanvas.

◆ onGetProps()

bool SkPaintFilterCanvas::onGetProps ( SkSurfaceProps props,
bool  top 
) const
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 296 of file SkPaintFilterCanvas.cpp.

296 {
297 if (props) {
298 *props = top ? this->proxy()->getTopProps() : this->proxy()->getBaseProps();
299 }
300 return true;
301}
SkSurfaceProps getTopProps() const
SkSurfaceProps getBaseProps() const

◆ onImageInfo()

SkImageInfo SkPaintFilterCanvas::onImageInfo ( ) const
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 292 of file SkPaintFilterCanvas.cpp.

292 {
293 return this->proxy()->imageInfo();
294}

◆ onNewSurface()

sk_sp< SkSurface > SkPaintFilterCanvas::onNewSurface ( const SkImageInfo info,
const SkSurfaceProps props 
)
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 270 of file SkPaintFilterCanvas.cpp.

271 {
272 return this->proxy()->makeSurface(info, &props);
273}
sk_sp< SkSurface > makeSurface(const SkImageInfo &info, const SkSurfaceProps *props=nullptr)

◆ onPeekPixels()

bool SkPaintFilterCanvas::onPeekPixels ( SkPixmap pixmap)
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 275 of file SkPaintFilterCanvas.cpp.

275 {
276 return this->proxy()->peekPixels(pixmap);
277}
bool peekPixels(SkPixmap *pixmap)

◆ recordingContext()

GrRecordingContext * SkPaintFilterCanvas::recordingContext ( ) const
inlineoverridevirtual

Returns Ganesh context of the GPU surface associated with SkCanvas.

Returns
GPU context, if available; nullptr otherwise

example: https://fiddle.skia.org/c/@Canvas_recordingContext

Reimplemented from SkCanvas.

Definition at line 68 of file SkPaintFilterCanvas.h.

68{ return proxy()->recordingContext(); }
virtual GrRecordingContext * recordingContext() const

Friends And Related Symbol Documentation

◆ SkAndroidFrameworkUtils

friend class SkAndroidFrameworkUtils
friend

Definition at line 137 of file SkPaintFilterCanvas.h.


The documentation for this class was generated from the following files: