Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkImage_LazyTexture Class Referencefinal

#include <SkImage_LazyTexture.h>

Inheritance diagram for SkImage_LazyTexture:
SkImage_Lazy SkImage_Base SkImage SkRefCnt SkRefCntBase

Public Member Functions

 SkImage_LazyTexture (SkImage_Lazy::Validator *validator)
 
bool readPixelsProxy (GrDirectContext *, const SkPixmap &) const override
 
sk_sp< SkImageonMakeSubset (GrDirectContext *, const SkIRect &) const override
 
- Public Member Functions inherited from SkImage_Lazy
 SkImage_Lazy (Validator *validator)
 
bool isValid (GrRecordingContext *) const override
 
bool onHasMipmaps () const override
 
bool onIsProtected () const override
 
bool onReadPixels (GrDirectContext *, const SkImageInfo &, void *, size_t, int srcX, int srcY, CachingHint) const override
 
sk_sp< SkDataonRefEncoded () const override
 
sk_sp< SkImageonMakeSubset (GrDirectContext *, const SkIRect &) const override
 
sk_sp< SkImageonMakeSubset (skgpu::graphite::Recorder *, const SkIRect &, RequiredProperties) const override
 
bool getROPixels (GrDirectContext *, SkBitmap *, CachingHint) const override
 
SkImage_Base::Type type () const override
 
sk_sp< SkImageonMakeColorTypeAndColorSpace (SkColorType, sk_sp< SkColorSpace >, GrDirectContext *) const override
 
sk_sp< SkImageonReinterpretColorSpace (sk_sp< SkColorSpace >) const final
 
void addUniqueIDListener (sk_sp< SkIDChangeListener >) const
 
sk_sp< SkCachedDatagetPlanes (const SkYUVAPixmapInfo::SupportedDataTypes &supportedDataTypes, SkYUVAPixmaps *pixmaps) const
 
sk_sp< SharedGeneratorgenerator () const
 
- Public Member Functions inherited from SkImage_Base
 ~SkImage_Base () override
 
sk_sp< SkImagemakeColorSpace (GrDirectContext *, sk_sp< SkColorSpace >) const override
 
sk_sp< SkImagemakeColorSpace (skgpu::graphite::Recorder *, sk_sp< SkColorSpace >, RequiredProperties) const override
 
sk_sp< SkImagemakeColorTypeAndColorSpace (GrDirectContext *dContext, SkColorType targetColorType, sk_sp< SkColorSpace > targetCS) const override
 
sk_sp< SkImagemakeColorTypeAndColorSpace (skgpu::graphite::Recorder *, SkColorType, sk_sp< SkColorSpace >, RequiredProperties) const override
 
sk_sp< SkImagemakeSubset (GrDirectContext *direct, const SkIRect &subset) const override
 
sk_sp< SkImagemakeSubset (skgpu::graphite::Recorder *, const SkIRect &, RequiredProperties) const override
 
size_t textureSize () const override
 
virtual bool onPeekPixels (SkPixmap *) const
 
virtual const SkBitmaponPeekBitmap () const
 
virtual bool onReadPixels (GrDirectContext *, const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint) const =0
 
virtual bool onHasMipmaps () const =0
 
virtual bool onIsProtected () const =0
 
virtual SkMipmaponPeekMips () const
 
sk_sp< SkMipmaprefMips () const
 
virtual void onAsyncRescaleAndReadPixels (const SkImageInfo &, SkIRect srcRect, RescaleGamma, RescaleMode, ReadPixelsCallback, ReadPixelsContext) const
 
virtual void onAsyncRescaleAndReadPixelsYUV420 (SkYUVColorSpace, bool readAlpha, sk_sp< SkColorSpace > dstColorSpace, SkIRect srcRect, SkISize dstSize, RescaleGamma, RescaleMode, ReadPixelsCallback, ReadPixelsContext) const
 
virtual GrImageContextcontext () const
 
virtual GrDirectContextdirectContext () const
 
virtual void generatingSurfaceIsDeleted ()
 
virtual bool getROPixels (GrDirectContext *, SkBitmap *, CachingHint=kAllow_CachingHint) const =0
 
virtual sk_sp< SkImageonMakeSubset (GrDirectContext *, const SkIRect &) const =0
 
virtual sk_sp< SkDataonRefEncoded () const
 
virtual bool onAsLegacyBitmap (GrDirectContext *, SkBitmap *) const
 
virtual Type type () const =0
 
bool isLazyGenerated () const override
 
bool isRasterBacked () const
 
bool isGaneshBacked () const
 
bool isGraphiteBacked () const
 
bool isYUVA () const
 
bool isTextureBacked () const override
 
virtual void notifyAddedToRasterCache () const
 
virtual sk_sp< SkImageonMakeColorTypeAndColorSpace (SkColorType, sk_sp< SkColorSpace >, GrDirectContext *) const =0
 
