Index: src/gpu/SkGr.cpp |
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp |
index f937b16d55e166f0d1481186752e4507a2ed4816..1e4ff527520e6e680cae0df80d5dc976878e9a6e 100644 |
--- a/src/gpu/SkGr.cpp |
+++ b/src/gpu/SkGr.cpp |
@@ -349,6 +349,15 @@ GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext* ctx, const SkBitmap& b |
return texture.release(); |
} |
+ // We don't support Gray8 directly in the GL backend, so fail-over to GrUploadBitmapToTexture. |
+ // That will transform the Gray8 to 8888, then use the driver/GPU to build mipmaps. If we build |
+ // the mips on the CPU here, they'll all be Gray8, which isn't useful. (They get treated as A8). |
+ // TODO: A better option might be to transform the initial bitmap here to 8888, then run the |
+ // CPU mip-mapper on that data before uploading. This is much less code for a rare case though: |
+ if (kGray_8_SkColorType == bitmap.colorType()) { |
bsalomon
2016/06/21 18:57:40
Chris, I think we'll a similar failure mode for th
|
+ return nullptr; |
+ } |
+ |
SkASSERT(sizeof(int) <= sizeof(uint32_t)); |
if (bitmap.width() < 0 || bitmap.height() < 0) { |
return nullptr; |