From 057627f6f16a8c2854f86f7409fd1ed5095fd968 Mon Sep 17 00:00:00 2001 From: Greg Daniel Date: Wed, 14 Mar 2018 15:51:58 -0400 Subject: [PATCH] Make sure we set correct GrPixelConfig in promise images Land just the Promise image fixes from, https://skia-review.googlesource.com/c/skia/+/114261 Bug: skia: Change-Id: I917cf2c1f5c6e51f9d7f1d3ec4526db551e89d84 Reviewed-on: https://skia-review.googlesource.com/114472 Reviewed-by: Robert Phillips Commit-Queue: Greg Daniel --- include/gpu/GrBackendSurface.h | 1 + src/image/SkImage_Gpu.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/gpu/GrBackendSurface.h b/include/gpu/GrBackendSurface.h index 0145dc44c0..76714eca0f 100644 --- a/include/gpu/GrBackendSurface.h +++ b/include/gpu/GrBackendSurface.h @@ -149,6 +149,7 @@ private: friend class GrGpu; friend class GrGLGpu; friend class GrVkGpu; + friend class PromiseImageHelper; GrPixelConfig config() const { return fConfig; } int fWidth; //resetReleaseHelper(); } - sk_sp getTexture(GrResourceProvider* resourceProvider) { + sk_sp getTexture(GrResourceProvider* resourceProvider, GrPixelConfig config) { // Releases the promise helper if there are no outstanding hard refs. This means that we // don't have any ReleaseProcs waiting to be called so we will need to do a fulfill. if (fReleaseHelper && fReleaseHelper->weak_expired()) { @@ -604,6 +604,7 @@ public: sk_sp tex; if (!fReleaseHelper) { fFulfillProc(fContext, &fBackendTex); + fBackendTex.fConfig = config; if (!fBackendTex.isValid()) { // Even though the GrBackendTexture is not valid, we must call the release // proc to keep our contract of always calling Fulfill and Release in pairs. @@ -705,13 +706,13 @@ sk_sp SkImage_Gpu::MakePromiseTexture(GrContext* context, PromiseImageHelper promiseHelper(textureFulfillProc, textureReleaseProc, textureContext); sk_sp proxy = proxyProvider->createLazyProxy( - [promiseHelper] (GrResourceProvider* resourceProvider) mutable { + [promiseHelper, config] (GrResourceProvider* resourceProvider) mutable { if (!resourceProvider) { promiseHelper.reset(); return sk_sp(); } - return promiseHelper.getTexture(resourceProvider); + return promiseHelper.getTexture(resourceProvider, config); }, desc, origin, mipMapped, GrRenderTargetFlags::kNone, SkBackingFit::kExact, SkBudgeted::kNo, GrSurfaceProxy::LazyInstantiationType::kUninstantiate);