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

Unified Diff: src/gpu/SkGr.cpp

Issue 673883002: When bmp is not cached don't upload as index8 format. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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 e7d4ea121f23d7ca45b47130c10563d3dec7f114..2f21f7db9018d25b8739ff95458de32858716ed7 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -34,7 +34,7 @@
Ganesh wants a full 256 palette entry, even though Skia's ctable is only as big
as the colortable.count says it is.
*/
-static void build_compressed_data(void* buffer, const SkBitmap& bitmap) {
+static void build_index8_data(void* buffer, const SkBitmap& bitmap) {
SkASSERT(kIndex_8_SkColorType == bitmap.colorType());
SkAutoLockPixels alp(bitmap);
@@ -308,12 +308,12 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx,
if (kIndex_8_SkColorType == bitmap->colorType()) {
// build_compressed_data doesn't do npot->pot expansion
// and paletted textures can't be sub-updated
- if (ctx->supportsIndex8PixelConfig(params, bitmap->width(), bitmap->height())) {
+ if (cache && ctx->supportsIndex8PixelConfig(params, bitmap->width(), bitmap->height())) {
size_t imageSize = GrCompressedFormatDataSize(kIndex_8_GrPixelConfig,
bitmap->width(), bitmap->height());
SkAutoMalloc storage(imageSize);
robertphillips 2014/10/24 12:15:47 Is this memset necessary?
bsalomon 2014/10/24 13:46:07 Oops, no, leftover from debugging something.
-
- build_compressed_data(storage.get(), origBitmap);
+ memset(storage.get(), 0xff, imageSize);
+ build_index8_data(storage.get(), origBitmap);
// our compressed data will be trimmed, so pass width() for its
// "rowBytes", since they are the same now.
« 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