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

Unified Diff: src/images/SkImageDecoder_ktx.cpp

Issue 440783004: Add support for all compressed formats in KTX file format (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix boolean stuff 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/SkGr.cpp ('k') | src/utils/SkTextureCompressor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder_ktx.cpp
diff --git a/src/images/SkImageDecoder_ktx.cpp b/src/images/SkImageDecoder_ktx.cpp
index 058ab7264695cb8c6cfb7274f2d0a87646850ee6..c06450c6315bf08df8c20a9967500f58623c60de 100644
--- a/src/images/SkImageDecoder_ktx.cpp
+++ b/src/images/SkImageDecoder_ktx.cpp
@@ -105,7 +105,7 @@ bool SkKTXImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
// Lock the pixels, since we're about to write to them...
SkAutoLockPixels alp(*bm);
- if (ktxFile.isETC1()) {
+ if (ktxFile.isCompressedFormat(SkTextureCompressor::kETC1_Format)) {
if (!sampler.begin(bm, SkScaledBitmapSampler::kRGB, *this)) {
return false;
}
@@ -113,11 +113,12 @@ bool SkKTXImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
// ETC1 Data is encoded as RGB pixels, so we should extract it as such
int nPixels = width * height;
SkAutoMalloc outRGBData(nPixels * 3);
- etc1_byte *outRGBDataPtr = reinterpret_cast<etc1_byte *>(outRGBData.get());
+ uint8_t *outRGBDataPtr = reinterpret_cast<uint8_t *>(outRGBData.get());
// Decode ETC1
- const etc1_byte *buf = reinterpret_cast<const etc1_byte *>(ktxFile.pixelData());
- if (etc1_decode_image(buf, outRGBDataPtr, width, height, 3, width*3)) {
+ const uint8_t *buf = reinterpret_cast<const uint8_t *>(ktxFile.pixelData());
+ if (!SkTextureCompressor::DecompressBufferFromFormat(
+ outRGBDataPtr, width*3, buf, width, height, SkTextureCompressor::kETC1_Format)) {
return false;
}
« no previous file with comments | « src/gpu/SkGr.cpp ('k') | src/utils/SkTextureCompressor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698