8#ifndef PromiseImageHelper_DEFINED
9#define PromiseImageHelper_DEFINED
50 return fPromiseImageTexture;
61 return fPromiseImageTexture.
get();
66 return callbackContext->
fulfill();
72 callbackContext->unref();
80 int fTotalFulfills = 0;
110 : fSupportedYUVADataTypes(supportedYUVADataTypes) {}
123 fPromiseImages.
clear();
140 int index()
const {
return fIndex; }
141 uint32_t originalUniqueID()
const {
return fOriginalUniqueID; }
142 bool isYUV()
const {
return fYUVAPixmaps.isValid(); }
144 SkISize overallDimensions()
const {
return fImageInfo.dimensions(); }
145 SkColorType overallColorType()
const {
return fImageInfo.colorType(); }
146 SkAlphaType overallAlphaType()
const {
return fImageInfo.alphaType(); }
149 const SkYUVAInfo& yuvaInfo()
const {
return fYUVAPixmaps.yuvaInfo(); }
151 const SkPixmap& yuvPixmap(
int index)
const {
153 return fYUVAPixmaps.planes()[index];
162 std::unique_ptr<SkPixmap[]> normalMipLevels()
const;
163 int numMipLevels()
const;
167 fCallbackContexts[index] = callbackContext;
171 return fCallbackContexts[index].get();
175 return fCallbackContexts[index];
186 return fCallbackContexts[index]->backendFormat();
190 return fCallbackContexts[index]->promiseImageTexture();
193 void setMipLevels(
const SkBitmap& baseLevel, std::unique_ptr<SkMipmap> mipLevels);
196 void setYUVPlanes(
SkYUVAPixmaps yuvaPixmaps) { fYUVAPixmaps = std::move(yuvaPixmaps); }
200 const uint32_t fOriginalUniqueID;
206 std::unique_ptr<SkMipmap> fMipLevels;
215 struct DeserialImageProcContext {
225 bool isValidID(
int id)
const {
return id >= 0 &&
id < fImageInfo.
size(); }
sk_sp< SkPicture > recreateSKP(GrDirectContext *, SkPicture *)
~DDLPromiseImageHelper()=default
void deleteAllFromGPU(SkTaskGroup *, GrDirectContext *)
void uploadAllToGPU(SkTaskGroup *, GrDirectContext *)
DDLPromiseImageHelper(const SkYUVAPixmapInfo::SupportedDataTypes &supportedYUVADataTypes)
~PromiseImageCallbackContext() override
PromiseImageCallbackContext(GrDirectContext *direct, GrBackendFormat backendFormat)
static sk_sp< GrPromiseImageTexture > PromiseImageFulfillProc(void *textureContext)
const GrBackendFormat & backendFormat() const
void destroyBackendTexture()
sk_sp< GrPromiseImageTexture > fulfill()
void setBackendTexture(const GrBackendTexture &backendTexture)
static void PromiseImageReleaseProc(void *textureContext)
const GrPromiseImageTexture * promiseImageTexture() const
static constexpr int kMaxPlanes
sk_sp< const SkImage > image