Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | List of all members
skgpu::graphite::Image_Base Class Reference

#include <Image_Base_Graphite.h>

Inheritance diagram for skgpu::graphite::Image_Base:
SkImage_Base SkImage SkRefCnt SkRefCntBase skgpu::graphite::Image skgpu::graphite::Image_YUVA

Public Member Functions

 ~Image_Base () override
 
void notifyInUse (Recorder *, DrawContext *drawContext) const
 
bool isDynamic () const
 
virtual sk_sp< ImagecopyImage (Recorder *, const SkIRect &subset, Budgeted, Mipmapped, SkBackingFit, std::string_view label) const
 
bool isValid (GrRecordingContext *) const override
 
sk_sp< SkImageonMakeSubset (Recorder *, const SkIRect &, RequiredProperties) const override
 
sk_sp< SkImagemakeColorTypeAndColorSpace (Recorder *, SkColorType targetCT, sk_sp< SkColorSpace > targetCS, RequiredProperties) const override
 
bool onReadPixels (GrDirectContext *, const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY, CachingHint) const override
 
bool getROPixels (GrDirectContext *, SkBitmap *, CachingHint=kAllow_CachingHint) const override
 
sk_sp< SkImageonMakeSubset (GrDirectContext *, const SkIRect &) const override
 
sk_sp< SkImageonMakeColorTypeAndColorSpace (SkColorType, sk_sp< SkColorSpace >, GrDirectContext *) const override
 
void onAsyncRescaleAndReadPixels (const SkImageInfo &, SkIRect srcRect, RescaleGamma, RescaleMode, ReadPixelsCallback, ReadPixelsContext) const override
 
void onAsyncRescaleAndReadPixelsYUV420 (SkYUVColorSpace, bool readAlpha, sk_sp< SkColorSpace >, SkIRect srcRect, SkISize dstSize, RescaleGamma, RescaleMode, ReadPixelsCallback, ReadPixelsContext) const override
 
- 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
 

Protected Member Functions

 Image_Base (const SkImageInfo &info, uint32_t uniqueID)
 
void linkDevices (const Image_Base *)
 
void linkDevice (sk_sp< Device >)
 
- Protected Member Functions inherited from SkImage_Base
 SkImage_Base (const SkImageInfo &info, uint32_t uniqueID)
 

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

Detailed Description

Definition at line 29 of file Image_Base_Graphite.h.

Constructor & Destructor Documentation

◆ ~Image_Base()

skgpu::graphite::Image_Base::~Image_Base ( )
overridedefault

◆ Image_Base()

skgpu::graphite::Image_Base::Image_Base ( const SkImageInfo info,
uint32_t  uniqueID 
)
protected

Definition at line 24 of file Image_Base_Graphite.cpp.

static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
uint32_t uniqueID() const
Definition: SkImage.h:311
friend class SkImage_Base
Definition: SkImage.h:936

Member Function Documentation

◆ copyImage()

sk_sp< Image > skgpu::graphite::Image_Base::copyImage ( Recorder recorder,
const SkIRect subset,
Budgeted  budgeted,
Mipmapped  mipmapped,
SkBackingFit  backingFit,
std::string_view  label 
) const
virtual

Reimplemented in skgpu::graphite::Image.

Definition at line 141 of file Image_Base_Graphite.cpp.

146 {
147 return CopyAsDraw(recorder, this, subset, this->imageInfo().colorInfo(),
148 budgeted, mipmapped, backingFit, std::move(label));
149}
const SkImageInfo & imageInfo() const
Definition: SkImage.h:279
sk_sp< Image > CopyAsDraw(Recorder *recorder, const SkImage *image, const SkIRect &subset, const SkColorInfo &dstColorInfo, Budgeted budgeted, Mipmapped mipmapped, SkBackingFit backingFit, std::string_view label)

◆ getROPixels()

bool skgpu::graphite::Image_Base::getROPixels ( GrDirectContext ,
SkBitmap ,
CachingHint  = kAllow_CachingHint 
) const
inlineoverridevirtual

Implements SkImage_Base.

Definition at line 69 of file Image_Base_Graphite.h.

71 { return false; }

◆ isDynamic()

bool skgpu::graphite::Image_Base::isDynamic ( ) const

Definition at line 122 of file Image_Base_Graphite.cpp.

122 {
123 SkAutoSpinlock lock{fDeviceLinkLock};
124 int emptyCount = 0;
125 if (!fLinkedDevices.empty()) {
126 for (sk_sp<Device>& device : fLinkedDevices) {
127 if (!device || !device->recorder() || device->unique()) {
128 device.reset();
129 emptyCount++;
130 }
131 }
132 if (emptyCount == fLinkedDevices.size()) {
133 fLinkedDevices.clear();
134 emptyCount = 0;
135 }
136 }
137
138 return emptyCount > 0;
139}
VkDevice device
Definition: main.cc:53

◆ isValid()

bool skgpu::graphite::Image_Base::isValid ( GrRecordingContext context) const
inlineoverridevirtual

Returns true if SkImage can be drawn on either raster surface or GPU surface. If context is nullptr, tests if SkImage draws on raster surface; otherwise, tests if SkImage draws on GPU surface associated with context.

