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

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: Consistently require that kGray8 decodes be opaque 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
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return kInvalidParameters; 159 return kInvalidParameters;
160 } 160 }
161 } else { 161 } else {
162 if (ctableCount) { 162 if (ctableCount) {
163 *ctableCount = 0; 163 *ctableCount = 0;
164 } 164 }
165 ctableCount = nullptr; 165 ctableCount = nullptr;
166 ctable = nullptr; 166 ctable = nullptr;
167 } 167 }
168 168
169 {
170 SkAlphaType canonical;
171 if (!SkColorTypeValidateAlphaType(info.colorType(), info.alphaType(), &c anonical)
scroggo 2016/02/12 17:13:55 What is this redundant with? I started to remove t
msarett 2016/02/12 17:41:31 This just checks that the alphaType matches the co
scroggo 2016/02/12 17:59:00 Ah, got it. So you're just moving this into a comm
172 || canonical != info.alphaType())
173 {
174 return kInvalidConversion;
175 }
176 }
177
178 if (!this->rewindIfNeeded()) { 169 if (!this->rewindIfNeeded()) {
179 return kCouldNotRewind; 170 return kCouldNotRewind;
180 } 171 }
181 172
182 // Default options. 173 // Default options.
183 Options optsStorage; 174 Options optsStorage;
184 if (nullptr == options) { 175 if (nullptr == options) {
185 options = &optsStorage; 176 options = &optsStorage;
186 } else if (options->fSubset) { 177 } else if (options->fSubset) {
187 SkIRect subset(*options->fSubset); 178 SkIRect subset(*options->fSubset);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq uested); 365 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq uested);
375 const SkImageInfo fillInfo = info.makeWH(info.width(), 1); 366 const SkImageInfo fillInfo = info.makeWH(info.width(), 1);
376 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) { 367 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) {
377 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r owBytes); 368 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r owBytes);
378 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp ler); 369 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp ler);
379 } 370 }
380 break; 371 break;
381 } 372 }
382 } 373 }
383 } 374 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698