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

#include <SkPictureImageGenerator.h>

Inheritance diagram for SkPictureImageGenerator:
SkImageGenerator

Public Member Functions

 SkPictureImageGenerator (const SkImageInfo &, sk_sp< SkPicture >, const SkMatrix *, const SkPaint *, const SkSurfaceProps &)
 
- Public Member Functions inherited from SkImageGenerator
virtual ~SkImageGenerator ()
 
uint32_t uniqueID () const
 
sk_sp< SkDatarefEncodedData ()
 
const SkImageInfogetInfo () const
 
bool isValid (GrRecordingContext *context) const
 
bool isProtected () const
 
bool getPixels (const SkImageInfo &info, void *pixels, size_t rowBytes)
 
bool getPixels (const SkPixmap &pm)
 
bool queryYUVAInfo (const SkYUVAPixmapInfo::SupportedDataTypes &supportedDataTypes, SkYUVAPixmapInfo *yuvaPixmapInfo) const
 
bool getYUVAPlanes (const SkYUVAPixmaps &yuvaPixmaps)
 
virtual bool isTextureGenerator () const
 

Protected Member Functions

bool onGetPixels (const SkImageInfo &, void *pixels, size_t rowBytes, const Options &) override
 
- Protected Member Functions inherited from SkImageGenerator
 SkImageGenerator (const SkImageInfo &info, uint32_t uniqueId=kNeedNewImageUniqueID)
 
virtual sk_sp< SkDataonRefEncodedData ()
 
virtual bool onGetPixels (const SkImageInfo &, void *, size_t, const Options &)
 
virtual bool onIsValid (GrRecordingContext *) const
 
virtual bool onIsProtected () const
 
virtual bool onQueryYUVAInfo (const SkYUVAPixmapInfo::SupportedDataTypes &, SkYUVAPixmapInfo *) const
 
virtual bool onGetYUVAPlanes (const SkYUVAPixmaps &)
 

Friends

class SkImage_Picture
 

Additional Inherited Members

- Protected Attributes inherited from SkImageGenerator
const SkImageInfo fInfo
 
- Static Protected Attributes inherited from SkImageGenerator
static constexpr int kNeedNewImageUniqueID = 0
 

Detailed Description

Definition at line 23 of file SkPictureImageGenerator.h.

Constructor & Destructor Documentation

◆ SkPictureImageGenerator()

SkPictureImageGenerator::SkPictureImageGenerator ( const SkImageInfo info,
sk_sp< SkPicture picture,
const SkMatrix matrix,
const SkPaint paint,
const SkSurfaceProps props 
)

Definition at line 63 of file SkPictureImageGenerator.cpp.

67 , fPicture(std::move(picture))
68 , fProps(props) {
69
70 if (matrix) {
71 fMatrix = *matrix;
72 } else {
73 fMatrix.reset();
74 }
75
76 if (paint) {
77 fPaint.set(*paint);
78 }
79}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
SkImageGenerator(const SkImageInfo &info, uint32_t uniqueId=kNeedNewImageUniqueID)
SkMatrix & reset()
Definition: SkMatrix.cpp:49
T * set(const T &src)
Definition: SkTLazy.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

◆ onGetPixels()

bool SkPictureImageGenerator::onGetPixels ( const SkImageInfo info,
void *  pixels,
size_t  rowBytes,
const Options opts 
)
overrideprotectedvirtual

Reimplemented from SkImageGenerator.

Definition at line 81 of file SkPictureImageGenerator.cpp.

82 {
83 std::unique_ptr<SkCanvas> canvas = SkCanvas::MakeRasterDirect(info, pixels, rowBytes, &fProps);
84 if (!canvas) {
85 return false;
86 }
87 canvas->clear(0);
88 canvas->drawPicture(fPicture, &fMatrix, fPaint.getMaybeNull());
89 return true;
90}
static std::unique_ptr< SkCanvas > MakeRasterDirect(const SkImageInfo &info, void *pixels, size_t rowBytes, const SkSurfaceProps *props=nullptr)
Definition: SkCanvas.cpp:2801
const T * getMaybeNull() const
Definition: SkTLazy.h:108

Friends And Related Function Documentation

◆ SkImage_Picture

friend class SkImage_Picture
friend

Definition at line 37 of file SkPictureImageGenerator.h.


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