Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
SkImage_Base Class Referenceabstract

#include <SkImage_Base.h>

Inheritance diagram for SkImage_Base:
SkImage SkRefCnt SkRefCntBase SkImage_GaneshBase SkImage_Lazy SkImage_Raster skgpu::graphite::Image_Base SkImage_Ganesh SkImage_GaneshYUVA SkImage_LazyTexture SkImage_Picture SkImage_RasterPinnable skgpu::graphite::Image skgpu::graphite::Image_YUVA

Public Types

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 >)
 

Public Member Functions

 ~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 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
 
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
 
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
 

Protected Member Functions

 SkImage_Base (const SkImageInfo &info, uint32_t uniqueID)
 

Detailed Description

Definition at line 38 of file SkImage_Base.h.

Member Enumeration Documentation

◆ Type

enum class SkImage_Base::Type
strong
Enumerator
kRaster 
kRasterPinnable 
kLazy 
kLazyPicture 
kGanesh 
kGaneshYUVA 
kGraphite 
kGraphiteYUVA 

Definition at line 132 of file SkImage_Base.h.

Constructor & Destructor Documentation

◆ ~SkImage_Base()

SkImage_Base::~SkImage_Base ( )
override

Definition at line 30 of file SkImage_Base.cpp.

30 {
31 if (fAddedToRasterCache.load()) {
33 }
34}
void SkNotifyBitmapGenIDIsStale(uint32_t bitmapGenID)
uint32_t uniqueID() const
Definition SkImage.h:311

◆ SkImage_Base()

SkImage_Base::SkImage_Base ( const SkImageInfo info,
uint32_t  uniqueID 
)
protected

Definition at line 27 of file SkImage_Base.cpp.

28 : SkImage(info, uniqueID), fAddedToRasterCache(false) {}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213

Member Function Documentation

◆ context()

virtual GrImageContext * SkImage_Base::context ( ) const
inlinevirtual

Reimplemented in SkImage_GaneshBase.

Definition at line 112 of file SkImage_Base.h.

112{ return nullptr; }

◆ directContext()

virtual GrDirectContext * SkImage_Base::directContext ( ) const
inlinevirtual

this->context() try-casted to GrDirectContext. Useful for migrations – avoid otherwise!

Reimplemented in SkImage_GaneshBase.

Definition at line 115 of file SkImage_Base.h.

115{ return nullptr; }

◆ generatingSurfaceIsDeleted()

virtual void SkImage_Base::generatingSurfaceIsDeleted ( )
inlinevirtual

Reimplemented in SkImage_Ganesh.

Definition at line 119 of file SkImage_Base.h.

119{}

◆ getROPixels()

virtual bool SkImage_Base::getROPixels ( GrDirectContext ,
SkBitmap ,
CachingHint  = kAllow_CachingHint 
) const
pure virtual

◆ isGaneshBacked()

bool SkImage_Base::isGaneshBacked ( ) const
inline

Definition at line 155 of file SkImage_Base.h.

155 {
156 return this->type() == Type::kGanesh || this->type() == Type::kGaneshYUVA;
157 }
virtual Type type() const =0

◆ isGraphiteBacked()

bool SkImage_Base::isGraphiteBacked ( ) const
inline

Definition at line 160 of file SkImage_Base.h.

160 {
161 return this->type() == Type::kGraphite || this->type() == Type::kGraphiteYUVA;
162 }

◆ isLazyGenerated()

bool SkImage_Base::isLazyGenerated ( ) const
inlineoverridevirtual

Returns true if SkImage is backed by an image-generator or other service that creates and caches its pixels or texture on-demand.

Returns
true if SkImage is created as needed

example: https://fiddle.skia.org/c/@Image_isLazyGenerated_a example: https://fiddle.skia.org/c/@Image_isLazyGenerated_b

Implements SkImage.

Definition at line 146 of file SkImage_Base.h.

146 {
147 return this->type() == Type::kLazy || this->type() == Type::kLazyPicture;
148 }

◆ isRasterBacked()

bool SkImage_Base::isRasterBacked ( ) const
inline

Definition at line 150 of file SkImage_Base.h.

150 {
151 return this->type() == Type::kRaster || this->type() == Type::kRasterPinnable;
152 }

◆ isTextureBacked()

bool SkImage_Base::isTextureBacked ( ) const
inlineoverridevirtual

