Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
DebugCanvas Class Reference

#include <DebugCanvas.h>

Inheritance diagram for DebugCanvas:
SkCanvasVirtualEnforcer< SkCanvas > SkCanvas

Public Member Functions

 DebugCanvas (int width, int height)
 
 DebugCanvas (SkIRect bounds)
 
 ~DebugCanvas () override
 
void setLayerManagerAndFrame (DebugLayerManager *lm, int frame)
 
void setOverdrawViz (bool overdrawViz)
 
bool getOverdrawViz () const
 
void setClipVizColor (SkColor clipVizColor)
 
void setAndroidClipViz (bool enable)
 
void setOriginVisible (bool enable)
 
void setDrawGpuOpBounds (bool drawGpuOpBounds)
 
bool getDrawGpuOpBounds () const
 
void draw (SkCanvas *canvas)
 
void drawTo (SkCanvas *canvas, int index, int m=-1)
 
const SkM44getCurrentMatrix ()
 
const SkIRectgetCurrentClip ()
 
void deleteDrawCommandAt (int index)
 
DrawCommandgetDrawCommandAt (int index) const
 
int getSize () const
 
void toggleCommand (int index, bool toggle)
 
void toJSON (SkJSONWriter &writer, UrlDataManager &urlDataManager, SkCanvas *)
 
void toJSONOpsTask (SkJSONWriter &writer, SkCanvas *)
 
void detachCommands (SkTDArray< DrawCommand * > *dst)
 
std::map< int, std::vector< int > > getImageIdToCommandMap (UrlDataManager &udm) const
 
- 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
 
virtual SkISize getBaseLayerSize () const
 
sk_sp< SkSurfacemakeSurface (const SkImageInfo &info, const SkSurfaceProps *props=nullptr)
 
virtual GrRecordingContextrecordingContext () const
 
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

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

Additional Inherited Members

- 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 > >
 
- 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 }
 

Detailed Description

Definition at line 49 of file DebugCanvas.h.

Constructor & Destructor Documentation

◆ DebugCanvas() [1/2]

DebugCanvas::DebugCanvas ( int  width,
int  height 
)

Definition at line 112 of file DebugCanvas.cpp.

113 : INHERITED(width, height)
114 , fOverdrawViz(false)
115 , fClipVizColor(SK_ColorTRANSPARENT)
116 , fDrawGpuOpBounds(false)
117 , fShowAndroidClip(false)
118 , fShowOrigin(false)
119 , fnextDrawPictureLayerId(-1)
120 , fnextDrawImageRectLayerId(-1)
121 , fAndroidClip(SkRect::MakeEmpty()) {
122 // SkPicturePlayback uses the base-class' quickReject calls to cull clipped
123 // operations. This can lead to problems in the debugger which expects all
124 // the operations in the captured skp to appear in the debug canvas. To
125 // circumvent this we create a wide open clip here (an empty clip rect
126 // is not sufficient).
127 // Internally, the SkRect passed to clipRect is converted to an SkIRect and
128 // rounded out. The following code creates a nearly maximal rect that will
129 // not get collapsed by the coming conversions (Due to precision loss the
130 // inset has to be surprisingly large).
131 SkIRect largeIRect = SkRectPriv::MakeILarge();
132 largeIRect.inset(1024, 1024);
133 SkRect large = SkRect::Make(largeIRect);
134#ifdef SK_DEBUG
135 SkASSERT(!large.roundOut().isEmpty());
136#endif
137 // call the base class' version to avoid adding a draw command
139}
#define SkASSERT(cond)
Definition: SkAssert.h:116
constexpr SkColor SK_ColorTRANSPARENT
Definition: SkColor.h:99
virtual void onClipRect(const SkRect &rect, SkClipOp op, ClipEdgeStyle edgeStyle)
Definition: SkCanvas.cpp:1370
@ kHard_ClipEdgeStyle
Definition: SkCanvas.h:2336
static SkIRect MakeILarge()
Definition: SkRectPriv.h:22
int32_t height
int32_t width
Definition: SkRect.h:32
void inset(int32_t dx, int32_t dy)
Definition: SkRect.h:411
static SkRect Make(const SkISize &size)
Definition: SkRect.h:669
static constexpr SkRect MakeEmpty()
Definition: SkRect.h:595
void roundOut(SkIRect *dst) const
Definition: SkRect.h:1241

◆ DebugCanvas() [2/2]

DebugCanvas::DebugCanvas ( SkIRect  bounds)

Definition at line 141 of file DebugCanvas.cpp.

