Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkImage_Raster Class Reference

#include <SkImage_Raster.h>

Inheritance diagram for SkImage_Raster:
SkImage_Base SkImage SkRefCnt SkRefCntBase SkImage_RasterPinnable

Public Member Functions

 SkImage_Raster (const SkImageInfo &, sk_sp< SkData >, size_t rb, uint32_t id=kNeedNewImageUniqueID)
 
 SkImage_Raster (const SkBitmap &bm, bool bitmapMayBeMutable=false)
 
 ~SkImage_Raster () override
 
bool isValid (GrRecordingContext *context) const override
 
bool onReadPixels (GrDirectContext *, const SkImageInfo &, void *, size_t, int srcX, int srcY, CachingHint) const override
 
bool onPeekPixels (SkPixmap *) const override
 
const SkBitmaponPeekBitmap () const override
 
bool getROPixels (GrDirectContext *, SkBitmap *, CachingHint) const override
 
sk_sp< SkImageonMakeSubset (GrDirectContext *, const SkIRect &) const override
 
sk_sp< SkImageonMakeSubset (skgpu::graphite::Recorder *, const SkIRect &, RequiredProperties) const override
 
SkPixelRefgetPixelRef () const
 
bool onAsLegacyBitmap (GrDirectContext *, SkBitmap *) const override
 
sk_sp< SkImageonMakeColorTypeAndColorSpace (SkColorType, sk_sp< SkColorSpace >, GrDirectContext *) const override
 
sk_sp< SkImageonReinterpretColorSpace (sk_sp< SkColorSpace >) const override
 
void notifyAddedToRasterCache () const override
 
bool onHasMipmaps () const override
 
bool onIsProtected () const override
 
SkMipmaponPeekMips () const override
 
sk_sp< SkImageonMakeWithMipmaps (sk_sp< SkMipmap > mips) const override
 
SkImage_Base::Type type () const override
 
SkBitmap bitmap () 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 >)
 
- Protected Member Functions inherited from SkImage_Base
 SkImage_Base (const SkImageInfo &info, uint32_t uniqueID)
 

Detailed Description

Definition at line 36 of file SkImage_Raster.h.

Constructor & Destructor Documentation

◆ SkImage_Raster() [1/2]

SkImage_Raster::SkImage_Raster ( const SkImageInfo info,
sk_sp< SkData data,
size_t  rb,
uint32_t  id = kNeedNewImageUniqueID 
)

Definition at line 45 of file SkImage_Raster.cpp.

47 : SkImage_Base(info, id) {
48 void* addr = const_cast<void*>(data->data());
49
50 fBitmap.installPixels(info, addr, rowBytes, release_data, data.release());
51 fBitmap.setImmutable();
52}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
static void release_data(void *addr, void *context)
void setImmutable()
Definition: SkBitmap.cpp:400
bool installPixels(const SkImageInfo &info, void *pixels, size_t rowBytes, void(*releaseProc)(void *addr, void *context), void *context)
Definition: SkBitmap.cpp:323
friend class SkImage_Base
Definition: SkImage.h:936
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ SkImage_Raster() [2/2]

SkImage_Raster::SkImage_Raster ( const SkBitmap bm,
bool  bitmapMayBeMutable = false 
)

Definition at line 54 of file SkImage_Raster.cpp.

