29 const Caps* caps = context->priv().caps();
37 std::unique_ptr<Recorder> recorder = context->makeRecorder();
41 BackendTexture backendTexture = recorder->createBackendTexture(kValidSize, textureInfo);
43 "TextureProxyTestWrappedTex");
48 isProtected, renderable);
50 dimensions, textureInfo,
"TextureProxyTestTexture", budgeted);
59 return assignableTexture;
64 textureProxy = makeProxy(kInvalidSize,
71 textureProxy = makeProxy(kValidSize,
80 textureProxy = makeProxy(kValidSize,
93 textureProxy = makeProxy(kValidSize,
105 bool instantiateSuccess = textureProxy->instantiate(resourceProvider);
109 const Texture* createdTexture = textureProxy->texture();
111 instantiateSuccess = textureProxy->instantiate(resourceProvider);
122 instantiateSuccess = textureProxy->lazyInstantiate(resourceProvider);
130 instantiateSuccess = textureProxy->lazyInstantiate(resourceProvider);
141 instantiateSuccess = textureProxy->lazyInstantiate(resourceProvider);
149 instantiateSuccess = textureProxy->lazyInstantiate(resourceProvider);
153 textureProxy->deinstantiate();
164 instantiateSuccess = textureProxy->lazyInstantiate(resourceProvider);
170 textureProxy->deinstantiate();
176 recorder->createBackendTexture(kLargerSize, textureInfo);
178 "TextureProxyTestWrappedTex");
179 instantiateSuccess = textureProxy->lazyInstantiate(resourceProvider);
184 textureProxy = makeProxy(kValidSize,
198 recorder->deleteBackendTexture(backendTexture);
199 recorder->deleteBackendTexture(largerBackendTexture);
204 std::unique_ptr<Recorder> recorder = context->makeRecorder();
205 const Caps* caps = context->priv().caps();
225 class FulfillContext {
227 FulfillContext(
BackendTexture backendTexture) : fBackendTexture(backendTexture) {}
229 static std::tuple<BackendTexture, void*> Fulfill(
void* ctx) {
230 FulfillContext*
self =
reinterpret_cast<FulfillContext*
>(ctx);
231 return {
self->fBackendTexture,
nullptr};
237 std::unique_ptr<Recorder> recorder = context->makeRecorder();
238 const Caps* caps = context->priv().caps();
244 for (
const SkISize& dimensions : {largeDimensions, negativeDimensions}) {
253 recorder->createBackendTexture(imageInfo.
dimensions(), textureInfo);
254 FulfillContext fulfillContext(backendTexture);
267 FulfillContext::Fulfill,
272 surface->getCanvas()->drawImage(promiseImage, 0.0f, 0.0f);
273 std::unique_ptr<Recording> recording = recorder->snap();
276 context->deleteBackendTexture(fulfillContext.fBackendTexture);
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kUnknown_SkColorType
uninitialized
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
#define REPORTER_ASSERT(r, cond,...)
SkColorType colorType() const
bool protectedSupport() const
virtual TextureInfo getDefaultSampledTextureInfo(SkColorType, Mipmapped mipmapped, Protected, Renderable) const =0
int maxTextureSize() const
sk_sp< Texture > createWrappedTexture(const BackendTexture &, std::string_view label)
static bool InstantiateIfNotLazy(ResourceProvider *, TextureProxy *)
static sk_sp< TextureProxy > Make(const Caps *, ResourceProvider *, SkISize dimensions, const TextureInfo &, std::string_view label, 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 &&)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
SK_API sk_sp< SkImage > PromiseTextureFrom(skgpu::graphite::Recorder *, SkISize dimensions, const skgpu::graphite::TextureInfo &, const SkColorInfo &, skgpu::Origin origin, skgpu::graphite::Volatile, GraphitePromiseTextureFulfillProc, GraphitePromiseImageReleaseProc, GraphitePromiseTextureReleaseProc, GraphitePromiseImageContext, std::string_view label={})
SK_API sk_sp< SkImage > TextureFromImage(GrDirectContext *, const SkImage *, skgpu::Mipmapped=skgpu::Mipmapped::kNo, skgpu::Budgeted=skgpu::Budgeted::kYes)
SK_API sk_sp< SkImage > RasterFromBitmap(const SkBitmap &bitmap)
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
DEF_GRAPHITE_TEST_FOR_ALL_CONTEXTS(DeviceTestVertexTransparency, reporter, context, CtsEnforcement::kNextRelease)
static constexpr SkISize MakeEmpty()
static constexpr SkISize Make(int32_t w, int32_t h)
const SkColorInfo & colorInfo() const
SkISize dimensions() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)