142 : DebugCanvas(bounds.width(), bounds.height()) {}
DebugCanvas(int width, int height)
Optional< SkRect > bounds
Definition: SkRecords.h:189

◆ ~DebugCanvas()

DebugCanvas::~DebugCanvas ( )
override

Definition at line 144 of file DebugCanvas.cpp.

144 {
145 for (DrawCommand* p : fCommandVector) {
146 delete p;
147 }
148 fCommandVector.reset();
149}

Member Function Documentation

◆ deleteDrawCommandAt()

void DebugCanvas::deleteDrawCommandAt ( int  index)

Removes the command at the specified index

Parameters
indexThe index of the command to delete

Definition at line 289 of file DebugCanvas.cpp.

289 {
290 SkASSERT(index < fCommandVector.size());
291 delete fCommandVector[index];
292 fCommandVector.remove(index);
293}
int size() const
Definition: SkTDArray.h:138
void remove(int index, int count=1)
Definition: SkTDArray.h:210

◆ detachCommands()

void DebugCanvas::detachCommands ( SkTDArray< DrawCommand * > *  dst)
inline

Definition at line 150 of file DebugCanvas.h.

150{ fCommandVector.swap(*dst); }
void swap(SkTDArray< T > &that)
Definition: SkTDArray.h:130
dst
Definition: cp.py:12

◆ didConcat44()

void DebugCanvas::didConcat44 ( const SkM44 m)
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 414 of file DebugCanvas.cpp.

414 {
415 this->addDrawCommand(new Concat44Command(m));
416 this->INHERITED::didConcat44(m);
417}
virtual void didConcat44(const SkM44 &)
Definition: SkCanvas.h:2279

◆ didScale()

void DebugCanvas::didScale ( SkScalar  x,
SkScalar  y 
)
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 419 of file DebugCanvas.cpp.

419 {
420 this->didConcat44(SkM44::Scale(x, y));
421}
void didConcat44(const SkM44 &) override
static SkM44 Scale(SkScalar x, SkScalar y, SkScalar z=1)
Definition: SkM44.h:232
double y
double x

◆ didSetM44()

void DebugCanvas::didSetM44 ( const SkM44 matrix)
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 643 of file DebugCanvas.cpp.

643 {
644 this->addDrawCommand(new SetM44Command(matrix));
645 this->INHERITED::didSetM44(matrix);
646}
virtual void didSetM44(const SkM44 &)
Definition: SkCanvas.h:2280
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258

◆ didTranslate()

void DebugCanvas::didTranslate ( SkScalar  x,
SkScalar  y 
)
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 423 of file DebugCanvas.cpp.

423 {
425}
static SkM44 Translate(SkScalar x, SkScalar y, SkScalar z=0)
Definition: SkM44.h:225

◆ draw()

void DebugCanvas::draw ( SkCanvas canvas)

Executes all draw calls to the canvas.

Parameters
canvasThe canvas being drawn to

Definition at line 153 of file DebugCanvas.cpp.

153 {
154 if (!fCommandVector.empty()) {
155 this->drawTo(canvas, fCommandVector.size() - 1);
156 }
157}
void drawTo(SkCanvas *canvas, int index, int m=-1)
bool empty() const
Definition: SkTDArray.h:135

◆ drawTo()

void DebugCanvas::drawTo ( SkCanvas canvas,
int  index,
int  m = -1 
)

Executes the draw calls up to the specified index. Does not clear the canvas to transparent black first, if needed, caller should do that first.

Parameters
canvasThe canvas being drawn to
indexThe index of the final command being executed
man optional Mth gpu op to highlight, or -1

Definition at line 159 of file DebugCanvas.cpp.

