Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
GrTextureGenerator Class Referenceabstract

#include <GrTextureGenerator.h>

Inheritance diagram for GrTextureGenerator:
SkImageGenerator GrAHardwareBufferImageGenerator GrBackendTextureImageGenerator GrExternalTextureGenerator TextureGenerator TextureSourceImageGenerator

Public Member Functions

bool isTextureGenerator () const final
 
GrSurfaceProxyView generateTexture (GrRecordingContext *, const SkImageInfo &info, skgpu::Mipmapped mipmapped, GrImageTexGenPolicy)
 
virtual GrSurfaceProxyView onGenerateTexture (GrRecordingContext *, const SkImageInfo &, skgpu::Mipmapped, GrImageTexGenPolicy)=0
 
virtual GrSurfaceOrigin origin () const
 
- 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

 GrTextureGenerator (const SkImageInfo &info, uint32_t uniqueId=kNeedNewImageUniqueID)
 
- 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 &)
 

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 GrTextureGenerator.h.

Constructor & Destructor Documentation

◆ GrTextureGenerator()

GrTextureGenerator::GrTextureGenerator ( const SkImageInfo info,
uint32_t  uniqueId = kNeedNewImageUniqueID 
)
protected

Definition at line 42 of file GrTextureGenerator.cpp.

static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
SkImageGenerator(const SkImageInfo &info, uint32_t uniqueId=kNeedNewImageUniqueID)
uint32_t uniqueID() const

Member Function Documentation

◆ generateTexture()

GrSurfaceProxyView GrTextureGenerator::generateTexture ( GrRecordingContext ctx,
const SkImageInfo info,
skgpu::Mipmapped  mipmapped,
GrImageTexGenPolicy  texGenPolicy 
)

If the generator can natively/efficiently return its pixels as a GPU image (backed by a texture) this will return that image. If not, this will return NULL.

Regarding the GrRecordingContext parameter:

It must be non-NULL. The generator should only succeed if:

  • its internal context is the same
  • it can somehow convert its texture into one that is valid for the provided context.

If the mipmapped parameter is kYes, the generator should try to create a TextureProxy that at least has the mip levels allocated and the base layer filled in. If this is not possible, the generator is allowed to return a non mipped proxy, but this will have some additional overhead in later allocating mips and copying of the base layer.

GrImageTexGenPolicy determines whether or not a new texture must be created (and its budget status) or whether this may (but is not required to) return a pre-existing texture that is retained by the generator (kDraw).

Definition at line 45 of file GrTextureGenerator.cpp.

48 {
49 SkASSERT_RELEASE(fInfo.dimensions() == info.dimensions());
50
51 if (!ctx || ctx->abandoned()) {
52 return {};
53 }
54
55 return this->onGenerateTexture(ctx, info, mipmapped, texGenPolicy);
56}
#define SkASSERT_RELEASE(cond)
Definition: SkAssert.h:100
bool abandoned() override
virtual GrSurfaceProxyView onGenerateTexture(GrRecordingContext *, const SkImageInfo &, skgpu::Mipmapped, GrImageTexGenPolicy)=0
const SkImageInfo fInfo
SkISize dimensions() const
Definition: SkImageInfo.h:421

◆ isTextureGenerator()

bool GrTextureGenerator::isTextureGenerator ( ) const
inlinefinalvirtual

Reimplemented from SkImageGenerator.

Definition at line 25 of file GrTextureGenerator.h.

25{ return true; }

◆ onGenerateTexture()

virtual GrSurfaceProxyView GrTextureGenerator::onGenerateTexture ( GrRecordingContext ,
const SkImageInfo ,
skgpu::Mipmapped  ,
GrImageTexGenPolicy   
)
pure virtual

◆ origin()

virtual GrSurfaceOrigin GrTextureGenerator::origin ( ) const
inlinevirtual

Definition at line 60 of file GrTextureGenerator.h.

@ kTopLeft_GrSurfaceOrigin
Definition: GrTypes.h:148

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