OLD | NEW |
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 Loading... |
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) |
| 172 || canonical != info.alphaType()) |
| 173 { |
| 174 return kInvalidConversion; |
| 175 } |
| 176 } |
| 177 |
169 if (!this->rewindIfNeeded()) { | 178 if (!this->rewindIfNeeded()) { |
170 return kCouldNotRewind; | 179 return kCouldNotRewind; |
171 } | 180 } |
172 | 181 |
173 // Default options. | 182 // Default options. |
174 Options optsStorage; | 183 Options optsStorage; |
175 if (nullptr == options) { | 184 if (nullptr == options) { |
176 options = &optsStorage; | 185 options = &optsStorage; |
177 } else if (options->fSubset) { | 186 } else if (options->fSubset) { |
178 SkIRect subset(*options->fSubset); | 187 SkIRect subset(*options->fSubset); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq
uested); | 374 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq
uested); |
366 const SkImageInfo fillInfo = info.makeWH(info.width(), 1); | 375 const SkImageInfo fillInfo = info.makeWH(info.width(), 1); |
367 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) { | 376 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) { |
368 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r
owBytes); | 377 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r
owBytes); |
369 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp
ler); | 378 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp
ler); |
370 } | 379 } |
371 break; | 380 break; |
372 } | 381 } |
373 } | 382 } |
374 } | 383 } |
OLD | NEW |