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 <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2018-03-14 15:51:58 -04:00 committed by Skia Commit-Bot
parent 7e6dafdfed
commit 057627f6f1
2 changed files with 5 additions and 3 deletions

View File

@ -149,6 +149,7 @@ private:
friend class GrGpu;
friend class GrGLGpu;
friend class GrVkGpu;
friend class PromiseImageHelper;
GrPixelConfig config() const { return fConfig; }
int fWidth; //<! width in pixels

View File

@ -594,7 +594,7 @@ public:
this->resetReleaseHelper();
}
sk_sp<GrTexture> getTexture(GrResourceProvider* resourceProvider) {
sk_sp<GrTexture> 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<GrTexture> 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> SkImage_Gpu::MakePromiseTexture(GrContext* context,
PromiseImageHelper promiseHelper(textureFulfillProc, textureReleaseProc, textureContext);
sk_sp<GrTextureProxy> proxy = proxyProvider->createLazyProxy(
[promiseHelper] (GrResourceProvider* resourceProvider) mutable {
[promiseHelper, config] (GrResourceProvider* resourceProvider) mutable {
if (!resourceProvider) {
promiseHelper.reset();
return sk_sp<GrTexture>();
}
return promiseHelper.getTexture(resourceProvider);
return promiseHelper.getTexture(resourceProvider, config);
}, desc, origin, mipMapped, GrRenderTargetFlags::kNone, SkBackingFit::kExact,
SkBudgeted::kNo, GrSurfaceProxy::LazyInstantiationType::kUninstantiate);