Returns true if the contents of SkImage was created on or uploaded to GPU memory, and is available as a GPU texture.

Returns
true if SkImage is a GPU texture

example: https://fiddle.skia.org/c/@Image_isTextureBacked

Implements SkImage.

Definition at line 168 of file SkImage_Base.h.

168 {
169 return this->isGaneshBacked() || this->isGraphiteBacked();
170 }
bool isGaneshBacked() const
bool isGraphiteBacked() const

◆ isYUVA()

bool SkImage_Base::isYUVA ( ) const
inline

Definition at line 164 of file SkImage_Base.h.

164 {
165 return this->type() == Type::kGaneshYUVA || this->type() == Type::kGraphiteYUVA;
166 }

◆ makeColorSpace() [1/2]

sk_sp< SkImage > SkImage_Base::makeColorSpace ( GrDirectContext direct,
sk_sp< SkColorSpace target 
) const
overridevirtual

Creates SkImage in target SkColorSpace. Returns nullptr if SkImage could not be created.

Returns original SkImage if it is in target SkColorSpace. Otherwise, converts pixels from SkImage SkColorSpace to target SkColorSpace. If SkImage colorSpace() returns nullptr, SkImage SkColorSpace is assumed to be sRGB.

If this image is texture-backed, the context parameter is required and must match the context of the source image.

Parameters
directThe GrDirectContext in play, if it exists
targetSkColorSpace describing color range of returned SkImage
Returns
created SkImage in target SkColorSpace

example: https://fiddle.skia.org/c/@Image_makeColorSpace

Implements SkImage.

Definition at line 127 of file SkImage_Base.cpp.

128 {
129 return this->makeColorTypeAndColorSpace(direct, this->colorType(), std::move(target));
130}
sk_sp< SkImage > makeColorTypeAndColorSpace(GrDirectContext *dContext, SkColorType targetColorType, sk_sp< SkColorSpace > targetCS) const override
SkColorType colorType() const
Definition SkImage.cpp:152
uint32_t * target

◆ makeColorSpace() [2/2]

sk_sp< SkImage > SkImage_Base::makeColorSpace ( skgpu::graphite::Recorder ,
sk_sp< SkColorSpace targetColorSpace,
RequiredProperties   
) const
overridevirtual

Creates SkImage in target SkColorSpace. Returns nullptr if SkImage could not be created.

Returns original SkImage if it is in target SkColorSpace. Otherwise, converts pixels from SkImage SkColorSpace to target SkColorSpace. If SkImage colorSpace() returns nullptr, SkImage SkColorSpace is assumed to be sRGB.

If this image is graphite-backed, the recorder parameter is required.

Parameters
targetColorSpaceSkColorSpace describing color range of returned SkImage
recorderThe Recorder in which to create the new image
RequiredPropertiesproperties the returned SkImage must possess (e.g. mipmaps)
Returns
created SkImage in target SkColorSpace

Implements SkImage.

Definition at line 132 of file SkImage_Base.cpp.

134 {
135 return this->makeColorTypeAndColorSpace(recorder, this->colorType(), std::move(target), props);
136}

◆ makeColorTypeAndColorSpace() [1/2]

sk_sp< SkImage > SkImage_Base::makeColorTypeAndColorSpace ( GrDirectContext direct,
SkColorType  targetColorType,
sk_sp< SkColorSpace targetCS 
) const
overridevirtual

Experimental. Creates SkImage in target SkColorType and SkColorSpace. Returns nullptr if SkImage could not be created.

Returns original SkImage if it is in target SkColorType and SkColorSpace.

If this image is texture-backed, the context parameter is required and must match the context of the source image.

Parameters
directThe GrDirectContext in play, if it exists
targetColorTypeSkColorType of returned SkImage
targetColorSpaceSkColorSpace of returned SkImage
Returns
created SkImage in target SkColorType and SkColorSpace

Implements SkImage.

Reimplemented in SkImage_GaneshBase.

Definition at line 138 of file SkImage_Base.cpp.

