Add mock config to tools and run through gms and benchs without crashing.
Change-Id: I7e2474129ef2b15899ad2baeb8d18f39d05da98c
Reviewed-on: https://skia-review.googlesource.com/21820
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 1d6319e..456a080 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -323,15 +323,24 @@
int width, int height,
GrPixelConfig config,
GrBackendObject handle) {
+ switch (backend) {
+ case kOpenGL_GrBackend: {
+ const GrGLTextureInfo* glInfo = (const GrGLTextureInfo*)(handle);
+ return GrBackendTexture(width, height, config, *glInfo);
+ }
#ifdef SK_VULKAN
- if (kVulkan_GrBackend == backend) {
- GrVkImageInfo* vkInfo = (GrVkImageInfo*)(handle);
- return GrBackendTexture(width, height, *vkInfo);
- }
+ case kVulkan_GrBackend: {
+ const GrVkImageInfo* vkInfo = (const GrVkImageInfo*)(handle);
+ return GrBackendTexture(width, height, *vkInfo);
+ }
#endif
- SkASSERT(kOpenGL_GrBackend == backend);
- GrGLTextureInfo* glInfo = (GrGLTextureInfo*)(handle);
- return GrBackendTexture(width, height, config, *glInfo);
+ case kMock_GrBackend: {
+ const GrMockTextureInfo* mockInfo = (const GrMockTextureInfo*)(handle);
+ return GrBackendTexture(width, height, config, *mockInfo);
+ }
+ default:
+ return GrBackendTexture();
+ }
}
static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpace colorSpace,