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

Unified Diff: src/utils/SkTextureCompressor_ASTC.cpp

Issue 444093002: - Add astcbitmap to gm slides (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Decode trits/quints into temp buffers 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
Index: src/utils/SkTextureCompressor_ASTC.cpp
diff --git a/src/utils/SkTextureCompressor_ASTC.cpp b/src/utils/SkTextureCompressor_ASTC.cpp
index fbae8504e50fe225b3fd70dd70f07cef9f381b76..91d594a11313ed00354e5d4c46a2a575c6cd3598 100644
--- a/src/utils/SkTextureCompressor_ASTC.cpp
+++ b/src/utils/SkTextureCompressor_ASTC.cpp
@@ -793,7 +793,11 @@ static bool decode_integer_sequence(
endBlockBit = endBit;
}
- decode_trit_block(dst, nBits, read_astc_bits(src, startBit, endBlockBit));
+ // Trit blocks are three values large.
+ int trits[5];
+ decode_trit_block(trits, nBits, read_astc_bits(src, startBit, endBlockBit));
+ memcpy(dst, trits, SkMin32(nVals, 5)*sizeof(int));
+
dst += 5;
nVals -= 5;
startBit = endBlockBit;
@@ -806,7 +810,11 @@ static bool decode_integer_sequence(
endBlockBit = endBit;
}
- decode_quint_block(dst, nBits, read_astc_bits(src, startBit, endBlockBit));
+ // Quint blocks are three values large
+ int quints[3];
+ decode_quint_block(quints, nBits, read_astc_bits(src, startBit, endBlockBit));
+ memcpy(dst, quints, SkMin32(nVals, 3)*sizeof(int));
+
dst += 3;
nVals -= 3;
startBit = endBlockBit;
@@ -1708,7 +1716,8 @@ struct ASTCDecompressionData {
// The rest of the CEM config will be between the dual plane bit selector
// and the texel weight grid.
const int lowCEM = static_cast<int>(read_astc_bits(fBlock, 23, 29));
- SkASSERT(lastWeight - dualPlaneBitLoc > 31);
+ SkASSERT(lastWeight >= dualPlaneBitLoc);
+ SkASSERT(lastWeight - dualPlaneBitLoc < 31);
int fullCEM = static_cast<int>(read_astc_bits(fBlock, dualPlaneBitLoc, lastWeight));
// Attach the config at the end of the weight grid to the CEM values

Powered by Google App Engine
This is Rietveld 408576698