Since PIEX can now return an uncompressed RGB thumbnail, check the type of the image...
authoryujieqin <yujieqin@google.com>
Thu, 14 Apr 2016 14:04:00 +0000 (07:04 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 14 Apr 2016 14:04:00 +0000 (07:04 -0700)
Highlights of new PIEX:
* PIEX can now return JPEG compressed image or uncompressed RGB image
* Add IsOfType() and GEtNumberofBytesForIsOfType() to image_type_recognition_lite
* Add GetDngInformation() and GetOrientation() to piex
* Remove deprecated data entries from piex_types

BUG=b/27214608, b/28119810
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1883783002

Review URL: https://codereview.chromium.org/1883783002

DEPS
src/codec/SkRawCodec.cpp

diff --git a/DEPS b/DEPS
index 9fe4f6d..6c7ed58 100644 (file)
--- 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
index 762e823..ef8ba70 100644 (file)
@@ -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.