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

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

Issue 1695473002: Fix colorType/alphaType checks in SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 10 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/SkBmpStandardCodec.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 "SkBmpCodec.h" 8 #include "SkBmpCodec.h"
9 #include "SkCodec.h" 9 #include "SkCodec.h"
10 #include "SkCodecPriv.h" 10 #include "SkCodecPriv.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 return kInvalidParameters; 155 return kInvalidParameters;
156 } 156 }
157 } else { 157 } else {
158 if (ctableCount) { 158 if (ctableCount) {
159 *ctableCount = 0; 159 *ctableCount = 0;
160 } 160 }
161 ctableCount = nullptr; 161 ctableCount = nullptr;
162 ctable = nullptr; 162 ctable = nullptr;
163 } 163 }
164 164
165 {
166 SkAlphaType canonical;
167 if (!SkColorTypeValidateAlphaType(info.colorType(), info.alphaType(), &c anonical)
168 || canonical != info.alphaType())
169 {
170 return kInvalidConversion;
171 }
172 }
173
174 if (!this->rewindIfNeeded()) { 165 if (!this->rewindIfNeeded()) {
175 return kCouldNotRewind; 166 return kCouldNotRewind;
176 } 167 }
177 168
178 // Default options. 169 // Default options.
179 Options optsStorage; 170 Options optsStorage;
180 if (nullptr == options) { 171 if (nullptr == options) {
181 options = &optsStorage; 172 options = &optsStorage;
182 } else if (options->fSubset) { 173 } else if (options->fSubset) {
183 SkIRect subset(*options->fSubset); 174 SkIRect subset(*options->fSubset);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq uested); 361 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq uested);
371 const SkImageInfo fillInfo = info.makeWH(info.width(), 1); 362 const SkImageInfo fillInfo = info.makeWH(info.width(), 1);
372 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) { 363 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) {
373 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r owBytes); 364 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r owBytes);
374 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp ler); 365 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp ler);
375 } 366 }
376 break; 367 break;
377 } 368 }
378 } 369 }
379 } 370 }
OLDNEW
« no previous file with comments | « src/codec/SkBmpStandardCodec.cpp ('k') | src/codec/SkCodecPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698