| 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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 SkCodec::Result SkRawCodec::onGetPixels(const SkImageInfo& requestedInfo, void*
dst, | 681 SkCodec::Result SkRawCodec::onGetPixels(const SkImageInfo& requestedInfo, void*
dst, |
| 682 size_t dstRowBytes, const Options& optio
ns, | 682 size_t dstRowBytes, const Options& optio
ns, |
| 683 SkPMColor ctable[], int* ctableCount, | 683 SkPMColor ctable[], int* ctableCount, |
| 684 int* rowsDecoded) { | 684 int* rowsDecoded) { |
| 685 if (!conversion_possible(requestedInfo, this->getInfo())) { | 685 if (!conversion_possible(requestedInfo, this->getInfo())) { |
| 686 SkCodecPrintf("Error: cannot convert input type to output type.\n"); | 686 SkCodecPrintf("Error: cannot convert input type to output type.\n"); |
| 687 return kInvalidConversion; | 687 return kInvalidConversion; |
| 688 } | 688 } |
| 689 | 689 |
| 690 SkAutoTDelete<SkSwizzler> swizzler(SkSwizzler::CreateSwizzler( | 690 SkAutoTDelete<SkSwizzler> swizzler(SkSwizzler::CreateSwizzler( |
| 691 SkSwizzler::kRGB, nullptr, requestedInfo, options)); | 691 this->getEncodedInfo(), nullptr, requestedInfo, options)); |
| 692 SkASSERT(swizzler); | 692 SkASSERT(swizzler); |
| 693 | 693 |
| 694 const int width = requestedInfo.width(); | 694 const int width = requestedInfo.width(); |
| 695 const int height = requestedInfo.height(); | 695 const int height = requestedInfo.height(); |
| 696 SkAutoTDelete<dng_image> image(fDngImage->render(width, height)); | 696 SkAutoTDelete<dng_image> image(fDngImage->render(width, height)); |
| 697 if (!image) { | 697 if (!image) { |
| 698 return kInvalidInput; | 698 return kInvalidInput; |
| 699 } | 699 } |
| 700 | 700 |
| 701 // Because the DNG SDK can not guarantee to render to requested size, we all
ow a small | 701 // 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... |
| 772 SkISize sizeFloor = this->onGetScaledDimensions(1.f / std::floor(fullShortEd
ge / shortEdge)); | 772 SkISize sizeFloor = this->onGetScaledDimensions(1.f / std::floor(fullShortEd
ge / shortEdge)); |
| 773 SkISize sizeCeil = this->onGetScaledDimensions(1.f / std::ceil(fullShortEdge
/ shortEdge)); | 773 SkISize sizeCeil = this->onGetScaledDimensions(1.f / std::ceil(fullShortEdge
/ shortEdge)); |
| 774 return sizeFloor == dim || sizeCeil == dim; | 774 return sizeFloor == dim || sizeCeil == dim; |
| 775 } | 775 } |
| 776 | 776 |
| 777 SkRawCodec::~SkRawCodec() {} | 777 SkRawCodec::~SkRawCodec() {} |
| 778 | 778 |
| 779 SkRawCodec::SkRawCodec(SkDngImage* dngImage) | 779 SkRawCodec::SkRawCodec(SkDngImage* dngImage) |
| 780 : INHERITED(dngImage->width(), dngImage->height(), dngImage->getEncodedInfo(
), nullptr) | 780 : INHERITED(dngImage->width(), dngImage->height(), dngImage->getEncodedInfo(
), nullptr) |
| 781 , fDngImage(dngImage) {} | 781 , fDngImage(dngImage) {} |
| OLD | NEW |