From 7f4419696b8ef299a321561336c0353a5a7d8e61 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Thu, 15 Mar 2018 11:15:19 -0400 Subject: Make CreateBackendFormatFromTexture shared code TBR=bsalomon@google.com Change-Id: I19e6e6c8dc32ba584738545d443de092e4987a5a Reviewed-on: https://skia-review.googlesource.com/114374 Reviewed-by: Robert Phillips Reviewed-by: Greg Daniel Commit-Queue: Robert Phillips --- dm/DMSrcSink.cpp | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'dm/DMSrcSink.cpp') diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 7256348632..9b68dc99cf 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -1254,31 +1254,6 @@ public: SkDeferredDisplayListRecorder* fRecorder; }; -// duplicate of method in GrTest.cpp -GrBackendFormat CreateBackendFormatFromTexture(const GrBackendTexture& tex) { - switch (tex.backend()) { -#ifdef SK_VULKAN - case kVulkan_GrBackend: { - const GrVkImageInfo* vkInfo = tex.getVkImageInfo(); - SkASSERT(vkInfo); - return GrBackendFormat::MakeVk(vkInfo->fFormat); - } -#endif - case kOpenGL_GrBackend: { - const GrGLTextureInfo* glInfo = tex.getGLTextureInfo(); - SkASSERT(glInfo); - return GrBackendFormat::MakeGL(glInfo->fFormat, glInfo->fTarget); - } - case kMock_GrBackend: { - const GrMockTextureInfo* mockInfo = tex.getMockTextureInfo(); - SkASSERT(mockInfo); - return GrBackendFormat::MakeMock(mockInfo->fConfig); - } - default: - return GrBackendFormat(); - } -} - // This generates promise images to replace the indices in the compressed picture. This // reconstitution is performed separately in each thread so we end of with multiple // promise image referring to the same GrBackendTexture. @@ -1295,7 +1270,7 @@ static sk_sp promise_image_creator(const void* rawData, size_t length, const PromiseImageInfo& curImage = (*imageInfo)[*indexPtr]; SkASSERT(curImage.fIndex == *indexPtr); - GrBackendFormat backendFormat = CreateBackendFormatFromTexture(curImage.fBackendTexture); + GrBackendFormat backendFormat = curImage.fBackendTexture.format(); // DDL TODO: sort out mipmapping sk_sp image = recorder->makePromiseTexture(backendFormat, -- cgit v1.2.3