Consider index8 a compressed config.
R=krajcevski@google.com, robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/457333004
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 0a45100..308c3fe 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -65,7 +65,7 @@
ctable->unlockColors();
// always skip a full 256 number of entries, even if we memcpy'd fewer
- dst += kGrColorTableSize;
+ dst += 256 * sizeof(GrColor);
if ((unsigned)bitmap.width() == bitmap.rowBytes()) {
memcpy(dst, bitmap.getPixels(), bitmap.getSize());
@@ -285,8 +285,9 @@
// 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())) {
- size_t imagesize = bitmap->width() * bitmap->height() + kGrColorTableSize;
- SkAutoMalloc storage(imagesize);
+ size_t imageSize = GrCompressedFormatDataSize(kIndex_8_GrPixelConfig,
+ bitmap->width(), bitmap->height());
+ SkAutoMalloc storage(imageSize);
build_compressed_data(storage.get(), origBitmap);