31SharedGenerator::SharedGenerator(std::unique_ptr<SkImageGenerator>
gen)
32 : fGenerator(
std::move(
gen)) {
44 : fSharedGenerator(
std::move(
gen)) {
80 : fSharedGenerator(
gen)
81 , fAutoAcquire(
gen->fMutex) {}
84 fSharedGenerator->
fMutex.assertHeld();
89 fSharedGenerator->
fMutex.assertHeld();
102 , fSharedGenerator(
std::move(validator->fSharedGenerator))
109 auto check_output_bitmap = [
bitmap]() {
117 check_output_bitmap();
127 bool success =
false;
140 bool success =
false;
149 check_output_bitmap();
154 return fSharedGenerator;
171 return bm.
readPixels(dstInfo, dstPixels, dstRB, srcX, srcY);
178 if (fSharedGenerator->
fGenerator->uniqueID() == this->uniqueID()) {
195 return pixels ? pixels->makeSubset(
nullptr, subset) :
nullptr;
207 return nonLazyImg->
makeSubset(
nullptr, subset, props);
214 if (fOnMakeColorTypeAndSpaceResult &&
215 targetCT == fOnMakeColorTypeAndSpaceResult->
colorType() &&
217 return fOnMakeColorTypeAndSpaceResult;
219 Validator validator(fSharedGenerator, &targetCT, targetCS);
222 fOnMakeColorTypeAndSpaceResult =
result;
234 if (
bitmap.tryAllocPixels(this->imageInfo().makeColorSpace(std::move(newCS)))) {
258 if (!
generator->queryYUVAInfo(supportedDataTypes, &yuvaPixmapInfo) ||
264 data->writable_data());
266 if (!
generator->getYUVAPlanes(tempPixmaps)) {
270 *yuvaPixmaps = tempPixmaps;
276 fUniqueIDListeners.
add(std::move(listener));
286 return validator ? sk_make_sp<SkImage_Lazy>(&validator) :
nullptr;
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static sk_sp< SharedGenerator > Make(std::unique_ptr< SkImageGenerator > gen)
const SkImageInfo & getInfo() const
std::unique_ptr< SkImageGenerator > fGenerator
bool isTextureGenerator()
std::unique_ptr< Rec, RecDeleter > RecPtr
static RecPtr Alloc(const SkBitmapCacheDesc &, const SkImageInfo &, SkPixmap *)
static bool Find(const SkBitmapCacheDesc &, SkBitmap *result)
static void Add(RecPtr, SkBitmap *)
bool readPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY) const
bool tryAllocPixels(const SkImageInfo &info, size_t rowBytes)
static bool Equals(const SkColorSpace *, const SkColorSpace *)
void add(sk_sp< SkIDChangeListener > listener) SK_EXCLUDES(fMutex)
bool getPixels(const SkImageInfo &info, void *pixels, size_t rowBytes)
virtual GrImageContext * context() const
virtual void notifyAddedToRasterCache() const
SkImageGenerator * operator->() const
ScopedGenerator(const sk_sp< SharedGenerator > &gen)
SkImage_Lazy(Validator *validator)
virtual bool readPixelsProxy(GrDirectContext *, const SkPixmap &) const
bool getROPixels(GrDirectContext *, SkBitmap *, CachingHint) const override
void addUniqueIDListener(sk_sp< SkIDChangeListener >) const
sk_sp< SharedGenerator > generator() const
bool onIsProtected() const override
sk_sp< SkImage > onReinterpretColorSpace(sk_sp< SkColorSpace >) const final
bool isValid(GrRecordingContext *) const override
bool onReadPixels(GrDirectContext *, const SkImageInfo &, void *, size_t, int srcX, int srcY, CachingHint) const override
sk_sp< SkImage > onMakeSubset(GrDirectContext *, const SkIRect &) const override
sk_sp< SkData > onRefEncoded() const override
sk_sp< SkImage > onMakeColorTypeAndColorSpace(SkColorType, sk_sp< SkColorSpace >, GrDirectContext *) const override
sk_sp< SkCachedData > getPlanes(const SkYUVAPixmapInfo::SupportedDataTypes &supportedDataTypes, SkYUVAPixmaps *pixmaps) const
sk_sp< SkImage > makeRasterImage(GrDirectContext *, CachingHint cachingHint=kDisallow_CachingHint) const
const SkImageInfo & imageInfo() const
SkColorSpace * colorSpace() const
uint32_t uniqueID() const
SkColorType colorType() const
@ kAllow_CachingHint
allows internally caching decoded and copied pixels
sk_sp< SkColorSpace > refColorSpace() const
virtual sk_sp< SkImage > makeSubset(GrDirectContext *direct, const SkIRect &subset) const =0
static uint32_t ImageID()
void setColorSpace(sk_sp< SkColorSpace > colorSpace)
static SkCachedData * NewCachedData(size_t bytes)
SkISize dimensions() const
const SkYUVAInfo & yuvaInfo() const
size_t computeTotalBytes(size_t planeSizes[kMaxPlanes]=nullptr) const
const SkYUVAInfo & yuvaInfo() const
static SkYUVAPixmaps FromExternalMemory(const SkYUVAPixmapInfo &, void *memory)
static void Add(uint32_t genID, SkCachedData *data, const SkYUVAPixmaps &pixmaps, SkResourceCache *localCache=nullptr)
static SkCachedData * FindAndRef(uint32_t genID, SkYUVAPixmaps *pixmaps, SkResourceCache *localCache=nullptr)
void reset(T *ptr=nullptr)
SK_API sk_sp< SkImage > DeferredFromGenerator(std::unique_ptr< SkImageGenerator > imageGenerator)
static SkBitmapCacheDesc Make(const SkImage *)
SkImageInfo makeColorSpace(sk_sp< SkColorSpace > cs) const
SkColorType colorType() const
SkImageInfo makeColorType(SkColorType newColorType) const
sk_sp< SharedGenerator > fSharedGenerator
Validator(sk_sp< SharedGenerator >, const SkColorType *, sk_sp< SkColorSpace >)
std::shared_ptr< const fml::Mapping > data