55 : SkImage_Base(bm.info(),
57 , fBitmap(bm) {
58 SkASSERT(bitmapMayBeMutable || fBitmap.isImmutable());
59}
#define SkASSERT(cond)
Definition: SkAssert.h:116
@ kNeedNewImageUniqueID
Definition: SkImage_Base.h:33
static bool is_not_subset(const SkBitmap &bm)
bool isImmutable() const
Definition: SkBitmap.cpp:396
const SkImageInfo & info() const
Definition: SkBitmap.h:139
uint32_t getGenerationID() const
Definition: SkBitmap.cpp:361

◆ ~SkImage_Raster()

SkImage_Raster::~SkImage_Raster ( )
override

Definition at line 61 of file SkImage_Raster.cpp.

61{}

Member Function Documentation

◆ bitmap()

SkBitmap SkImage_Raster::bitmap ( ) const
inline

Definition at line 99 of file SkImage_Raster.h.

99{ return fBitmap; }

◆ getPixelRef()

SkPixelRef * SkImage_Raster::getPixelRef ( ) const
inline

Definition at line 58 of file SkImage_Raster.h.

58{ return fBitmap.pixelRef(); }
SkPixelRef * pixelRef() const
Definition: SkBitmap.h:720

◆ getROPixels()

bool SkImage_Raster::getROPixels ( GrDirectContext ,
SkBitmap dst,
CachingHint   
) const
overridevirtual

Implements SkImage_Base.

Definition at line 78 of file SkImage_Raster.cpp.

78 {
79 *dst = fBitmap;
80 return true;
81}
dst
Definition: cp.py:12

◆ isValid()

bool SkImage_Raster::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 44 of file SkImage_Raster.h.

44{ return true; }

◆ notifyAddedToRasterCache()

void SkImage_Raster::notifyAddedToRasterCache ( ) const
inlineoverridevirtual

Reimplemented from SkImage_Base.

Definition at line 67 of file SkImage_Raster.h.

67 {
68 // We explicitly DON'T want to call INHERITED::notifyAddedToRasterCache. That ties the
69 // lifetime of derived/cached resources to the image. In this case, we only want cached
70 // data (eg mips) tied to the lifetime of the underlying pixelRef.
71 SkASSERT(fBitmap.pixelRef());
72 fBitmap.pixelRef()->notifyAddedToCache();
73 }
void notifyAddedToCache()
Definition: SkPixelRef.h:76

◆ onAsLegacyBitmap()

bool SkImage_Raster::onAsLegacyBitmap ( GrDirectContext ,
SkBitmap bitmap 
) const
overridevirtual

Reimplemented from SkImage_Base.

Definition at line 194 of file SkImage_Raster.cpp.

194 {
195 // When we're a snapshot from a surface, our bitmap may not be marked immutable
196 // even though logically always we are, but in that case we can't physically share our
197 // pixelref since the caller might call setImmutable() themselves
198 // (thus changing our state).
199 if (fBitmap.isImmutable()) {
200 SkIPoint origin = fBitmap.pixelRefOrigin();
201 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes());
202 bitmap->setPixelRef(sk_ref_sp(fBitmap.pixelRef()), origin.x(), origin.y());
203 return true;
204 }
205 return this->SkImage_Base::onAsLegacyBitmap(nullptr, bitmap);
206}
sk_sp< T > sk_ref_sp(T *obj)
Definition: SkRefCnt.h:381
SkIPoint pixelRefOrigin() const
Definition: SkBitmap.cpp:168
size_t rowBytes() const
Definition: SkBitmap.h:238
virtual bool onAsLegacyBitmap(GrDirectContext *, SkBitmap *) const
Definition: bitmap.py:1
constexpr int32_t y() const
Definition: SkPoint_impl.h:52
constexpr int32_t x() const
Definition: SkPoint_impl.h:46

◆ onHasMipmaps()

bool SkImage_Raster::onHasMipmaps ( ) const
inlineoverridevirtual

Implements SkImage_Base.

Definition at line 75 of file SkImage_Raster.h.

75{ return SkToBool(fBitmap.fMips); }
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35

◆ onIsProtected()

bool SkImage_Raster::onIsProtected ( ) const
inlineoverridevirtual

Implements SkImage_Base.

Definition at line 76 of file SkImage_Raster.h.

76{ return false; }

◆ onMakeColorTypeAndColorSpace()

