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

Unified Diff: src/utils/SkTextureCompressor_ASTC.cpp

Issue 446103002: Pass compressed blitters to our mask drawing algorithm (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update comments 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..fbc2182531623ed690a6e5fe69f5aadb89859612 100644
--- a/src/utils/SkTextureCompressor_ASTC.cpp
+++ b/src/utils/SkTextureCompressor_ASTC.cpp
@@ -2011,9 +2011,24 @@ bool CompressA8To12x12ASTC(uint8_t* dst, const uint8_t* src,
return true;
}
-SkBlitter* CreateASTCBlitter(int width, int height, void* outputBuffer) {
- return new
- SkTCompressedAlphaBlitter<12, 16, CompressA8ASTCBlockVertical>
+SkBlitter* CreateASTCBlitter(int width, int height, void* outputBuffer,
+ SkTBlitterAllocator* allocator) {
+ if ((width % 12) != 0 || (height % 12) != 0) {
+ return NULL;
+ }
+
robertphillips 2014/08/07 13:55:06 Why do we need to zero out here?
krajcevski 2014/08/07 14:48:12 The blitter isn't required to write every row, and
robertphillips 2014/08/07 14:52:23 Can we add a comment re that at each of the three
krajcevski 2014/08/07 15:00:48 Done.
+ // Memset the output buffer to an encoding that decodes to zero...
+ // In the case of ASTC, if everything index is zero, then the interpolated value
+ // will decode to zero provided we have the right header. We use the encoding
+ // from recognizing all zero blocks from above.
+ const int nBlocks = (width * height / 144);
+ uint8_t *dst = reinterpret_cast<uint8_t *>(outputBuffer);
+ for (int i = 0; i < nBlocks; ++i) {
+ send_packing(&dst, SkTEndian_SwapLE64(0x0000000001FE000173ULL), 0);
+ }
+
+ return allocator->createT<
+ SkTCompressedAlphaBlitter<12, 16, CompressA8ASTCBlockVertical>, int, int, void* >
(width, height, outputBuffer);
}

Powered by Google App Engine
This is Rietveld 408576698