29 const Caps* caps = context->priv().caps();
37 std::unique_ptr<Recorder> recorder = context->makeRecorder();
40 kValidColorType, Mipmapped::kNo, isProtected, Renderable::kNo);
41 BackendTexture backendTexture = recorder->createBackendTexture(kValidSize, textureInfo);
47 isProtected, renderable);
49 dimensions, textureInfo, budgeted);
58 return assignableTexture;
63 textureProxy = makeProxy(kInvalidSize,
70 textureProxy = makeProxy(kValidSize,
79 textureProxy = makeProxy(kValidSize,
92 textureProxy = makeProxy(kValidSize,
104 bool instantiateSuccess = textureProxy->instantiate(resourceProvider);
108 const Texture* createdTexture = textureProxy->texture();
110 instantiateSuccess = textureProxy->instantiate(resourceProvider);
121 instantiateSuccess = textureProxy->lazyInstantiate(resourceProvider);
129 instantiateSuccess = textureProxy->lazyInstantiate(resourceProvider);
140 instantiateSuccess = textureProxy->lazyInstantiate(resourceProvider);
148 instantiateSuccess = textureProxy->lazyInstantiate(resourceProvider);
152 textureProxy->deinstantiate();
163 instantiateSuccess = textureProxy->lazyInstantiate(resourceProvider);
169 textureProxy->deinstantiate();
175 recorder->createBackendTexture(kLargerSize, textureInfo);
177 instantiateSuccess = textureProxy->lazyInstantiate(resourceProvider);
182 textureProxy = makeProxy(kValidSize,
196 recorder->deleteBackendTexture(backendTexture);
197 recorder->deleteBackendTexture(largerBackendTexture);
223 class FulfillContext {
225 FulfillContext(
BackendTexture backendTexture) : fBackendTexture(backendTexture) {}
227 static std::tuple<BackendTexture, void*> Fulfill(
void* ctx) {
228 FulfillContext*
self =
reinterpret_cast<FulfillContext*
>(ctx);
229 return {
self->fBackendTexture,
nullptr};
235 std::unique_ptr<Recorder> recorder = context->makeRecorder();
236 const Caps* caps = context->priv().caps();
242 for (
const SkISize& dimensions : {largeDimensions, negativeDimensions}) {
251 recorder->createBackendTexture(imageInfo.
dimensions(), textureInfo);
252 FulfillContext fulfillContext(backendTexture);
265 FulfillContext::Fulfill,
270 surface->getCanvas()->drawImage(promiseImage, 0.0f, 0.0f);
271 std::unique_ptr<Recording> recording = recorder->snap();
274 context->deleteBackendTexture(fulfillContext.fBackendTexture);
static bool InstantiateIfNotLazy(ResourceProvider *, TextureProxy *)
static sk_sp< TextureProxy > Make(const Caps *, ResourceProvider *, SkISize dimensions, const TextureInfo &, skgpu::Budgeted)
static sk_sp< TextureProxy > MakeFullyLazy(const TextureInfo &, skgpu::Budgeted, Volatile, LazyInstantiateCallback &&)
static sk_sp< TextureProxy > MakeLazy(const Caps *, SkISize dimensions, const TextureInfo &, skgpu::Budgeted, Volatile, LazyInstantiateCallback &&)