sk_sp< SkImage > SkImage_Raster::onMakeColorTypeAndColorSpace ( SkColorType  targetCT,
sk_sp< SkColorSpace targetCS,
GrDirectContext  
) const
overridevirtual

Implements SkImage_Base.

Definition at line 210 of file SkImage_Raster.cpp.

212 {
214 SkAssertResult(fBitmap.peekPixels(&src));
215
217 if (!dst.tryAllocPixels(fBitmap.info().makeColorType(targetCT).makeColorSpace(targetCS))) {
218 return nullptr;
219 }
220
221 SkAssertResult(dst.writePixels(src));
222 dst.setImmutable();
223 return dst.asImage();
224}
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
bool peekPixels(SkPixmap *pixmap) const
Definition: SkBitmap.cpp:635
SkImageInfo makeColorSpace(sk_sp< SkColorSpace > cs) const
SkImageInfo makeColorType(SkColorType newColorType) const
Definition: SkImageInfo.h:475

◆ onMakeSubset() [1/2]

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

Implements SkImage_Base.

Definition at line 104 of file SkImage_Raster.cpp.

104 {
105 SkBitmap copy = copy_bitmap_subset(fBitmap, subset);
106 if (copy.isNull()) {
107 return nullptr;
108 } else {
109 return copy.asImage();
110 }
111}
static SkBitmap copy_bitmap_subset(const SkBitmap &orig, const SkIRect &subset)
Definition: copy.py:1

◆ onMakeSubset() [2/2]

sk_sp< SkImage > SkImage_Raster::onMakeSubset ( skgpu::graphite::Recorder ,
const SkIRect subset,
RequiredProperties  requiredProperties 
) const
overridevirtual

Implements SkImage_Base.

Definition at line 135 of file SkImage_Raster.cpp.

137 {
138 sk_sp<SkImage> img;
139
140 if (requiredProperties.fMipmapped) {
141 bool fullCopy = subset == SkIRect::MakeSize(fBitmap.dimensions());
142
143 sk_sp<SkMipmap> mips = fullCopy ? copy_mipmaps(fBitmap, fBitmap.fMips.get()) : nullptr;
144
145 // SkImage::withMipmaps will always make a copy for us so we can temporarily share
146 // the pixel ref with fBitmap
147 SkBitmap tmpSubset;
148 if (!fBitmap.extractSubset(&tmpSubset, subset)) {
149 return nullptr;
150 }
151
152 sk_sp<SkImage> tmp(new SkImage_Raster(tmpSubset, /* bitmapMayBeMutable= */ true));
153
154 // withMipmaps will auto generate the mipmaps if a nullptr is passed in
155 SkASSERT(!mips || mips->validForRootLevel(tmp->imageInfo()));
156 img = tmp->withMipmaps(std::move(mips));
157 } else {
158 SkBitmap copy = copy_bitmap_subset(fBitmap, subset);
159 if (!copy.isNull()) {
160 img = copy.asImage();
161 }
162 }
163
164 return img;
165}
static sk_sp< SkMipmap > copy_mipmaps(const SkBitmap &src, SkMipmap *srcMips)
bool extractSubset(SkBitmap *dst, const SkIRect &subset) const
Definition: SkBitmap.cpp:453
SkISize dimensions() const
Definition: SkBitmap.h:388
friend class SkImage_Raster
Definition: SkImage.h:937
bool validForRootLevel(const SkImageInfo &) const
Definition: SkMipmap.cpp:242
T * get() const
Definition: SkRefCnt.h:303
static constexpr SkIRect MakeSize(const SkISize &size)
Definition: SkRect.h:66

◆ onMakeWithMipmaps()

sk_sp< SkImage > SkImage_Raster::onMakeWithMipmaps ( sk_sp< SkMipmap mips) const
inlineoverridevirtual

Reimplemented from SkImage_Base.

Definition at line 80 of file SkImage_Raster.h.

