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

Side by Side Diff: src/codec/SkRawCodec.cpp

Issue 1883783002: Update PIEX version and adjust the RAW codec accordingly (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« DEPS ('K') | « DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkCodec.h" 8 #include "SkCodec.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 } else { 633 } else {
634 rawStream.reset(new SkRawBufferedStream(stream)); 634 rawStream.reset(new SkRawBufferedStream(stream));
635 } 635 }
636 636
637 // Does not take the ownership of rawStream. 637 // Does not take the ownership of rawStream.
638 SkPiexStream piexStream(rawStream.get()); 638 SkPiexStream piexStream(rawStream.get());
639 ::piex::PreviewImageData imageData; 639 ::piex::PreviewImageData imageData;
640 if (::piex::IsRaw(&piexStream)) { 640 if (::piex::IsRaw(&piexStream)) {
641 ::piex::Error error = ::piex::GetPreviewImageData(&piexStream, &imageDat a); 641 ::piex::Error error = ::piex::GetPreviewImageData(&piexStream, &imageDat a);
642 642
643 if (error == ::piex::Error::kOk && imageData.preview.length > 0) { 643 // PIEX can return JPEG compressed image or uncompressed RGB image. We o nly handle the JPEG
scroggo 2016/04/13 12:20:23 I'm confused. What is the "uncompressed RGB image"
yujieqin 2016/04/13 13:11:29 There are two kind of thumbnails image can be embe
scroggo 2016/04/13 15:54:31 Ah, this probably is more obvious to someone who i
yujieqin 2016/04/14 07:54:59 Actually it is not only for "thumbnail". Theoretic
scroggo 2016/04/14 13:24:24 Ah, thanks for clarifying.
644 // compressed case for now.
645 if (error == ::piex::Error::kOk && imageData.preview.length > 0 &&
646 imageData.preview.format == ::piex::Image::kJpegCompressed)
647 {
644 // transferBuffer() is destructive to the rawStream. Abandon the raw Stream after this 648 // transferBuffer() is destructive to the rawStream. Abandon the raw Stream after this
645 // function call. 649 // function call.
646 // FIXME: one may avoid the copy of memoryStream and use the buffere d rawStream. 650 // FIXME: one may avoid the copy of memoryStream and use the buffere d rawStream.
647 SkMemoryStream* memoryStream = 651 SkMemoryStream* memoryStream =
648 rawStream->transferBuffer(imageData.preview.offset, imageData.pr eview.length); 652 rawStream->transferBuffer(imageData.preview.offset, imageData.pr eview.length);
649 return memoryStream ? SkJpegCodec::NewFromStream(memoryStream) : nul lptr; 653 return memoryStream ? SkJpegCodec::NewFromStream(memoryStream) : nul lptr;
650 } else if (error == ::piex::Error::kFail) { 654 } else if (error == ::piex::Error::kFail) {
651 return nullptr; 655 return nullptr;
652 } 656 }
653 } 657 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 SkISize sizeFloor = this->onGetScaledDimensions(1.f / std::floor(fullShortEd ge / shortEdge)); 759 SkISize sizeFloor = this->onGetScaledDimensions(1.f / std::floor(fullShortEd ge / shortEdge));
756 SkISize sizeCeil = this->onGetScaledDimensions(1.f / std::ceil(fullShortEdge / shortEdge)); 760 SkISize sizeCeil = this->onGetScaledDimensions(1.f / std::ceil(fullShortEdge / shortEdge));
757 return sizeFloor == dim || sizeCeil == dim; 761 return sizeFloor == dim || sizeCeil == dim;
758 } 762 }
759 763
760 SkRawCodec::~SkRawCodec() {} 764 SkRawCodec::~SkRawCodec() {}
761 765
762 SkRawCodec::SkRawCodec(SkDngImage* dngImage) 766 SkRawCodec::SkRawCodec(SkDngImage* dngImage)
763 : INHERITED(dngImage->getImageInfo(), nullptr) 767 : INHERITED(dngImage->getImageInfo(), nullptr)
764 , fDngImage(dngImage) {} 768 , fDngImage(dngImage) {}
OLDNEW
« DEPS ('K') | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698