140 {
141 if (kUnknown_SkColorType == targetColorType || !targetCS) {
142 return nullptr;
143 }
144
147 if (!colorSpace) {
149 }
150 if (colorType == targetColorType &&
151 (SkColorSpace::Equals(colorSpace, targetCS.get()) || this->isAlphaOnly())) {
152 return sk_ref_sp(const_cast<SkImage_Base*>(this));
153 }
154
155 return this->onMakeColorTypeAndColorSpace(targetColorType, std::move(targetCS), dContext);
156}
SkColorSpace * sk_srgb_singleton()
SkColorType
Definition SkColorType.h:19
@ kUnknown_SkColorType
uninitialized
Definition SkColorType.h:20
sk_sp< T > sk_ref_sp(T *obj)
Definition SkRefCnt.h:381
static bool Equals(const SkColorSpace *, const SkColorSpace *)
virtual sk_sp< SkImage > onMakeColorTypeAndColorSpace(SkColorType, sk_sp< SkColorSpace >, GrDirectContext *) const =0
SkColorSpace * colorSpace() const
Definition SkImage.cpp:156
T * get() const
Definition SkRefCnt.h:303

◆ makeColorTypeAndColorSpace() [2/2]

sk_sp< SkImage > SkImage_Base::makeColorTypeAndColorSpace ( skgpu::graphite::Recorder ,
SkColorType  targetColorType,
sk_sp< SkColorSpace targetColorSpace,
RequiredProperties   
) const
overridevirtual

Experimental. Creates SkImage in target SkColorType and SkColorSpace. Returns nullptr if SkImage could not be created.

Returns original SkImage if it is in target SkColorType and SkColorSpace.

If this image is graphite-backed, the recorder parameter is required.

Parameters
targetColorTypeSkColorType of returned SkImage
targetColorSpaceSkColorSpace of returned SkImage
recorderThe Recorder in which to create the new image
RequiredPropertiesproperties the returned SkImage must possess (e.g. mipmaps)
Returns
created SkImage in target SkColorType and SkColorSpace

Implements SkImage.

Reimplemented in SkImage_GaneshBase.

Definition at line 158 of file SkImage_Base.cpp.

161 {
162 // Default to the ganesh version which should be backend agnostic if this
163 // image is, for example, a raster backed image. The graphite subclass overrides
164 // this method and things work correctly.
165 return this->makeColorTypeAndColorSpace(nullptr, ct, std::move(cs));
166}

◆ makeSubset() [1/2]

sk_sp< SkImage > SkImage_Base::makeSubset ( GrDirectContext direct,
const SkIRect subset 
) const
overridevirtual

Returns subset of this image.

Returns nullptr if any of the following are true:

  • Subset is empty
  • Subset is not contained inside the image's bounds
  • Pixels in the source image could not be read or copied
  • This image is texture-backed and the provided context is null or does not match the source image's context.

If the source image was texture-backed, the resulting image will be texture-backed also. Otherwise, the returned image will be raster-backed.

Parameters
directthe GrDirectContext of the source image (nullptr is ok if the source image is not texture-backed).
subsetbounds of returned SkImage
Returns
the subsetted image, or nullptr

example: https://fiddle.skia.org/c/@Image_makeSubset

Implements SkImage.

Reimplemented in SkImage_GaneshBase.

Definition at line 80 of file SkImage_Base.cpp.

80 {
81 if (subset.isEmpty()) {
82 return nullptr;
83 }
84
85 const SkIRect bounds = SkIRect::MakeWH(this->width(), this->height());
86 if (!bounds.contains(subset)) {
87 return nullptr;
88 }
89
90 // optimization : return self if the subset == our bounds
91 if (bounds == subset) {
92 return sk_ref_sp(const_cast<SkImage_Base*>(this));
93 }
94
95 return this->onMakeSubset(direct, subset);
96}
virtual sk_sp< SkImage > onMakeSubset(GrDirectContext *, const SkIRect &) const =0
int width() const
Definition SkImage.h:285
int height() const
Definition SkImage.h:291
SkIRect bounds() const
Definition SkImage.h:303
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
Definition SkRect.h:56
bool isEmpty() const
Definition SkRect.h:202
bool contains(int32_t x, int32_t y) const
Definition SkRect.h:463

◆ makeSubset() [2/2]

sk_sp< SkImage > SkImage_Base::makeSubset ( skgpu::graphite::Recorder ,
const SkIRect subset,
RequiredProperties   
) const
overridevirtual

Returns subset of this image.

Returns nullptr if any of the following are true:

  • Subset is empty
  • Subset is not contained inside the image's bounds
  • Pixels in the image could not be read or copied
  • This image is texture-backed and the provided context is null or does not match the source image's context.

