aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--DEPS2
-rw-r--r--src/codec/SkRawCodec.cpp6
2 files changed, 6 insertions, 2 deletions
diff --git a/DEPS b/DEPS
index 9fe4f6d57d..6c7ed582e5 100644
--- a/DEPS
+++ b/DEPS
@@ -22,7 +22,7 @@ deps = {
"third_party/externals/giflib" : "https://android.googlesource.com/platform/external/giflib.git@ab10e256df4f684260ca239905b1cec727181f6c",
"third_party/externals/dng_sdk" : "https://android.googlesource.com/platform/external/dng_sdk.git@e95f96bb9d29978211250ee764ba78731ad316df",
- "third_party/externals/piex" : "https://android.googlesource.com/platform/external/piex.git@883a1e5419990f51b8e928969e9c5a09869bce0e",
+ "third_party/externals/piex" : "https://android.googlesource.com/platform/external/piex.git@be908191d0a6883a95333bdc0bca749c9b830969",
"third_party/externals/libjpeg-turbo" : "https://skia.googlesource.com/third_party/libjpeg-turbo.git@b38b934d246fca482eb6801f4ce79422954a635e",
# libjpeg-turbo depends on yasm to compile .asm files
diff --git a/src/codec/SkRawCodec.cpp b/src/codec/SkRawCodec.cpp
index 762e82364c..ef8ba700a4 100644
--- a/src/codec/SkRawCodec.cpp
+++ b/src/codec/SkRawCodec.cpp
@@ -640,7 +640,11 @@ SkCodec* SkRawCodec::NewFromStream(SkStream* stream) {
if (::piex::IsRaw(&piexStream)) {
::piex::Error error = ::piex::GetPreviewImageData(&piexStream, &imageData);
- if (error == ::piex::Error::kOk && imageData.preview.length > 0) {
+ // Theoretically PIEX can return JPEG compressed image or uncompressed RGB image. We only
+ // handle the JPEG compressed preview image here.
+ if (error == ::piex::Error::kOk && imageData.preview.length > 0 &&
+ imageData.preview.format == ::piex::Image::kJpegCompressed)
+ {
// transferBuffer() is destructive to the rawStream. Abandon the rawStream after this
// function call.
// FIXME: one may avoid the copy of memoryStream and use the buffered rawStream.