159 {
160 SkASSERT(!fCommandVector.empty());
161 SkASSERT(index < fCommandVector.size());
162
163 int saveCount = originalCanvas->save();
164
165 originalCanvas->resetMatrix();
166 SkCanvasPriv::ResetClip(originalCanvas);
167
168 DebugPaintFilterCanvas filterCanvas(originalCanvas);
169 SkCanvas* finalCanvas = fOverdrawViz ? &filterCanvas : originalCanvas;
170
171#if defined(SK_GANESH)
172 auto dContext = GrAsDirectContext(finalCanvas->recordingContext());
173
174 // If we have a GPU backend we can also visualize the op information
175 GrAuditTrail* at = nullptr;
176 if (fDrawGpuOpBounds || m != -1) {
177 // The audit trail must be obtained from the original canvas.
178 at = this->getAuditTrail(originalCanvas);
179 }
180#endif
181
182 for (int i = 0; i <= index; i++) {
183#if defined(SK_GANESH)
184 GrAuditTrail::AutoCollectOps* acb = nullptr;
185 if (at) {
186 // We need to flush any pending operations, or they might combine with commands below.
187 // Previous operations were not registered with the audit trail when they were
188 // created, so if we allow them to combine, the audit trail will fail to find them.
189 if (dContext) {
190 dContext->flush();
191 }
192 acb = new GrAuditTrail::AutoCollectOps(at, i);
193 }
194#endif
195 if (fCommandVector[i]->isVisible()) {
196 fCommandVector[i]->execute(finalCanvas);
197 }
198#if defined(SK_GANESH)
199 if (at && acb) {
200 delete acb;
201 }
202#endif
203 }
204
205 if (SkColorGetA(fClipVizColor) != 0) {
206 finalCanvas->save();
207 SkPaint clipPaint;
208 clipPaint.setColor(fClipVizColor);
209 finalCanvas->drawPaint(clipPaint);
210 finalCanvas->restore();
211 }
212
213 fMatrix = finalCanvas->getLocalToDevice();
214 fClip = finalCanvas->getDeviceClipBounds();
215 if (fShowOrigin) {
216 const SkPaint originXPaint = SkPaint({1.0, 0, 0, 1.0});
217 const SkPaint originYPaint = SkPaint({0, 1.0, 0, 1.0});
218 // Draw an origin cross at the origin before restoring to assist in visualizing the
219 // current matrix.
220 drawArrow(finalCanvas, {-50, 0}, {50, 0}, originXPaint);
221 drawArrow(finalCanvas, {0, -50}, {0, 50}, originYPaint);
222 }
223 finalCanvas->restoreToCount(saveCount);
224
225 if (fShowAndroidClip) {
226 // Draw visualization of android device clip restriction
227 SkPaint androidClipPaint;
228 androidClipPaint.setARGB(80, 255, 100, 0);
229 finalCanvas->drawRect(fAndroidClip, androidClipPaint);
230 }
231
232#if defined(SK_GANESH)
233 // draw any ops if required and issue a full reset onto GrAuditTrail
234 if (at) {
235 // just in case there is global reordering, we flush the canvas before querying
236 // GrAuditTrail
238 if (dContext) {
239 dContext->flush();
240 }
241
242 // we pick three colorblind-safe colors, 75% alpha
243 static const SkColor kTotalBounds = SkColorSetARGB(0xC0, 0x6A, 0x3D, 0x9A);
244 static const SkColor kCommandOpBounds = SkColorSetARGB(0xC0, 0xE3, 0x1A, 0x1C);
245 static const SkColor kOtherOpBounds = SkColorSetARGB(0xC0, 0xFF, 0x7F, 0x00);
246
247 // get the render target of the top device (from the original canvas) so we can ignore ops
248 // drawn offscreen
250 GrSurfaceProxy::UniqueID proxyID = rtp->uniqueID();
251
252 // get the bounding boxes to draw
253 TArray<GrAuditTrail::OpInfo> childrenBounds;
254 if (m == -1) {
255 at->getBoundsByClientID(&childrenBounds, index);
256 } else {
257 // the client wants us to draw the mth op
258 at->getBoundsByOpsTaskID(&childrenBounds.push_back(), m);
259 }
260 // Shift the rects half a pixel, so they appear as exactly 1px thick lines.
261 finalCanvas->save();
262 finalCanvas->translate(0.5, -0.5);
265 paint.setStrokeWidth(1);
266 for (int i = 0; i < childrenBounds.size(); i++) {
267 if (childrenBounds[i].fProxyUniqueID != proxyID) {
268 // offscreen draw, ignore for now
269 continue;
270 }
271 paint.setColor(kTotalBounds);
272 finalCanvas->drawRect(childrenBounds[i].fBounds, paint);
273 for (int j = 0; j < childrenBounds[i].fOps.size(); j++) {
274 const GrAuditTrail::OpInfo::Op& op = childrenBounds[i].fOps[j];
275 if (op.fClientID != index) {
276 paint.setColor(kOtherOpBounds);
277 } else {
278 paint.setColor(kCommandOpBounds);
279 }
280 finalCanvas->drawRect(op.fBounds, paint);
281 }
282 }
283 finalCanvas->restore();
284 this->cleanupAuditTrail(at);
285 }
286#endif
287}
static GrDirectContext * GrAsDirectContext(GrContext_Base *base)
const SkRect fBounds
uint32_t SkColor
Definition: SkColor.h:37
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
Definition: SkColor.h:49
#define SkColorGetA(color)
Definition: SkColor.h:61
void getBoundsByOpsTaskID(OpInfo *outInfo, int opsTaskID)
void getBoundsByClientID(skia_private::TArray< OpInfo > *outInfo, int clientID)
UniqueID uniqueID() const
static void ResetClip(SkCanvas *canvas)
Definition: SkCanvasPriv.h:61
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
virtual GrRecordingContext * recordingContext() const
Definition: SkCanvas.cpp:1637
void drawPaint(const SkPaint &paint)
Definition: SkCanvas.cpp:1668
SkM44 getLocalToDevice() const
Definition: SkCanvas.cpp:1633
void restoreToCount(int saveCount)
Definition: SkCanvas.cpp:478
SkIRect getDeviceClipBounds() const
Definition: SkCanvas.cpp:1607
int save()
Definition: SkCanvas.cpp:447
void setColor(SkColor color)
Definition: SkPaint.cpp:119
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
void setARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
Definition: SkPaint.cpp:134
int size() const
Definition: SkTArray.h:421
const Paint & paint
Definition: color_source.cc:38
GrRenderTargetProxy * TopDeviceTargetProxy(const SkCanvas *canvas)
Definition: GrCanvas.cpp:34