virtual sk_sp< SkImageonReinterpretColorSpace (sk_sp< SkColorSpace >) const =0
 
virtual sk_sp< SkImageonMakeWithMipmaps (sk_sp< SkMipmap >) const
 
virtual sk_sp< SkImageonMakeSubset (skgpu::graphite::Recorder *, const SkIRect &, RequiredProperties) const =0
 
- Public Member Functions inherited from SkImage
const SkImageInfoimageInfo () const
 
int width () const
 
int height () const
 
SkISize dimensions () const
 
SkIRect bounds () const
 
uint32_t uniqueID () const
 
SkAlphaType alphaType () const
 
SkColorType colorType () const
 
SkColorSpacecolorSpace () const
 
sk_sp< SkColorSpacerefColorSpace () const
 
bool isAlphaOnly () const
 
bool isOpaque () const
 
sk_sp< SkShadermakeShader (SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
 
sk_sp< SkShadermakeShader (SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &sampling, const SkMatrix &lm) const
 
sk_sp< SkShadermakeShader (const SkSamplingOptions &sampling, const SkMatrix &lm) const
 
sk_sp< SkShadermakeShader (const SkSamplingOptions &sampling, const SkMatrix *lm=nullptr) const
 
sk_sp< SkShadermakeRawShader (SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
 
sk_sp< SkShadermakeRawShader (SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &sampling, const SkMatrix &lm) const
 
sk_sp< SkShadermakeRawShader (const SkSamplingOptions &sampling, const SkMatrix &lm) const
 
sk_sp< SkShadermakeRawShader (const SkSamplingOptions &sampling, const SkMatrix *lm=nullptr) const
 
bool peekPixels (SkPixmap *pixmap) const
 
virtual bool isTextureBacked () const =0
 
virtual size_t textureSize () const =0
 
virtual bool isValid (GrRecordingContext *context) const =0
 
bool readPixels (GrDirectContext *context, const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint cachingHint=kAllow_CachingHint) const
 
bool readPixels (GrDirectContext *context, const SkPixmap &dst, int srcX, int srcY, CachingHint cachingHint=kAllow_CachingHint) const
 
bool readPixels (const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint cachingHint=kAllow_CachingHint) const
 
bool readPixels (const SkPixmap &dst, int srcX, int srcY, CachingHint cachingHint=kAllow_CachingHint) const
 
void asyncRescaleAndReadPixels (const SkImageInfo &info, const SkIRect &srcRect, RescaleGamma rescaleGamma, RescaleMode rescaleMode, ReadPixelsCallback callback, ReadPixelsContext context) const
 
void asyncRescaleAndReadPixelsYUV420 (SkYUVColorSpace yuvColorSpace, sk_sp< SkColorSpace > dstColorSpace, const SkIRect &srcRect, const SkISize &dstSize, RescaleGamma rescaleGamma, RescaleMode rescaleMode, ReadPixelsCallback callback, ReadPixelsContext context) const
 
void asyncRescaleAndReadPixelsYUVA420 (SkYUVColorSpace yuvColorSpace, sk_sp< SkColorSpace > dstColorSpace, const SkIRect &srcRect, const SkISize &dstSize, RescaleGamma rescaleGamma, RescaleMode rescaleMode, ReadPixelsCallback callback, ReadPixelsContext context) const
 
bool scalePixels (const SkPixmap &dst, const SkSamplingOptions &, CachingHint cachingHint=kAllow_CachingHint) const
 
sk_sp< SkDatarefEncodedData () const
 
virtual sk_sp< SkImagemakeSubset (GrDirectContext *direct, const SkIRect &subset) const =0
 
virtual sk_sp< SkImagemakeSubset (skgpu::graphite::Recorder *, const SkIRect &subset, RequiredProperties) const =0
 
bool hasMipmaps () const
 
bool isProtected () const
 
sk_sp< SkImagewithDefaultMipmaps () const
 
sk_sp< SkImagemakeNonTextureImage (GrDirectContext *=nullptr) const
 
sk_sp< SkImagemakeRasterImage (GrDirectContext *, CachingHint cachingHint=kDisallow_CachingHint) const
 
sk_sp< SkImagemakeRasterImage (CachingHint cachingHint=kDisallow_CachingHint) const
 
bool asLegacyBitmap (SkBitmap *bitmap, LegacyBitmapMode legacyBitmapMode=kRO_LegacyBitmapMode) const
 
virtual bool isLazyGenerated () const =0
 
virtual sk_sp< SkImagemakeColorSpace (GrDirectContext *direct, sk_sp< SkColorSpace > target) const =0
 
virtual sk_sp< SkImagemakeColorSpace (skgpu::graphite::Recorder *, sk_sp< SkColorSpace > targetColorSpace, RequiredProperties) const =0
 
virtual sk_sp< SkImagemakeColorTypeAndColorSpace (GrDirectContext *direct, SkColorType targetColorType, sk_sp< SkColorSpace > targetCS) const =0
 
virtual sk_sp< SkImagemakeColorTypeAndColorSpace (skgpu::graphite::Recorder *, SkColorType targetColorType, sk_sp< SkColorSpace > targetColorSpace, RequiredProperties) const =0
 
sk_sp< SkImagereinterpretColorSpace (sk_sp< SkColorSpace > newColorSpace) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Additional Inherited Members

- Public Types inherited from SkImage_Base
enum class  Type {
  kRaster , kRasterPinnable , kLazy , kLazyPicture ,
  kGanesh , kGaneshYUVA , kGraphite , kGraphiteYUVA
}
 
- Public Types inherited from SkImage
enum  CachingHint { kAllow_CachingHint , kDisallow_CachingHint }
 
enum class  RescaleGamma : bool { kSrc , kLinear }
 
enum class  RescaleMode { kNearest , kLinear , kRepeatedLinear , kRepeatedCubic }
 
enum  LegacyBitmapMode { kRO_LegacyBitmapMode }
 
using ReadPixelsContext = void *
 
using ReadPixelsCallback = void(ReadPixelsContext, std::unique_ptr< const AsyncReadResult >)
 
virtual bool readPixelsProxy (GrDirectContext *, const SkPixmap &) const
 
- Protected Member Functions inherited from SkImage_Base
 SkImage_Base (const SkImageInfo &info, uint32_t uniqueID)
 

Detailed Description

Definition at line 19 of file SkImage_LazyTexture.h.

Constructor & Destructor Documentation

◆ SkImage_LazyTexture()

SkImage_LazyTexture::SkImage_LazyTexture ( SkImage_Lazy::Validator validator)
inline

Definition at line 21 of file SkImage_LazyTexture.h.

21: SkImage_Lazy(validator) {}
SkImage_Lazy(Validator *validator)

Member Function Documentation

◆ onMakeSubset()

sk_sp< SkImage > SkImage_LazyTexture::onMakeSubset ( GrDirectContext direct,
const SkIRect subset 
) const
overridevirtual

Implements SkImage_Base.

Definition at line 32 of file SkImage_LazyTexture.cpp.

33 {
34 auto pixels = direct ? SkImages::TextureFromImage(direct, this) :
35 this->makeRasterImage(nullptr);
36 return pixels ? pixels->makeSubset(direct, subset) : nullptr;
37}
sk_sp< SkImage > makeRasterImage(GrDirectContext *, CachingHint cachingHint=kDisallow_CachingHint) const
Definition: SkImage.cpp:267
virtual sk_sp< SkImage > makeSubset(GrDirectContext *direct, const SkIRect &subset) const =0
SK_API sk_sp< SkImage > TextureFromImage(GrDirectContext *, const SkImage *, skgpu::Mipmapped=skgpu::Mipmapped::kNo, skgpu::Budgeted=skgpu::Budgeted::kYes)

◆ readPixelsProxy()

bool SkImage_LazyTexture::readPixelsProxy ( GrDirectContext ctx,
const SkPixmap pixmap 
) const
overridevirtual

Reimplemented from SkImage_Lazy.

Definition at line 39 of file SkImage_LazyTexture.cpp.

39 {
40 if (!ctx) {
41 return false;
42 }
45
46 if (!view) {
47 return false;
48 }
49
51 this->colorType());
52 GrColorInfo colorInfo(ct, this->alphaType(), this->refColorSpace());
53 auto sContext = ctx->priv().makeSC(std::move(view), colorInfo);
54 if (!sContext) {
55 return false;
56 }
57 size_t rowBytes = this->imageInfo().minRowBytes();
58 return sContext->readPixels(ctx, {this->imageInfo(), pixmap.writable_addr(), rowBytes}, {0, 0});
59}
GrColorType
Definition: GrTypesPriv.h:540
const GrCaps * caps() const
GrDirectContextPriv priv()
std::unique_ptr< skgpu::ganesh::SurfaceContext > makeSC(GrSurfaceProxyView readView, const GrColorInfo &)
const SkImageInfo & imageInfo() const
Definition: SkImage.h:279
SkAlphaType alphaType() const
Definition: SkImage.cpp:154
sk_sp< SkColorSpace > refColorSpace() const
Definition: SkImage.cpp:158
void * writable_addr() const
Definition: SkPixmap.h:483
GrColorType ColorTypeOfLockTextureProxy(const GrCaps *caps, SkColorType sct)
GrSurfaceProxyView LockTextureProxyView(GrRecordingContext *rContext, const SkImage_Lazy *img, GrImageTexGenPolicy texGenPolicy, skgpu::Mipmapped mipmapped)
size_t minRowBytes() const
Definition: SkImageInfo.h:517

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