80 {
81 // It's dangerous to have two SkBitmaps that share a SkPixelRef but have different SkMipmaps
82 // since various caches key on SkPixelRef's generation ID. Also, SkPixelRefs that back
83 // SkSurfaces are marked "temporarily immutable" and making an image that uses the same
84 // SkPixelRef can interact badly with SkSurface/SkImage copy-on-write. So we just always
85 // make a copy with a new ID.
86 static auto constexpr kCopyMode = SkCopyPixelsMode::kAlways_SkCopyPixelsMode;
87 sk_sp<SkImage> img = SkMakeImageFromRasterBitmap(fBitmap, kCopyMode);
88 auto imgRaster = static_cast<SkImage_Raster*>(img.get());
89 if (mips) {
90 imgRaster->fBitmap.fMips = std::move(mips);
91 } else {
92 imgRaster->fBitmap.fMips.reset(SkMipmap::Build(fBitmap.pixmap(), nullptr));
93 }
94 return img;
95 }
SK_SPI sk_sp< SkImage > SkMakeImageFromRasterBitmap(const SkBitmap &, SkCopyPixelsMode)
@ kAlways_SkCopyPixelsMode
always copy src pixels (even if they are marked immutable)
Definition: SkImagePriv.h:19
const SkPixmap & pixmap() const
Definition: SkBitmap.h:133
static SkMipmap * Build(const SkPixmap &src, SkDiscardableFactoryProc, bool computeContents=true)
Definition: SkMipmap.cpp:45

◆ onPeekBitmap()

const SkBitmap * SkImage_Raster::onPeekBitmap ( ) const
inlineoverridevirtual

Reimplemented from SkImage_Base.

Definition at line 50 of file SkImage_Raster.h.

50{ return &fBitmap; }

◆ onPeekMips()

SkMipmap * SkImage_Raster::onPeekMips ( ) const
inlineoverridevirtual

Reimplemented from SkImage_Base.

Definition at line 78 of file SkImage_Raster.h.

78{ return fBitmap.fMips.get(); }

◆ onPeekPixels()

bool SkImage_Raster::onPeekPixels ( SkPixmap pm) const
overridevirtual

Reimplemented from SkImage_Base.

Definition at line 74 of file SkImage_Raster.cpp.

74 {
75 return fBitmap.peekPixels(pm);
76}

◆ onReadPixels()

bool SkImage_Raster::onReadPixels ( GrDirectContext ,
const SkImageInfo dstInfo,
void *  dstPixels,
size_t  dstRowBytes,
int  srcX,
int  srcY,
CachingHint   
) const
overridevirtual

Implements SkImage_Base.

Definition at line 63 of file SkImage_Raster.cpp.

69 {
70 SkBitmap shallowCopy(fBitmap);
71 return shallowCopy.readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY);
72}

◆ onReinterpretColorSpace()

sk_sp< SkImage > SkImage_Raster::onReinterpretColorSpace ( sk_sp< SkColorSpace newCS) const
overridevirtual

Implements SkImage_Base.

Definition at line 226 of file SkImage_Raster.cpp.

226 {
227 // TODO: If our bitmap is immutable, then we could theoretically create another image sharing
228 // our pixelRef. That doesn't work (without more invasive logic), because the image gets its
229 // gen ID from the bitmap, which gets it from the pixelRef.
230 SkPixmap pixmap = fBitmap.pixmap();
231 pixmap.setColorSpace(std::move(newCS));
232 return SkImages::RasterFromPixmapCopy(pixmap);
233}
void setColorSpace(sk_sp< SkColorSpace > colorSpace)
Definition: SkPixmap.cpp:57
SK_API sk_sp< SkImage > RasterFromPixmapCopy(const SkPixmap &pixmap)

◆ type()

SkImage_Base::Type SkImage_Raster::type ( ) const
inlineoverridevirtual

Implements SkImage_Base.

Definition at line 97 of file SkImage_Raster.h.


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