◆ getCurrentClip()

const SkIRect & DebugCanvas::getCurrentClip ( )
inline

Returns the most recently calculated clip

Definition at line 116 of file DebugCanvas.h.

116{ return fClip; }

◆ getCurrentMatrix()

const SkM44 & DebugCanvas::getCurrentMatrix ( )
inline

Returns the most recently calculated transformation matrix

Definition at line 111 of file DebugCanvas.h.

111{ return fMatrix; }

◆ getDrawCommandAt()

DrawCommand * DebugCanvas::getDrawCommandAt ( int  index) const

Returns the draw command at the given index.

Parameters
indexThe index of the command

Definition at line 295 of file DebugCanvas.cpp.

295 {
296 SkASSERT(index < fCommandVector.size());
297 return fCommandVector[index];
298}

◆ getDrawGpuOpBounds()

bool DebugCanvas::getDrawGpuOpBounds ( ) const
inline

Definition at line 90 of file DebugCanvas.h.

90{ return fDrawGpuOpBounds; }

◆ getImageIdToCommandMap()

std::map< int, std::vector< int > > DebugCanvas::getImageIdToCommandMap ( UrlDataManager udm) const

Returns a map from image IDs to command indices where they are used.

Definition at line 653 of file DebugCanvas.cpp.

653 {
654 // map from image ids to list of commands that reference them.
655 std::map<int, std::vector<int>> m;
656
657 for (int i = 0; i < this->getSize(); i++) {
658 const DrawCommand* command = this->getDrawCommandAt(i);
659 int imageIndex = -1;
660 // this is not an exaustive list of where images can be used, they show up in paints too.
661 switch (command->getOpType()) {
662 case DrawCommand::OpType::kDrawImage_OpType: {
663 imageIndex = static_cast<const DrawImageCommand*>(command)->imageId(udm);
664 break;
665 }
666 case DrawCommand::OpType::kDrawImageRect_OpType: {
667 imageIndex = static_cast<const DrawImageRectCommand*>(command)->imageId(udm);
668 break;
669 }
670 case DrawCommand::OpType::kDrawImageLattice_OpType: {
671 imageIndex = static_cast<const DrawImageLatticeCommand*>(command)->imageId(udm);
672 break;
673 }
674 default: break;
675 }
676 if (imageIndex >= 0) {
677 m[imageIndex].push_back(i);
678 }
679 }
680 return m;
681}
DrawCommand * getDrawCommandAt(int index) const
int getSize() const
Definition: DebugCanvas.h:133
list command
Definition: valgrind.py:24

◆ getOverdrawViz()

bool DebugCanvas::getOverdrawViz ( ) const
inline

Definition at line 77 of file DebugCanvas.h.

77{ return fOverdrawViz; }

◆ getSaveLayerStrategy()

SkCanvas::SaveLayerStrategy DebugCanvas::getSaveLayerStrategy ( const SaveLayerRec rec)
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 631 of file DebugCanvas.cpp.

