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

#include <DrawCommand.h>

Inheritance diagram for DrawImageRectLayerCommand:
DrawCommand

Public Member Functions

 DrawImageRectLayerCommand (DebugLayerManager *layerManager, const int nodeId, const int frame, const SkRect &src, const SkRect &dst, const SkSamplingOptions &sampling, const SkPaint *paint, SkCanvas::SrcRectConstraint constraint)
 
void execute (SkCanvas *canvas) const override
 
bool render (SkCanvas *canvas) const override
 
void toJSON (SkJSONWriter &writer, UrlDataManager &urlDataManager) 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 357 of file DrawCommand.h.

Constructor & Destructor Documentation

◆ DrawImageRectLayerCommand()

DrawImageRectLayerCommand::DrawImageRectLayerCommand ( DebugLayerManager layerManager,
const int  nodeId,
const int  frame,
const SkRect src,
const SkRect dst,
const SkSamplingOptions sampling,
const SkPaint paint,
SkCanvas::SrcRectConstraint  constraint 
)

Definition at line 1355 of file DrawCommand.cpp.

1363 : INHERITED(kDrawImageRectLayer_OpType)
1364 , fLayerManager(layerManager)
1365 , fNodeId(nodeId)
1366 , fFrame(frame)
1367 , fSrc(src)
1368 , fDst(dst)
1369 , fSampling(sampling)
1370 , fPaint(paint)
1371 , fConstraint(constraint) {}
@ kDrawImageRectLayer_OpType
Definition: DrawCommand.h:73
const Paint & paint
Definition: color_source.cc:38
double frame
Definition: examples.cpp:31
SkSamplingOptions sampling
Definition: SkRecords.h:337
dst
Definition: cp.py:12

Member Function Documentation

◆ execute()

void DrawImageRectLayerCommand::execute ( SkCanvas canvas) const
overridevirtual

Implements DrawCommand.

Definition at line 1373 of file DrawCommand.cpp.

1373 {
1374 sk_sp<SkImage> snapshot = fLayerManager->getLayerAsImage(fNodeId, fFrame);
1375 canvas->drawImageRect(snapshot.get(), fSrc, fDst, SkSamplingOptions(), fPaint.getMaybeNull(), fConstraint);
1376}
sk_sp< SkImage > getLayerAsImage(const int nodeId, const int frame)
void drawImageRect(const SkImage *, const SkRect &src, const SkRect &dst, const SkSamplingOptions &, const SkPaint *, SrcRectConstraint)
Definition: SkCanvas.cpp:2333
const T * getMaybeNull() const
Definition: SkTLazy.h:108
T * get() const
Definition: SkRefCnt.h:303

◆ render()

bool DrawImageRectLayerCommand::render ( SkCanvas canvas) const
overridevirtual

Reimplemented from DrawCommand.

Definition at line 1378 of file DrawCommand.cpp.

1378 {
1379 SkAutoCanvasRestore acr(canvas, true);
1380 canvas->clear(0xFFFFFFFF);
1381
1382 xlate_and_scale_to_bounds(canvas, fDst);
1383
1384 this->execute(canvas);
1385 return true;
1386}
void execute(SkCanvas *canvas) const override
void clear(SkColor color)
Definition: SkCanvas.h:1199

◆ toJSON()

void DrawImageRectLayerCommand::toJSON ( SkJSONWriter writer,
UrlDataManager urlDataManager 
) const
overridevirtual

Reimplemented from DrawCommand.

Definition at line 1388 of file DrawCommand.cpp.

1388 {
1389 INHERITED::toJSON(writer, urlDataManager);
1390
1391 // Don't append an image attribute here, the image can be rendered in as many different ways
1392 // as there are commands in the layer, at least. the urlDataManager would save each one under
1393 // a different URL.
1394 // Append the node id, and the layer inspector of the debugger will know what to do with it.
1396
1398 MakeJsonRect(writer, fSrc);
1399
1401 MakeJsonRect(writer, fDst);
1403 MakeJsonSampling(writer, fSampling);
1404 if (fPaint.isValid()) {
1406 MakeJsonPaint(writer, *fPaint, urlDataManager);
1407 }
1408 if (fConstraint == SkCanvas::kStrict_SrcRectConstraint) {
1410 }
1411
1412 SkString desc;
1414}
#define DEBUGCANVAS_ATTRIBUTE_SRC
#define DEBUGCANVAS_ATTRIBUTE_SHORTDESC
#define DEBUGCANVAS_ATTRIBUTE_LAYERNODEID
#define DEBUGCANVAS_ATTRIBUTE_DST
#define DEBUGCANVAS_ATTRIBUTE_STRICT
#define DEBUGCANVAS_ATTRIBUTE_PAINT
Definition: DrawCommand.cpp:73
#define DEBUGCANVAS_ATTRIBUTE_SAMPLING
Definition: DrawCommand.cpp:84
static SkString * str_append(SkString *str, const SkRect &r)
static void MakeJsonPaint(SkJSONWriter &, const SkPaint &paint, UrlDataManager &urlDataManager)
virtual void toJSON(SkJSONWriter &writer, UrlDataManager &urlDataManager) const
static void MakeJsonRect(SkJSONWriter &, const SkRect &rect)
static void MakeJsonSampling(SkJSONWriter &, const SkSamplingOptions &sampling)
@ kStrict_SrcRectConstraint
sample only inside bounds; slower
Definition: SkCanvas.h:1542
void appendS64(int64_t value)
void appendBool(bool value)
Definition: SkJSONWriter.h:229
void appendName(const char *name)
Definition: SkJSONWriter.h:90
void appendString(const char *value, size_t size)
Definition: SkJSONWriter.h:176
bool isValid() const
Definition: SkTLazy.h:77

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