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

Unified Diff: src/utils/SkTextureCompressor.cpp

Issue 330453005: Texture compression unit tests along with a couple of bug fixes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comment Created 6 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 | « gyp/tests.gypi ('k') | tests/TextureCompressionTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkTextureCompressor.cpp
diff --git a/src/utils/SkTextureCompressor.cpp b/src/utils/SkTextureCompressor.cpp
index adbaef6515d8463a36dcb79b61178651731ee75d..5ef1ae39fcebe31f8c4b96f98c15e019b4e1fb4d 100644
--- a/src/utils/SkTextureCompressor.cpp
+++ b/src/utils/SkTextureCompressor.cpp
@@ -109,7 +109,7 @@ static uint64_t compress_latc_block(uint8_t block[16]) {
// bottom 48 (16*3) bits.
uint32_t accumError[2] = { 0, 0 };
uint64_t indices[2] = { 0, 0 };
- for (int i = 15; i >= 0; ++i) {
+ for (int i = 15; i >= 0; --i) {
// For each palette:
// 1. Retreive the result of this pixel
// 2. Store the error in accumError
@@ -118,7 +118,7 @@ static uint64_t compress_latc_block(uint8_t block[16]) {
uint32_t result = compute_error(block[i], palettes[p]);
accumError[p] += (result >> 8);
indices[p] <<= 3;
- indices[p] |= result & ~7;
+ indices[p] |= result & 7;
}
}
@@ -191,6 +191,8 @@ namespace SkTextureCompressor {
typedef SkData *(*CompressBitmapProc)(const SkBitmap &bitmap);
SkData *CompressBitmapToFormat(const SkBitmap &bitmap, Format format) {
+ SkAutoLockPixels alp(bitmap);
+
CompressBitmapProc kProcMap[kLastEnum_SkColorType + 1][kFormatCnt];
memset(kProcMap, 0, sizeof(kProcMap));
« no previous file with comments | « gyp/tests.gypi ('k') | tests/TextureCompressionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698