Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: src/gpu/SkGr.cpp

Issue 2088883002: Never use CPU-built mips for Gray_8. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698