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

Unified Diff: src/gpu/SkGr.cpp

Issue 457333004: Consider index8 a compressed config. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 6 years, 4 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 | « src/gpu/GrTexture.cpp ('k') | src/gpu/gl/GrGpuGL.cpp » ('j') | 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 0a45100521232f1ac26dca6b5cac96a1ec6277ff..308c3fe7ab8b25c94888bc203c90a432981c5110 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -65,7 +65,7 @@ static void build_compressed_data(void* buffer, const SkBitmap& bitmap) {
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 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx,
// 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);
« no previous file with comments | « src/gpu/GrTexture.cpp ('k') | src/gpu/gl/GrGpuGL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698