If the source image was texture-backed, the resulting image will be texture-backed also. Otherwise, the returned image will be raster-backed.

Parameters
recorderthe recorder of the source image (nullptr is ok if the source image was texture-backed).
subsetbounds of returned SkImage
RequiredPropertiesproperties the returned SkImage must possess (e.g. mipmaps)
Returns
the subsetted image, or nullptr

Implements SkImage.

Definition at line 98 of file SkImage_Base.cpp.

100 {
101 if (subset.isEmpty()) {
102 return nullptr;
103 }
104
105 const SkIRect bounds = SkIRect::MakeWH(this->width(), this->height());
106 if (!bounds.contains(subset)) {
107 return nullptr;
108 }
109
110 return this->onMakeSubset(recorder, subset, requiredProps);
111}

◆ notifyAddedToRasterCache()

virtual void SkImage_Base::notifyAddedToRasterCache ( ) const
inlinevirtual

Reimplemented in SkImage_Raster.

Definition at line 174 of file SkImage_Base.h.

174 {
175 fAddedToRasterCache.store(true);
176 }

◆ onAsLegacyBitmap()

bool SkImage_Base::onAsLegacyBitmap ( GrDirectContext dContext,
SkBitmap bitmap 
) const
virtual

Reimplemented in SkImage_Raster.

Definition at line 62 of file SkImage_Base.cpp.

62 {
63 // As the base-class, all we can do is make a copy (regardless of mode).
64 // Subclasses that want to be more optimal should override.
65 SkImageInfo info = fInfo.makeColorType(kN32_SkColorType).makeColorSpace(nullptr);
66 if (!bitmap->tryAllocPixels(info)) {
67 return false;
68 }
69
70 if (!this->readPixels(
71 dContext, bitmap->info(), bitmap->getPixels(), bitmap->rowBytes(), 0, 0)) {
72 bitmap->reset();
73 return false;
74 }
75
76 bitmap->setImmutable();
77 return true;
78}
bool readPixels(GrDirectContext *context, const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint cachingHint=kAllow_CachingHint) const
Definition SkImage.cpp:42
SkImageInfo makeColorSpace(sk_sp< SkColorSpace > cs) const
SkImageInfo makeColorType(SkColorType newColorType) const

◆ onAsyncRescaleAndReadPixels()

void SkImage_Base::onAsyncRescaleAndReadPixels ( const SkImageInfo info,
SkIRect  srcRect,
RescaleGamma  rescaleGamma,
RescaleMode  rescaleMode,
ReadPixelsCallback  callback,
ReadPixelsContext  context 
) const
virtual

Default implementation does a rescale/read and then calls the callback.

Reimplemented in SkImage_Ganesh, and skgpu::graphite::Image_Base.

Definition at line 36 of file SkImage_Base.cpp.

41 {
43 SkPixmap peek;
44 SkIRect srcRect;
45 if (this->peekPixels(&peek)) {
46 src.installPixels(peek);
47 srcRect = origSrcRect;
48 } else {
49 // Context TODO: Elevate GrDirectContext requirement to public API.
50 auto dContext = as_IB(this)->directContext();
51 src.setInfo(this->imageInfo().makeDimensions(origSrcRect.size()));
52 src.allocPixels();
53 if (!this->readPixels(dContext, src.pixmap(), origSrcRect.x(), origSrcRect.y())) {
54 callback(context, nullptr);
55 return;
56 }
57 srcRect = SkIRect::MakeSize(src.dimensions());
58 }
59 return SkRescaleAndReadPixels(src, info, srcRect, rescaleGamma, rescaleMode, callback, context);
60}
static SkImage_Base * as_IB(SkImage *image)
void SkRescaleAndReadPixels(SkBitmap bmp, const SkImageInfo &resultInfo, const SkIRect &srcRect, SkImage::RescaleGamma rescaleGamma, SkImage::RescaleMode rescaleMode, SkImage::ReadPixelsCallback callback, SkImage::ReadPixelsContext context)
virtual GrDirectContext * directContext() const
virtual GrImageContext * context() const
const SkImageInfo & imageInfo() const
Definition SkImage.h:279
bool peekPixels(SkPixmap *pixmap) const
Definition SkImage.cpp:34
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
static constexpr SkIRect MakeSize(const SkISize &size)
Definition SkRect.h:66

