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

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

Issue 2319293003: Checking for valid colorType, alphaType, colorSpace in SkCodec (Closed)
Patch Set: Fix nanobench Created 4 years, 3 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
« no previous file with comments | « src/codec/SkPngCodec.cpp ('k') | src/codec/SkWebpCodec.cpp » ('j') | 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 return nullptr; 676 return nullptr;
677 } 677 }
678 678
679 return new SkRawCodec(dngImage.release()); 679 return new SkRawCodec(dngImage.release());
680 } 680 }
681 681
682 SkCodec::Result SkRawCodec::onGetPixels(const SkImageInfo& requestedInfo, void* dst, 682 SkCodec::Result SkRawCodec::onGetPixels(const SkImageInfo& requestedInfo, void* dst,
683 size_t dstRowBytes, const Options& optio ns, 683 size_t dstRowBytes, const Options& optio ns,
684 SkPMColor ctable[], int* ctableCount, 684 SkPMColor ctable[], int* ctableCount,
685 int* rowsDecoded) { 685 int* rowsDecoded) {
686 if (!conversion_possible(requestedInfo, this->getInfo())) { 686 if (!conversion_possible_ignore_color_space(requestedInfo, this->getInfo())) {
687 SkCodecPrintf("Error: cannot convert input type to output type.\n"); 687 SkCodecPrintf("Error: cannot convert input type to output type.\n");
688 return kInvalidConversion; 688 return kInvalidConversion;
689 } 689 }
690 690
691 SkAutoTDelete<SkSwizzler> swizzler(SkSwizzler::CreateSwizzler( 691 SkAutoTDelete<SkSwizzler> swizzler(SkSwizzler::CreateSwizzler(
692 this->getEncodedInfo(), nullptr, requestedInfo, options)); 692 this->getEncodedInfo(), nullptr, requestedInfo, options));
693 SkASSERT(swizzler); 693 SkASSERT(swizzler);
694 694
695 const int width = requestedInfo.width(); 695 const int width = requestedInfo.width();
696 const int height = requestedInfo.height(); 696 const int height = requestedInfo.height();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 SkISize sizeFloor = this->onGetScaledDimensions(1.f / std::floor(fullShortEd ge / shortEdge)); 773 SkISize sizeFloor = this->onGetScaledDimensions(1.f / std::floor(fullShortEd ge / shortEdge));
774 SkISize sizeCeil = this->onGetScaledDimensions(1.f / std::ceil(fullShortEdge / shortEdge)); 774 SkISize sizeCeil = this->onGetScaledDimensions(1.f / std::ceil(fullShortEdge / shortEdge));
775 return sizeFloor == dim || sizeCeil == dim; 775 return sizeFloor == dim || sizeCeil == dim;
776 } 776 }
777 777
778 SkRawCodec::~SkRawCodec() {} 778 SkRawCodec::~SkRawCodec() {}
779 779
780 SkRawCodec::SkRawCodec(SkDngImage* dngImage) 780 SkRawCodec::SkRawCodec(SkDngImage* dngImage)
781 : INHERITED(dngImage->width(), dngImage->height(), dngImage->getEncodedInfo( ), nullptr) 781 : INHERITED(dngImage->width(), dngImage->height(), dngImage->getEncodedInfo( ), nullptr)
782 , fDngImage(dngImage) {} 782 , fDngImage(dngImage) {}
OLDNEW
« no previous file with comments | « src/codec/SkPngCodec.cpp ('k') | src/codec/SkWebpCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698