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

#include <DrawCommand.h>

Inheritance diagram for BeginDrawPictureCommand:
DrawCommand

Public Member Functions

 BeginDrawPictureCommand (const SkPicture *picture, const SkMatrix *matrix, const SkPaint *paint)
 
void execute (SkCanvas *canvas) const override
 
bool render (SkCanvas *canvas) const override
 
- Public Member Functions inherited from DrawCommand
 DrawCommand (OpType opType)
 
virtual ~DrawCommand ()
 
bool isVisible () const
 
void setVisible (bool toggle)
 
virtual void execute (SkCanvas *) const =0
 
virtual bool render (SkCanvas *canvas) const
 
virtual void toJSON (SkJSONWriter &writer, UrlDataManager &urlDataManager) const
 
OpType getOpType () const
 

Additional Inherited Members

- Public Types inherited from DrawCommand
enum  OpType {
  kBeginDrawPicture_OpType , kClear_OpType , kClipPath_OpType , kClipRegion_OpType ,
  kClipRect_OpType , kClipRRect_OpType , kClipShader_OpType , kResetClip_OpType ,
  kConcat_OpType , kConcat44_OpType , kDrawAnnotation_OpType , kDrawBitmap_OpType ,
  kDrawBitmapRect_OpType , kDrawDRRect_OpType , kDrawImage_OpType , kDrawImageLattice_OpType ,
  kDrawImageRect_OpType , kDrawImageRectLayer_OpType , kDrawOval_OpType , kDrawArc_OpType ,
  kDrawPaint_OpType , kDrawPatch_OpType , kDrawPath_OpType , kDrawPoints_OpType ,
  kDrawRect_OpType , kDrawRRect_OpType , kDrawRegion_OpType , kDrawShadow_OpType ,
  kDrawTextBlob_OpType , kDrawVertices_OpType , kDrawAtlas_OpType , kDrawDrawable_OpType ,
  kDrawEdgeAAQuad_OpType , kDrawEdgeAAImageSet_OpType , kEndDrawPicture_OpType , kRestore_OpType ,
  kSave_OpType , kSaveLayer_OpType , kSetMatrix_OpType , kSetM44_OpType ,
  kLast_OpType = kSetM44_OpType
}
 
- Static Public Member Functions inherited from DrawCommand
static void WritePNG (const SkBitmap &bitmap, SkWStream &out)
 
static const char * GetCommandString (OpType type)
 
static void MakeJsonColor (SkJSONWriter &, const SkColor color)
 
static void MakeJsonColor4f (SkJSONWriter &, const SkColor4f &color)
 
static void MakeJsonPoint (SkJSONWriter &, const SkPoint &point)
 
static void MakeJsonPoint (SkJSONWriter &, SkScalar x, SkScalar y)
 
static void MakeJsonPoint3 (SkJSONWriter &, const SkPoint3 &point)
 
static void MakeJsonRect (SkJSONWriter &, const SkRect &rect)
 
static void MakeJsonIRect (SkJSONWriter &, const SkIRect &)
 
static void MakeJsonMatrix (SkJSONWriter &, const SkMatrix &)
 
static void MakeJsonMatrix44 (SkJSONWriter &, const SkM44 &)
 
static void MakeJsonPath (SkJSONWriter &, const SkPath &path)
 
static void MakeJsonRegion (SkJSONWriter &, const SkRegion &region)
 
static void MakeJsonSampling (SkJSONWriter &, const SkSamplingOptions &sampling)
 
static void MakeJsonPaint (SkJSONWriter &, const SkPaint &paint, UrlDataManager &urlDataManager)
 
static void MakeJsonLattice (SkJSONWriter &, const SkCanvas::Lattice &lattice)
 
static void flatten (const SkFlattenable *flattenable, SkJSONWriter &writer, UrlDataManager &urlDataManager)
 
static bool flatten (const SkImage &image, SkJSONWriter &writer, UrlDataManager &urlDataManager)
 
static bool flatten (const SkBitmap &bitmap, SkJSONWriter &writer, UrlDataManager &urlDataManager)
 
- Static Public Attributes inherited from DrawCommand
static const int kOpTypeCount = kLast_OpType + 1
 

Detailed Description

Definition at line 459 of file DrawCommand.h.

Constructor & Destructor Documentation

◆ BeginDrawPictureCommand()

BeginDrawPictureCommand::BeginDrawPictureCommand ( const SkPicture picture,
const SkMatrix matrix,
const SkPaint paint 
)

Definition at line 1572 of file DrawCommand.cpp.

1575 : INHERITED(kBeginDrawPicture_OpType)
1576 , fPicture(SkRef(picture))
1577 , fMatrix(matrix)
1578 , fPaint(paint) {}
static T * SkRef(T *obj)
Definition: SkRefCnt.h:132
@ kBeginDrawPicture_OpType
Definition: DrawCommand.h:56
const Paint & paint
Definition: color_source.cc:38
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
sk_sp< const SkPicture > picture
Definition: SkRecords.h:299

Member Function Documentation

◆ execute()

void BeginDrawPictureCommand::execute ( SkCanvas canvas) const
overridevirtual

Implements DrawCommand.

Definition at line 1580 of file DrawCommand.cpp.

1580 {
1581 if (fPaint.isValid()) {
1582 SkRect bounds = fPicture->cullRect();
1583 if (fMatrix.isValid()) {
1584 fMatrix->mapRect(&bounds);
1585 }
1586 canvas->saveLayer(&bounds, fPaint.get());
1587 }
1588
1589 if (fMatrix.isValid()) {
1590 if (!fPaint.isValid()) {
1591 canvas->save();
1592 }
1593 canvas->concat(*fMatrix);
1594 }
1595}
int saveLayer(const SkRect *bounds, const SkPaint *paint)
Definition: SkCanvas.cpp:496
int save()
Definition: SkCanvas.cpp:447
void concat(const SkMatrix &matrix)
Definition: SkCanvas.cpp:1318
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
Definition: SkMatrix.cpp:1141
virtual SkRect cullRect() const =0
T * get()
Definition: SkTLazy.h:83
bool isValid() const
Definition: SkTLazy.h:77
Optional< SkRect > bounds
Definition: SkRecords.h:189

◆ render()

bool BeginDrawPictureCommand::render ( SkCanvas canvas) const
overridevirtual

Reimplemented from DrawCommand.

Definition at line 1597 of file DrawCommand.cpp.

1597 {
1598 canvas->clear(0xFFFFFFFF);
1599 canvas->save();
1600
1601 xlate_and_scale_to_bounds(canvas, fPicture->cullRect());
1602
1603 canvas->drawPicture(fPicture.get());
1604
1605 canvas->restore();
1606
1607 return true;
1608}
void restore()
Definition: SkCanvas.cpp:461
void clear(SkColor color)
Definition: SkCanvas.h:1199
void drawPicture(const SkPicture *picture)
Definition: SkCanvas.h:1961
T * get() const
Definition: SkRefCnt.h:303

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