631 {
632 this->addDrawCommand(new SaveLayerCommand(rec));
633 (void)this->INHERITED::getSaveLayerStrategy(rec);
634 // No need for a full layer.
636}
virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec &)
Definition: SkCanvas.h:2270
@ kNoLayer_SaveLayerStrategy
Definition: SkCanvas.h:2265

◆ getSize()

int DebugCanvas::getSize ( ) const
inline

Returns length of draw command vector.

Definition at line 133 of file DebugCanvas.h.

133{ return fCommandVector.size(); }

◆ onClipPath()

void DebugCanvas::onClipPath ( const SkPath path,
SkClipOp  op,
ClipEdgeStyle  edgeStyle 
)
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 390 of file DebugCanvas.cpp.

390 {
391 this->addDrawCommand(new ClipPathCommand(path, op, kSoft_ClipEdgeStyle == edgeStyle));
392}
@ kSoft_ClipEdgeStyle
Definition: SkCanvas.h:2337
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57

◆ onClipRect()

void DebugCanvas::onClipRect ( const SkRect rect,
SkClipOp  op,
ClipEdgeStyle  edgeStyle 
)
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 394 of file DebugCanvas.cpp.

394 {
395 this->addDrawCommand(new ClipRectCommand(rect, op, kSoft_ClipEdgeStyle == edgeStyle));
396}
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350

◆ onClipRegion()

void DebugCanvas::onClipRegion ( const SkRegion region,
SkClipOp  op 
)
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 402 of file DebugCanvas.cpp.

402 {
403 this->addDrawCommand(new ClipRegionCommand(region, op));
404}
ClipOpAndAA opAA SkRegion region
Definition: SkRecords.h:238

◆ onClipRRect()

void DebugCanvas::onClipRRect ( const SkRRect rrect,
SkClipOp  op,
ClipEdgeStyle  edgeStyle 
)
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 398 of file DebugCanvas.cpp.

398 {
399 this->addDrawCommand(new ClipRRectCommand(rrect, op, kSoft_ClipEdgeStyle == edgeStyle));
400}
SkRRect rrect
Definition: SkRecords.h:232

◆ onClipShader()

void DebugCanvas::onClipShader ( sk_sp< SkShader cs,
SkClipOp  op 
)
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 406 of file DebugCanvas.cpp.

406 {
407 this->addDrawCommand(new ClipShaderCommand(std::move(cs), op));
408}

◆ onDoSaveBehind()

bool DebugCanvas::onDoSaveBehind ( const SkRect subset)
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 638 of file DebugCanvas.cpp.

638 {
639 // TODO
640 return false;
641}

◆ onDrawAnnotation()

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

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 427 of file DebugCanvas.cpp.

427 {
428 // Parse layer-releated annotations added in SkiaPipeline.cpp and RenderNodeDrawable.cpp
429 // the format of the annotations is <Indicator|RenderNodeId>
432 if (tokens.size() == 2) {
433 if (tokens[0].equals(kOffscreenLayerDraw)) {
434 // Indicates that the next drawPicture command contains the SkPicture to render the
435 // node at this id in an offscreen buffer.
436 fnextDrawPictureLayerId = std::stoi(tokens[1].c_str());
437 fnextDrawPictureDirtyRect = rect.roundOut();
438 return; // don't record it
439 } else if (tokens[0].equals(kSurfaceID)) {
440 // Indicates that the following drawImageRect should draw the offscreen buffer.
441 fnextDrawImageRectLayerId = std::stoi(tokens[1].c_str());
442 return; // don't record it
443 }
444 }
445 if (strcmp(kAndroidClip, key) == 0) {
446 // Store this frame's android device clip restriction for visualization later.
447 // This annotation stands in place of the androidFramework_setDeviceClipRestriction
448 // which is unrecordable.
449 fAndroidClip = rect;
450 }
451 this->addDrawCommand(new DrawAnnotationCommand(rect, key, sk_ref_sp(value)));
452}
bool equals(SkDrawable *a, SkDrawable *b)
sk_sp< T > sk_ref_sp(T *obj)
Definition: SkRefCnt.h:381
void SkStrSplit(const char *str, const char *delimiters, SkStrSplitMode splitMode, TArray< SkString > *out)
@ kStrict_SkStrSplitMode
Definition: SkStringUtils.h:47
uint8_t value
bool stoi(std::string_view s, SKSL_INT *value)
Definition: SkSLString.cpp:66

◆ onDrawArc()

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

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 499 of file DebugCanvas.cpp.

