diff options
author | 2014-10-24 12:42:51 -0700 | |
---|---|---|
committer | 2014-10-24 12:42:51 -0700 | |
commit | e79a2dab91a90e26b13bc1ec9b8c6264a1ab22e4 (patch) | |
tree | b25a699e0a2c5b70161ea685f3f6bc7c8ecc4117 /src/gpu | |
parent | 0deb2d9c5d62f8c16fa6049902f9346af735b496 (diff) |
When bmp is not cached don't upload as index8 format.
Review URL: https://codereview.chromium.org/673883002
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/SkGr.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index e7d4ea121f..f9bdd8e45b 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,11 @@ 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); - - build_compressed_data(storage.get(), origBitmap); + build_index8_data(storage.get(), origBitmap); // our compressed data will be trimmed, so pass width() for its // "rowBytes", since they are the same now. |