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

Side by Side Diff: src/codec/SkBmpStandardCodec.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/SkBmpRLECodec.cpp ('k') | src/codec/SkCodecPriv.h » ('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 2015 Google Inc. 2 * Copyright 2015 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 "SkBmpStandardCodec.h" 8 #include "SkBmpStandardCodec.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 30 matching lines...) Expand all
41 int* inputColorCount, 41 int* inputColorCount,
42 int* rowsDecoded) { 42 int* rowsDecoded) {
43 if (opts.fSubset) { 43 if (opts.fSubset) {
44 // Subsets are not supported. 44 // Subsets are not supported.
45 return kUnimplemented; 45 return kUnimplemented;
46 } 46 }
47 if (dstInfo.dimensions() != this->getInfo().dimensions()) { 47 if (dstInfo.dimensions() != this->getInfo().dimensions()) {
48 SkCodecPrintf("Error: scaling not supported.\n"); 48 SkCodecPrintf("Error: scaling not supported.\n");
49 return kInvalidScale; 49 return kInvalidScale;
50 } 50 }
51 if (!conversion_possible(dstInfo, this->getInfo())) { 51 if (!conversion_possible_ignore_color_space(dstInfo, this->getInfo())) {
52 SkCodecPrintf("Error: cannot convert input type to output type.\n"); 52 SkCodecPrintf("Error: cannot convert input type to output type.\n");
53 return kInvalidConversion; 53 return kInvalidConversion;
54 } 54 }
55 55
56 Result result = this->prepareToDecode(dstInfo, opts, inputColorPtr, inputCol orCount); 56 Result result = this->prepareToDecode(dstInfo, opts, inputColorPtr, inputCol orCount);
57 if (kSuccess != result) { 57 if (kSuccess != result) {
58 return result; 58 return result;
59 } 59 }
60 int rows = this->decodeRows(dstInfo, dst, dstRowBytes, opts); 60 int rows = this->decodeRows(dstInfo, dst, dstRowBytes, opts);
61 if (rows != dstInfo.height()) { 61 if (rows != dstInfo.height()) {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 } 302 }
303 } 303 }
304 304
305 uint32_t SkBmpStandardCodec::onGetFillValue(SkColorType colorType) const { 305 uint32_t SkBmpStandardCodec::onGetFillValue(SkColorType colorType) const {
306 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get()); 306 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get());
307 if (colorPtr) { 307 if (colorPtr) {
308 return get_color_table_fill_value(colorType, colorPtr, 0); 308 return get_color_table_fill_value(colorType, colorPtr, 0);
309 } 309 }
310 return INHERITED::onGetFillValue(colorType); 310 return INHERITED::onGetFillValue(colorType);
311 } 311 }
OLDNEW
« no previous file with comments | « src/codec/SkBmpRLECodec.cpp ('k') | src/codec/SkCodecPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698