503 {
504 this->addDrawCommand(new DrawArcCommand(oval, startAngle, sweepAngle, useCenter, paint));
505}
SkRect oval
Definition: SkRecords.h:249
SkScalar startAngle
Definition: SkRecords.h:250
SkScalar sweepAngle
Definition: SkRecords.h:251

◆ onDrawAtlas2()

void DebugCanvas::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 SkCanvas.

Definition at line 581 of file DebugCanvas.cpp.

589 {
590 this->addDrawCommand(
591 new DrawAtlasCommand(image, xform, tex, colors, count, bmode, sampling, cull, paint));
592}
int count
Definition: FontMgrTest.cpp:50
sk_sp< const SkImage > image
Definition: SkRecords.h:269
PODArray< SkColor > colors
Definition: SkRecords.h:276
SkSamplingOptions sampling
Definition: SkRecords.h:337

◆ onDrawBehind()

void DebugCanvas::onDrawBehind ( const SkPaint paint)
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 511 of file DebugCanvas.cpp.

511 {
512 this->addDrawCommand(new DrawBehindCommand(paint));
513}

◆ onDrawDrawable()

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

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 598 of file DebugCanvas.cpp.

598 {
599 this->addDrawCommand(new DrawDrawableCommand(drawable, matrix));
600}

◆ onDrawDRRect()

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

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 554 of file DebugCanvas.cpp.

554 {
555 this->addDrawCommand(new DrawDRRectCommand(outer, inner, paint));
556}

◆ onDrawEdgeAAImageSet2()

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

Reimplemented from SkCanvas.

Definition at line 610 of file DebugCanvas.cpp.

616 {
617 this->addDrawCommand(new DrawEdgeAAImageSetCommand(
618 set, count, dstClips, preViewMatrices, sampling, paint, constraint));
619}
PODArray< SkPoint > dstClips
Definition: SkRecords.h:364
PODArray< SkMatrix > preViewMatrices
Definition: SkRecords.h:365
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
Definition: switches.h:76

◆ onDrawEdgeAAQuad()

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

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 602 of file DebugCanvas.cpp.

606 {
607 this->addDrawCommand(new DrawEdgeAAQuadCommand(rect, clip, aa, color, mode));
608}
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition: SkPath.cpp:3892
DlColor color
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228

◆ onDrawImage2()

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

Reimplemented from SkCanvas.

Definition at line 454 of file DebugCanvas.cpp.

458 {
459 this->addDrawCommand(new DrawImageCommand(image, left, top, sampling, paint));
460}
static bool left(const SkPoint &p0, const SkPoint &p1)

◆ onDrawImageLattice2()

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

Reimplemented from SkCanvas.

Definition at line 462 of file DebugCanvas.cpp.

466 {
467 this->addDrawCommand(new DrawImageLatticeCommand(image, lattice, dst, filter, paint));
468}

◆ onDrawImageRect2()

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

Reimplemented from SkCanvas.

Definition at line 470 of file DebugCanvas.cpp.

475 {
476 if (fnextDrawImageRectLayerId != -1 && fLayerManager) {
477 // This drawImageRect command would have drawn the offscreen buffer for a layer.
478 // On Android, we recorded an SkPicture of the commands that drew to the layer.
479 // To render the layer as it would have looked on the frame this DebugCanvas draws, we need
480 // to call fLayerManager->getLayerAsImage(id). This must be done just before
481 // drawTo(command), since it depends on the index into the layer's commands
482 // (managed by fLayerManager)
483 // Instead of adding a DrawImageRectCommand, we need a deferred command, that when
484 // executed, will call drawImageRect(fLayerManager->getLayerAsImage())
485 this->addDrawCommand(new DrawImageRectLayerCommand(
486 fLayerManager, fnextDrawImageRectLayerId, fFrame, src, dst, sampling,
487 paint, constraint));
488 } else {
489 this->addDrawCommand(new DrawImageRectCommand(image, src, dst, sampling, paint, constraint));
490 }
491 // Reset expectation so next drawImageRect is not special.
492 fnextDrawImageRectLayerId = -1;
493}

◆ onDrawOval()