SkImage backed by GPU texture may become invalid if associated context is invalid. lazy image may be invalid and may not draw to raster surface or GPU surface or both.

Parameters
contextGPU context
Returns
true if SkImage can be drawn

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

Implements SkImage.

Definition at line 51 of file Image_Base_Graphite.h.

51{ return true; }

◆ linkDevice()

void skgpu::graphite::Image_Base::linkDevice ( sk_sp< Device device)
protected

Definition at line 38 of file Image_Base_Graphite.cpp.

38 {
39 // Technically this lock isn't needed since this is only called before the Image is returned to
40 // user code that could expose it to multiple threads. But this quiets threading warnings and
41 // should be uncontested.
42 SkAutoSpinlock lock{fDeviceLinkLock};
43 fLinkedDevices.push_back(std::move(device));
44}

◆ linkDevices()

void skgpu::graphite::Image_Base::linkDevices ( const Image_Base other)
protected

Definition at line 29 of file Image_Base_Graphite.cpp.

29 {
30 SkASSERT(other);
31
32 SkAutoSpinlock lock{other->fDeviceLinkLock};
33 for (const auto& device : other->fLinkedDevices) {
34 this->linkDevice(device);
35 }
36}
#define SkASSERT(cond)
Definition: SkAssert.h:116
void linkDevice(sk_sp< Device >)

◆ makeColorTypeAndColorSpace()

