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

#include <DrawCommand.h>

Inheritance diagram for DrawPatchCommand:
DrawCommand

Public Member Functions

 DrawPatchCommand (const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], SkBlendMode bmode, const SkPaint &paint)
 
void execute (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 535 of file DrawCommand.h.

Constructor & Destructor Documentation

◆ DrawPatchCommand()

DrawPatchCommand::DrawPatchCommand ( const SkPoint  cubics[12],
const SkColor  colors[4],
const SkPoint  texCoords[4],
SkBlendMode  bmode,
const SkPaint paint 
)

Definition at line 1755 of file DrawCommand.cpp.

1760 : INHERITED(kDrawPatch_OpType), fBlendMode(bmode) {
1761 memcpy(fCubics, cubics, sizeof(fCubics));
1762 if (colors != nullptr) {
1763 memcpy(fColors, colors, sizeof(fColors));
1764 fColorsPtr = fColors;
1765 } else {
1766 fColorsPtr = nullptr;
1767 }
1768 if (texCoords != nullptr) {
1769 memcpy(fTexCoords, texCoords, sizeof(fTexCoords));
1770 fTexCoordsPtr = fTexCoords;
1771 } else {
1772 fTexCoordsPtr = nullptr;
1773 }
1774 fPaint = paint;
1775}
@ kDrawPatch_OpType
Definition: DrawCommand.h:77
const Paint & paint
Definition: color_source.cc:38
PODArray< SkColor > colors
Definition: SkRecords.h:276

Member Function Documentation

◆ execute()

void DrawPatchCommand::execute ( SkCanvas canvas) const
overridevirtual

Implements DrawCommand.

Definition at line 1777 of file DrawCommand.cpp.

1777 {
1778 canvas->drawPatch(fCubics, fColorsPtr, fTexCoordsPtr, fBlendMode, fPaint);
1779}
void drawPatch(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], SkBlendMode mode, const SkPaint &paint)
Definition: SkCanvas.cpp:2529

◆ toJSON()

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

Reimplemented from DrawCommand.

Definition at line 1781 of file DrawCommand.cpp.

1781 {
1782 INHERITED::toJSON(writer, urlDataManager);
1784 for (int i = 0; i < 12; i++) {
1785 MakeJsonPoint(writer, fCubics[i]);
1786 }
1787 writer.endArray(); // cubics
1788 if (fColorsPtr != nullptr) {
1790 for (int i = 0; i < 4; i++) {
1791 MakeJsonColor(writer, fColorsPtr[i]);
1792 }
1793 writer.endArray(); // colors
1794 }
1795 if (fTexCoordsPtr != nullptr) {
1797 for (int i = 0; i < 4; i++) {
1798 MakeJsonPoint(writer, fTexCoords[i]);
1799 }
1800 writer.endArray(); // texCoords
1801 }
1802 // fBlendMode
1803}
#define DEBUGCANVAS_ATTRIBUTE_CUBICS
#define DEBUGCANVAS_ATTRIBUTE_TEXTURECOORDS
#define DEBUGCANVAS_ATTRIBUTE_COLORS
static void MakeJsonPoint(SkJSONWriter &, const SkPoint &point)
static void MakeJsonColor(SkJSONWriter &, const SkColor color)
virtual void toJSON(SkJSONWriter &writer, UrlDataManager &urlDataManager) const
void beginArray(const char *name=nullptr, bool multiline=true)
Definition: SkJSONWriter.h:146
void endArray()
Definition: SkJSONWriter.h:158

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