void DebugCanvas::onDrawOval ( const SkRect oval,
const SkPaint paint 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 495 of file DebugCanvas.cpp.

495 {
496 this->addDrawCommand(new DrawOvalCommand(oval, paint));
497}

◆ onDrawPaint()

void DebugCanvas::onDrawPaint ( const SkPaint paint)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 507 of file DebugCanvas.cpp.

507 {
508 this->addDrawCommand(new DrawPaintCommand(paint));
509}

◆ onDrawPatch()

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

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 566 of file DebugCanvas.cpp.

570 {
571 this->addDrawCommand(new DrawPatchCommand(cubics, colors, texCoords, bmode, paint));
572}

◆ onDrawPath()

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

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 515 of file DebugCanvas.cpp.

515 {
516 this->addDrawCommand(new DrawPathCommand(path, paint));
517}

◆ onDrawPicture()

void DebugCanvas::onDrawPicture ( const SkPicture picture,
const SkMatrix matrix,
const SkPaint paint 
)
overrideprotectedvirtual

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 523 of file DebugCanvas.cpp.

525 {
526 if (fnextDrawPictureLayerId != -1 && fLayerManager) {
527 fLayerManager->storeSkPicture(fnextDrawPictureLayerId, fFrame, sk_ref_sp(picture),
528 fnextDrawPictureDirtyRect);
529 } else {
530 this->addDrawCommand(new BeginDrawPictureCommand(picture, matrix, paint));
532 picture->playback(this);
533 this->addDrawCommand(new EndDrawPictureCommand(SkToBool(matrix) || SkToBool(paint)));
534 }
535 fnextDrawPictureLayerId = -1;
536}
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35
void storeSkPicture(int nodeId, int frame, const sk_sp< SkPicture > &picture, SkIRect dirty)
virtual SkRect cullRect() const =0
virtual void playback(SkCanvas *canvas, AbortCallback *callback=nullptr) const =0
sk_sp< const SkPicture > picture
Definition: SkRecords.h:299

◆ onDrawPoints()

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

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 538 of file DebugCanvas.cpp.

541 {
542 this->addDrawCommand(new DrawPointsCommand(mode, count, pts, paint));
543}

◆ onDrawRect()

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

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 545 of file DebugCanvas.cpp.

545 {
546 // NOTE(chudy): Messing up when renamed to DrawRect... Why?
547 addDrawCommand(new DrawRectCommand(rect, paint));
548}

◆ onDrawRegion()

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

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 519 of file DebugCanvas.cpp.

519 {
520 this->addDrawCommand(new DrawRegionCommand(region, paint));
521}

◆ onDrawRRect()

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

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 550 of file DebugCanvas.cpp.

550 {
551 this->addDrawCommand(new DrawRRectCommand(rrect, paint));
552}

◆ onDrawShadowRec()

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

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 594 of file DebugCanvas.cpp.

594 {
595 this->addDrawCommand(new DrawShadowCommand(path, rec));
596}

◆ onDrawTextBlob()

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

Implements SkCanvasVirtualEnforcer< SkCanvas >.

Definition at line 558 of file DebugCanvas.cpp.

561 {
562 this->addDrawCommand(
563 new DrawTextBlobCommand(sk_ref_sp(const_cast<SkTextBlob*>(blob)), x, y, paint));
564}

◆ onDrawVerticesObject()

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

Reimplemented from SkCanvas.

Definition at line 574 of file DebugCanvas.cpp.

576 {
577 this->addDrawCommand(
578 new DrawVerticesCommand(sk_ref_sp(const_cast<SkVertices*>(vertices)), bmode, paint));
579}

◆ onResetClip()

void DebugCanvas::onResetClip ( )
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 410 of file DebugCanvas.cpp.

410 {
411 this->addDrawCommand(new ResetClipCommand());
412}

◆ setAndroidClipViz()

void DebugCanvas::setAndroidClipViz ( bool  enable)
inline

Definition at line 84 of file DebugCanvas.h.

84{ this->fShowAndroidClip = enable; }

◆ setClipVizColor()

void DebugCanvas::setClipVizColor ( SkColor  clipVizColor)
inline

Set the color of the clip visualization. An alpha of zero renders the clip invisible.

Definition at line 82 of file DebugCanvas.h.

82{ this->fClipVizColor = clipVizColor; }

◆ setDrawGpuOpBounds()

void DebugCanvas::setDrawGpuOpBounds ( bool  drawGpuOpBounds)
inline

Definition at line 88 of file DebugCanvas.h.

88{ fDrawGpuOpBounds = drawGpuOpBounds; }

◆ setLayerManagerAndFrame()

void DebugCanvas::setLayerManagerAndFrame ( DebugLayerManager lm,
int  frame 
)
inline

Provide a DebugLayerManager for mskp files containing layer information when set this DebugCanvas will attempt to parse layer info from annotations. it will store layer pictures to the layer manager, and interpret some drawImageRects as layer draws, deferring to the layer manager for images. Provide a frame number that will be passed to all layer manager functions to identify this DebugCanvas.

Used only in wasm debugger animations.

Definition at line 67 of file DebugCanvas.h.

67 {
68 fLayerManager = lm;
69 fFrame = frame;
70 }
double frame
Definition: examples.cpp:31

◆ setOriginVisible()

void DebugCanvas::setOriginVisible ( bool  enable)
inline

Definition at line 86 of file DebugCanvas.h.

86{ this->fShowOrigin = enable; }

◆ setOverdrawViz()

void DebugCanvas::setOverdrawViz ( bool  overdrawViz)

Enable or disable overdraw visualization

Definition at line 388 of file DebugCanvas.cpp.

388{ fOverdrawViz = overdrawViz; }

◆ toggleCommand()

void DebugCanvas::toggleCommand ( int  index,
bool  toggle 
)

Toggles the visibility / execution of the draw command at index i with the value of toggle.

Definition at line 648 of file DebugCanvas.cpp.

648 {
649 SkASSERT(index < fCommandVector.size());
650 fCommandVector[index]->setVisible(toggle);
651}

◆ toJSON()

void DebugCanvas::toJSON ( SkJSONWriter writer,
UrlDataManager urlDataManager,
SkCanvas canvas 
)

Returns a JSON object representing all commands in the picture. The encoder may use the UrlDataManager to store binary data such as images, referring to them via URLs embedded in the JSON.

Definition at line 340 of file DebugCanvas.cpp.

342 {
343#if defined(SK_GANESH)
344 this->drawAndCollectOps(canvas);
345
346 // now collect json
347 GrAuditTrail* at = this->getAuditTrail(canvas);
348#endif
351
352 for (int i = 0; i < this->getSize(); i++) {
353 writer.beginObject(); // command
354 this->getDrawCommandAt(i)->toJSON(writer, urlDataManager);
355
356#if defined(SK_GANESH)
357 if (at && at->isEnabled()) {
359 at->toJson(writer, i);
360 }
361#endif
362 writer.endObject(); // command
363 }
364
365 writer.endArray(); // commands
366#if defined(SK_GANESH)
367 this->cleanupAuditTrail(at);
368#endif
369}
#define SKDEBUGCANVAS_ATTRIBUTE_COMMANDS
Definition: DebugCanvas.cpp:58
#define SKDEBUGCANVAS_ATTRIBUTE_AUDITTRAIL
Definition: DebugCanvas.cpp:59
#define SKDEBUGCANVAS_VERSION
Definition: DebugCanvas.cpp:56
#define SKDEBUGCANVAS_ATTRIBUTE_VERSION
Definition: DebugCanvas.cpp:57
virtual void toJSON(SkJSONWriter &writer, UrlDataManager &urlDataManager) const
bool isEnabled()
Definition: GrAuditTrail.h:98
void toJson(SkJSONWriter &writer) const
void appendS32(int32_t value)
Definition: SkJSONWriter.h:237
void beginArray(const char *name=nullptr, bool multiline=true)
Definition: SkJSONWriter.h:146
void beginObject(const char *name=nullptr, bool multiline=true)
Definition: SkJSONWriter.h:114
void endObject()
Definition: SkJSONWriter.h:126
void appendName(const char *name)
Definition: SkJSONWriter.h:90
void endArray()
Definition: SkJSONWriter.h:158

◆ toJSONOpsTask()

void DebugCanvas::toJSONOpsTask ( SkJSONWriter writer,
SkCanvas canvas 
)

Definition at line 371 of file DebugCanvas.cpp.

371 {
372#if defined(SK_GANESH)
373 this->drawAndCollectOps(canvas);
374
375 GrAuditTrail* at = this->getAuditTrail(canvas);
376 if (at) {
378 at->toJson(writer);
379 this->cleanupAuditTrail(at);
380 return;
381 }
382#endif
383
384 writer.beginObject();
385 writer.endObject();
386}

◆ willRestore()

void DebugCanvas::willRestore ( )
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 621 of file DebugCanvas.cpp.

621 {
622 this->addDrawCommand(new RestoreCommand());
624}
virtual void willRestore()
Definition: SkCanvas.h:2276

◆ willSave()

void DebugCanvas::willSave ( )
overrideprotectedvirtual

Reimplemented from SkCanvas.

Definition at line 626 of file DebugCanvas.cpp.

626 {
627 this->addDrawCommand(new SaveCommand());
628 this->INHERITED::willSave();
629}
virtual void willSave()
Definition: SkCanvas.h:2268

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