Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
TextureGenerator Class Reference
Inheritance diagram for TextureGenerator:
GrTextureGenerator SkImageGenerator

Public Member Functions

 TextureGenerator (SkCanvas *canvas, const SkImageInfo &info, sk_sp< SkPicture > pic)
 
- Public Member Functions inherited from GrTextureGenerator
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

GrSurfaceProxyView onGenerateTexture (GrRecordingContext *rContext, const SkImageInfo &info, skgpu::Mipmapped mipmapped, GrImageTexGenPolicy policy) override
 
- Protected Member Functions inherited from GrTextureGenerator
 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 172 of file image_pict.cpp.

Constructor & Destructor Documentation

◆ TextureGenerator()

TextureGenerator::TextureGenerator ( SkCanvas canvas,
const SkImageInfo info,
sk_sp< SkPicture pic 
)
inline

Definition at line 174 of file image_pict.cpp.

176
177 fRContext = sk_ref_sp(canvas->recordingContext());
178
180
181 if (fRContext) {
184 info,
185 0,
187 nullptr);
188 }
189#if defined(SK_GRAPHITE)
190 if (skgpu::graphite::Recorder* recorder = canvas->recorder()) {
192 }
193#endif
194
195 if (surface) {
196 surface->getCanvas()->clear(0);
197 surface->getCanvas()->translate(-100, -100);
198 surface->getCanvas()->drawPicture(pic);
199 fImage = surface->makeImageSnapshot();
200 }
201 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
@ kTopLeft_GrSurfaceOrigin
Definition: GrTypes.h:148
sk_sp< T > sk_ref_sp(T *obj)
Definition: SkRefCnt.h:381
GrTextureGenerator(const SkImageInfo &info, uint32_t uniqueId=kNeedNewImageUniqueID)
virtual GrRecordingContext * recordingContext() const
Definition: SkCanvas.cpp:1637
virtual skgpu::graphite::Recorder * recorder() const
Definition: SkCanvas.cpp:1641
T * get() const
Definition: SkRefCnt.h:303
VkSurfaceKHR surface
Definition: main.cc:49
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)

Member Function Documentation

◆ onGenerateTexture()

GrSurfaceProxyView TextureGenerator::onGenerateTexture ( GrRecordingContext rContext,
const SkImageInfo info,
skgpu::Mipmapped  mipmapped,
GrImageTexGenPolicy  policy 
)
inlineoverrideprotectedvirtual

Implements GrTextureGenerator.

Definition at line 203 of file image_pict.cpp.

206 {
207 SkASSERT(rContext);
208 SkASSERT(rContext->priv().matches(fRContext.get()));
209
210 auto [view, _] = skgpu::ganesh::AsView(rContext, fImage, skgpu::Mipmapped::kNo);
211 if (!view) {
212 return {};
213 }
214
215 SkASSERT_RELEASE(info.dimensions() == view.proxy()->dimensions());
216
218 return view;
219 }
224 fRContext.get(),
225 view,
226 mipmapped,
227 SkIRect::MakeWH(info.width(), info.height()),
229 budgeted,
230 /*label=*/"SurfaceProxyView_GenerateTexture");
231 }
#define SkASSERT_RELEASE(cond)
Definition: SkAssert.h:100
#define SkASSERT(cond)
Definition: SkAssert.h:116
bool matches(GrContext_Base *candidate) const
GrRecordingContextPriv priv()
static GrSurfaceProxyView Copy(GrRecordingContext *context, GrSurfaceProxyView src, skgpu::Mipmapped mipmapped, SkIRect srcRect, SkBackingFit fit, skgpu::Budgeted budgeted, std::string_view label)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network policy
Definition: switches.h:248
std::tuple< GrSurfaceProxyView, GrColorType > AsView(GrRecordingContext *rContext, const SkImage *img, skgpu::Mipmapped mipmapped, GrImageTexGenPolicy policy)
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
Definition: SkRect.h:56

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