sk_sp< SkImage > skgpu::graphite::Image_Base::makeColorTypeAndColorSpace ( 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.

Definition at line 197 of file Image_Base_Graphite.cpp.

200 {
201 SkColorInfo dstColorInfo{targetCT, this->alphaType(), std::move(targetCS)};
202 // optimization : return self if there's no color type/space change and the image's texture
203 // is immutable
204 if (this->imageInfo().colorInfo() == dstColorInfo && !this->isDynamic()) {
205 return sk_ref_sp(this);
206 }
207
208 TextureProxy* proxy = get_base_proxy_for_label(this);
209 SkASSERT(proxy);
210 std::string label = proxy->label();
211 if (label.empty()) {
212 label = "ImageMakeCTandCSTexture";
213 } else {
214 label += "_CTandCSConversion";
215 }
216
217 // Use CopyAsDraw directly to perform the color space changes. The copied image is not
218 // considered budgeted because this is a client-invoked API and they will own the image.
219 return CopyAsDraw(recorder,
220 this,
221 this->bounds(),
222 dstColorInfo,
224 requiredProps.fMipmapped ? Mipmapped::kYes : Mipmapped::kNo,
226 label);
227}
sk_sp< T > sk_ref_sp(T *obj)
Definition: SkRefCnt.h:381
SkAlphaType alphaType() const
Definition: SkImage.cpp:154
SkIRect bounds() const
Definition: SkImage.h:303

◆ notifyInUse()

void skgpu::graphite::Image_Base::notifyInUse ( Recorder recorder,
DrawContext drawContext 
) const

Definition at line 46 of file Image_Base_Graphite.cpp.

46 {
47 SkASSERT(recorder);
48
49 // The ref counts stored on each linked device are thread safe, but the Image's sk_sp's that
50 // track the refs its responsible for are *not* thread safe. Use a spin lock since the majority
51 // of device-linked images will be used only on the Recorder's thread. Since it should be
52 // uncontended, the empty check is also done inside the lock vs. a double-checked locking
53 // pattern that is non-trivial to ensure correctness in C++.
54 SkAutoSpinlock lock{fDeviceLinkLock};
55
56 if (!fLinkedDevices.empty()) {
57 int emptyCount = 0;
58 for (sk_sp<Device>& device : fLinkedDevices) {
59 if (!device) {
60 emptyCount++; // Already unlinked but array isn't empty yet
61 } else {
62 if (device->isScratchDevice()) {
63 sk_sp<Task> deviceDrawTask = device->lastDrawTask();
64 if (deviceDrawTask) {
65 // Increment the pending read count for the device's target
66 recorder->priv().addPendingRead(device->target());
67 if (drawContext) {
68 // Add a reference to the device's drawTask to `drawContext` if that's
69 // provided.
70 drawContext->recordDependency(std::move(deviceDrawTask));
71 } else {
72 // If there's no `drawContext` this notify represents a copy, so for
73 // now append the task to the root task list since that is where the
74 // subsequent copy task will go as well.
75 recorder->priv().add(std::move(deviceDrawTask));
76 }
77 } else {
78 // If there's no draw task yet, the device is being drawn into a child
79 // scratch device (backdrop filter or init-from-prev layer), and the child
80 // will later on be drawn back into the device's `drawContext`. In this case
81 // `device` should already have performed an internal flush and have no
82 // pending work, and not yet be marked immutable. The correct action at this
83 // point in time is to do nothing: the final task order in the device's
84 // DrawTask will be pre-notified tasks into the device's target, then the
85 // child's DrawTask when it's drawn back into `device`, and then any post
86 // tasks that further modify the `device`'s target.
87 SkASSERT(device->recorder() && device->recorder() == recorder);
88 }
89
90 // Scratch devices are often already marked immutable, but they are also the
91 // way in which Image finds the last snapped DrawTask so we don't unlink
92 // scratch devices. The scratch image view will be short-lived as well, or the
93 // device will transition to a non-scratch device in a future Recording and then
94 // it will be unlinked then.
95 } else {
96 // Automatic flushing of image views only happens when mixing reads and writes
97 // on the originating Recorder. Draws of the view on another Recorder will
98 // always see the texture content dependent on how Recordings are inserted.
99 if (device->recorder() == recorder) {
100 // Non-scratch devices push their tasks to the root task list to maintain
101 // an order consistent with the client-triggering actions. Because of this,
102 // there's no need to add references to the `drawContext` that the device
103 // is being drawn into.
104 device->flushPendingWorkToRecorder();
105 }
106 if (!device->recorder() || device->unique()) {
107 // The device will not record any more commands that modify the texture, so
108 // the image doesn't need to be linked
109 device.reset();
110 emptyCount++;
111 }
112 }
113 }
114 }
115
116 if (emptyCount == fLinkedDevices.size()) {
117 fLinkedDevices.clear();
118 }
119 }
120}
void addPendingRead(const TextureProxy *)
Definition: Recorder.cpp:480
void add(sk_sp< Task >)
Definition: Recorder.cpp:485

◆ onAsyncRescaleAndReadPixels()

void skgpu::graphite::Image_Base::onAsyncRescaleAndReadPixels ( const SkImageInfo info,
SkIRect  srcRect,
RescaleGamma  rescaleGamma,
RescaleMode  rescaleMode,
ReadPixelsCallback  callback,
ReadPixelsContext  context 
) const
overridevirtual

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

Reimplemented from SkImage_Base.

Definition at line 243 of file Image_Base_Graphite.cpp.

248 {
249 SKGPU_LOG_W("Cannot use Ganesh async API with Graphite-backed image, use API on Context");
250 callback(context, nullptr);
251}
#define SKGPU_LOG_W(fmt,...)
Definition: Log.h:40
virtual GrImageContext * context() const
Definition: SkImage_Base.h:112
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ onAsyncRescaleAndReadPixelsYUV420()

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

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

Reimplemented from SkImage_Base.

Definition at line 253 of file Image_Base_Graphite.cpp.

261 {
262 SKGPU_LOG_W("Cannot use Ganesh async API with Graphite-backed image, use API on Context");
263 callback(context, nullptr);
264}

◆ onMakeColorTypeAndColorSpace()

sk_sp< SkImage > skgpu::graphite::Image_Base::onMakeColorTypeAndColorSpace ( SkColorType  ,
sk_sp< SkColorSpace ,
GrDirectContext  
) const
overridevirtual

Implements SkImage_Base.

Definition at line 236 of file Image_Base_Graphite.cpp.

238 {
239 SKGPU_LOG_W("Cannot convert Graphite-backed image to Ganesh");
240 return nullptr;
241}

◆ onMakeSubset() [1/2]

sk_sp< SkImage > skgpu::graphite::Image_Base::onMakeSubset ( GrDirectContext ,
const SkIRect  
) const
overridevirtual

Implements SkImage_Base.

Definition at line 231 of file Image_Base_Graphite.cpp.

231 {
232 SKGPU_LOG_W("Cannot convert Graphite-backed image to Ganesh");
233 return nullptr;
234}

◆ onMakeSubset() [2/2]

sk_sp< SkImage > skgpu::graphite::Image_Base::onMakeSubset ( Recorder recorder,
const SkIRect subset,
RequiredProperties  requiredProps 
) const
overridevirtual

Implements SkImage_Base.

Definition at line 167 of file Image_Base_Graphite.cpp.

169 {
170 // optimization : return self if the subset == our bounds and requirements met and the image's
171 // texture is immutable
172 if (this->bounds() == subset &&
173 (!requiredProps.fMipmapped || this->hasMipmaps()) &&
174 !this->isDynamic()) {
175 return sk_ref_sp(this);
176 }
177
178 TextureProxy* proxy = get_base_proxy_for_label(this);
179 SkASSERT(proxy);
180 std::string label = proxy->label();
181 if (label.empty()) {
182 label = "ImageSubsetTexture";
183 } else {
184 label += "_Subset";
185 }
186
187 // The copied image is not considered budgeted because this is a client-invoked API and they
188 // will own the image.
189 return this->copyImage(recorder,
190 subset,
192 requiredProps.fMipmapped ? Mipmapped::kYes : Mipmapped::kNo,
194 label);
195}
virtual sk_sp< Image > copyImage(Recorder *, const SkIRect &subset, Budgeted, Mipmapped, SkBackingFit, std::string_view label) const

◆ onReadPixels()

bool skgpu::graphite::Image_Base::onReadPixels ( GrDirectContext ,
const SkImageInfo dstInfo,
void *  dstPixels,
size_t  dstRowBytes,
int  srcX,
int  srcY,
CachingHint   
) const
inlineoverridevirtual

Implements SkImage_Base.

Definition at line 61 of file Image_Base_Graphite.h.

67 { return false; }

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