From 21a99d42c34f44dac4a71cace9572dc244cad583 Mon Sep 17 00:00:00 2001 From: Justin Novosad Date: Tue, 17 Jul 2018 16:53:43 -0400 Subject: Fix validity check in SkSurface::MakeFromBackendTextureAsRenderTarget Swaped the order of validate_backend_texture() and SkSurface_Gpu::Valid() so that the pixel config computed by validate_backend_texture() get used by SkSurface_Gpu::Valid(). This makes the behavior of this method consistent with the behavior of sister method MakeFromBackendTexture() BUG=788439 Change-Id: I132ea8da23430ea99bbeabce79b08edb6b4cae03 Reviewed-on: https://skia-review.googlesource.com/141837 Commit-Queue: Justin Novosad Reviewed-by: Justin Novosad Reviewed-by: Greg Daniel Auto-Submit: Justin Novosad --- src/image/SkSurface_Gpu.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/image') diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index 2e55ffd336..57894c2b9b 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -536,10 +536,7 @@ sk_sp SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* cont if (!context) { return nullptr; } - if (!tex.isValid() || - !SkSurface_Gpu::Valid(context->contextPriv().caps(), tex.config(), colorSpace.get())) { - return nullptr; - } + sampleCnt = SkTMax(1, sampleCnt); GrBackendTexture texCopy = tex; if (!validate_backend_texture(context, texCopy, &texCopy.fConfig, @@ -547,6 +544,10 @@ sk_sp SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* cont return nullptr; } + if (!SkSurface_Gpu::Valid(context->contextPriv().caps(), texCopy.config(), colorSpace.get())) { + return nullptr; + } + sk_sp rtc( context->contextPriv().makeBackendTextureAsRenderTargetRenderTargetContext( texCopy, -- cgit v1.2.3