diff options
author | yujieqin <yujieqin@google.com> | 2016-04-14 07:04:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-14 07:04:00 -0700 |
commit | e34635dee169b8710141d6d0841db1e2bde9626b (patch) | |
tree | d7b20e199f1d35129a3f2538a12b1e8899424785 /src/codec/SkRawCodec.cpp | |
parent | 5280dcbae3affd73be5d5e0ff3db8823e26901e6 (diff) |
Since PIEX can now return an uncompressed RGB thumbnail, check the type of the image before treating it as a JPEG.
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
Diffstat (limited to 'src/codec/SkRawCodec.cpp')
-rw-r--r-- | src/codec/SkRawCodec.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
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. |