◆ onAsyncRescaleAndReadPixelsYUV420()

void SkImage_Base::onAsyncRescaleAndReadPixelsYUV420 ( SkYUVColorSpace  ,
bool  readAlpha,
sk_sp< SkColorSpace dstColorSpace,
SkIRect  srcRect,
SkISize  dstSize,
RescaleGamma  ,
RescaleMode  ,
ReadPixelsCallback  callback,
ReadPixelsContext  context 
) const
virtual

Default implementation does a rescale/read/yuv conversion and then calls the callback.

Reimplemented in SkImage_Ganesh, and skgpu::graphite::Image_Base.

Definition at line 113 of file SkImage_Base.cpp.

121 {
122 // TODO: Call non-YUV asyncRescaleAndReadPixels and then make our callback convert to YUV and
123 // call client's callback.
124 callback(context, nullptr);
125}

◆ onHasMipmaps()

virtual bool SkImage_Base::onHasMipmaps ( ) const
pure virtual

◆ onIsProtected()

virtual bool SkImage_Base::onIsProtected ( ) const
pure virtual

◆ onMakeColorTypeAndColorSpace()

virtual sk_sp< SkImage > SkImage_Base::onMakeColorTypeAndColorSpace ( SkColorType  ,
sk_sp< SkColorSpace ,
GrDirectContext  
) const
pure virtual

◆ onMakeSubset() [1/2]

virtual sk_sp< SkImage > SkImage_Base::onMakeSubset ( GrDirectContext ,
const SkIRect  
) const
pure virtual

◆ onMakeSubset() [2/2]

virtual sk_sp< SkImage > SkImage_Base::onMakeSubset ( skgpu::graphite::Recorder ,
const SkIRect ,
RequiredProperties   
) const
pure virtual

◆ onMakeWithMipmaps()

virtual sk_sp< SkImage > SkImage_Base::onMakeWithMipmaps ( sk_sp< SkMipmap ) const
inlinevirtual

Reimplemented in SkImage_Raster.

Definition at line 185 of file SkImage_Base.h.

185 {
186 return nullptr;
187 }

◆ onPeekBitmap()

virtual const SkBitmap * SkImage_Base::onPeekBitmap ( ) const
inlinevirtual

Reimplemented in SkImage_Raster.

Definition at line 64 of file SkImage_Base.h.

64{ return nullptr; }

◆ onPeekMips()

virtual SkMipmap * SkImage_Base::onPeekMips ( ) const
inlinevirtual

Reimplemented in SkImage_Raster.

Definition at line 84 of file SkImage_Base.h.

84{ return nullptr; }

◆ onPeekPixels()

virtual bool SkImage_Base::onPeekPixels ( SkPixmap ) const
inlinevirtual

Reimplemented in SkImage_Raster.

Definition at line 62 of file SkImage_Base.h.

62{ return false; }

◆ onReadPixels()

virtual bool SkImage_Base::onReadPixels ( GrDirectContext ,
const SkImageInfo dstInfo,
void *  dstPixels,
size_t  dstRowBytes,
int  srcX,
int  srcY,
CachingHint   
) const
pure virtual

◆ onRefEncoded()

virtual sk_sp< SkData > SkImage_Base::onRefEncoded ( ) const
inlinevirtual

Reimplemented in SkImage_Lazy.

Definition at line 128 of file SkImage_Base.h.

128{ return nullptr; }

◆ onReinterpretColorSpace()

virtual sk_sp< SkImage > SkImage_Base::onReinterpretColorSpace ( sk_sp< SkColorSpace ) const
pure virtual

◆ refMips()

sk_sp< SkMipmap > SkImage_Base::refMips ( ) const
inline

Definition at line 86 of file SkImage_Base.h.

86 {
87 return sk_ref_sp(this->onPeekMips());
88 }
virtual SkMipmap * onPeekMips() const

◆ textureSize()

size_t SkImage_Base::textureSize ( ) const
inlineoverridevirtual

Returns an approximation of the amount of texture memory used by the image. Returns zero if the image is not texture backed or if the texture has an external format.

Implements SkImage.

Reimplemented in SkImage_Ganesh, and SkImage_GaneshYUVA.

Definition at line 59 of file SkImage_Base.h.

59{ return 0; }

◆ type()

virtual Type SkImage_Base::type ( ) const
pure virtual

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