| OLD | NEW |
| 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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 SkCodec::Result SkRawCodec::onGetPixels(const SkImageInfo& requestedInfo, void*
dst, | 665 SkCodec::Result SkRawCodec::onGetPixels(const SkImageInfo& requestedInfo, void*
dst, |
| 666 size_t dstRowBytes, const Options& optio
ns, | 666 size_t dstRowBytes, const Options& optio
ns, |
| 667 SkPMColor ctable[], int* ctableCount, | 667 SkPMColor ctable[], int* ctableCount, |
| 668 int* rowsDecoded) { | 668 int* rowsDecoded) { |
| 669 if (!conversion_possible(requestedInfo, this->getInfo())) { | 669 if (!conversion_possible(requestedInfo, this->getInfo())) { |
| 670 SkCodecPrintf("Error: cannot convert input type to output type.\n"); | 670 SkCodecPrintf("Error: cannot convert input type to output type.\n"); |
| 671 return kInvalidConversion; | 671 return kInvalidConversion; |
| 672 } | 672 } |
| 673 | 673 |
| 674 SkAutoTDelete<SkSwizzler> swizzler(SkSwizzler::CreateSwizzler( | 674 SkAutoTDelete<SkSwizzler> swizzler(SkSwizzler::CreateSwizzler( |
| 675 SkSwizzler::kRGB, nullptr, requestedInfo, options)); | 675 this->getEncodedInfo(), nullptr, requestedInfo, options)); |
| 676 SkASSERT(swizzler); | 676 SkASSERT(swizzler); |
| 677 | 677 |
| 678 const int width = requestedInfo.width(); | 678 const int width = requestedInfo.width(); |
| 679 const int height = requestedInfo.height(); | 679 const int height = requestedInfo.height(); |
| 680 SkAutoTDelete<dng_image> image(fDngImage->render(width, height)); | 680 SkAutoTDelete<dng_image> image(fDngImage->render(width, height)); |
| 681 if (!image) { | 681 if (!image) { |
| 682 return kInvalidInput; | 682 return kInvalidInput; |
| 683 } | 683 } |
| 684 | 684 |
| 685 // Because the DNG SDK can not guarantee to render to requested size, we all
ow a small | 685 // Because the DNG SDK can not guarantee to render to requested size, we all
ow a small |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 SkISize sizeFloor = this->onGetScaledDimensions(1.f / std::floor(fullShortEd
ge / shortEdge)); | 756 SkISize sizeFloor = this->onGetScaledDimensions(1.f / std::floor(fullShortEd
ge / shortEdge)); |
| 757 SkISize sizeCeil = this->onGetScaledDimensions(1.f / std::ceil(fullShortEdge
/ shortEdge)); | 757 SkISize sizeCeil = this->onGetScaledDimensions(1.f / std::ceil(fullShortEdge
/ shortEdge)); |
| 758 return sizeFloor == dim || sizeCeil == dim; | 758 return sizeFloor == dim || sizeCeil == dim; |
| 759 } | 759 } |
| 760 | 760 |
| 761 SkRawCodec::~SkRawCodec() {} | 761 SkRawCodec::~SkRawCodec() {} |
| 762 | 762 |
| 763 SkRawCodec::SkRawCodec(SkDngImage* dngImage) | 763 SkRawCodec::SkRawCodec(SkDngImage* dngImage) |
| 764 : INHERITED(dngImage->getEncodedInfo(), nullptr) | 764 : INHERITED(dngImage->getEncodedInfo(), nullptr) |
| 765 , fDngImage(dngImage) {} | 765 , fDngImage(dngImage) {} |
| OLD | NEW |