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 "SkCodecPriv.h" | 8 #include "SkCodecPriv.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkSwizzler.h" | 10 #include "SkSwizzler.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 } | 256 } |
257 return alphaMask != 0xFF; | 257 return alphaMask != 0xFF; |
258 } | 258 } |
259 */ | 259 */ |
260 | 260 |
261 SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc, | 261 SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc, |
262 const SkPMColor* ctable, | 262 const SkPMColor* ctable, |
263 const SkImageInfo& info, void* dst, | 263 const SkImageInfo& info, void* dst, |
264 size_t dstRowBytes, | 264 size_t dstRowBytes, |
265 SkImageGenerator::ZeroInitialized zeroIni
t) { | 265 SkImageGenerator::ZeroInitialized zeroIni
t) { |
266 if (kUnknown_SkColorType == info.colorType()) { | 266 if (info.colorType() == kUnknown_SkColorType || kUnknown == sc) { |
267 return NULL; | 267 return NULL; |
268 } | 268 } |
269 if (info.minRowBytes() > dstRowBytes) { | 269 if (info.minRowBytes() > dstRowBytes) { |
270 return NULL; | 270 return NULL; |
271 } | 271 } |
272 if ((kIndex == sc || kIndex4 == sc || kIndex2 == sc || kIndex1 == sc) | 272 if ((kIndex == sc || kIndex4 == sc || kIndex2 == sc || kIndex1 == sc) |
273 && NULL == ctable) { | 273 && NULL == ctable) { |
274 return NULL; | 274 return NULL; |
275 } | 275 } |
276 RowProc proc = NULL; | 276 RowProc proc = NULL; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 , fDstInfo(info) | 399 , fDstInfo(info) |
400 , fDstRow(dst) | 400 , fDstRow(dst) |
401 , fDstRowBytes(rowBytes) | 401 , fDstRowBytes(rowBytes) |
402 , fCurrY(0) | 402 , fCurrY(0) |
403 { | 403 { |
404 SkDEBUGCODE(fNextMode = kUninitialized_NextMode); | 404 SkDEBUGCODE(fNextMode = kUninitialized_NextMode); |
405 } | 405 } |
406 | 406 |
407 SkSwizzler::ResultAlpha SkSwizzler::next(const uint8_t* SK_RESTRICT src) { | 407 SkSwizzler::ResultAlpha SkSwizzler::next(const uint8_t* SK_RESTRICT src) { |
408 SkASSERT(0 <= fCurrY && fCurrY < fDstInfo.height()); | 408 SkASSERT(0 <= fCurrY && fCurrY < fDstInfo.height()); |
| 409 SkASSERT(fDstRow != NULL); |
409 SkASSERT(kDesignateRow_NextMode != fNextMode); | 410 SkASSERT(kDesignateRow_NextMode != fNextMode); |
410 SkDEBUGCODE(fNextMode = kConsecutive_NextMode); | 411 SkDEBUGCODE(fNextMode = kConsecutive_NextMode); |
411 | 412 |
412 // Decode a row | 413 // Decode a row |
413 const ResultAlpha result = fRowProc(fDstRow, src, fDstInfo.width(), | 414 const ResultAlpha result = fRowProc(fDstRow, src, fDstInfo.width(), |
414 fDeltaSrc, fCurrY, fColorTable); | 415 fDeltaSrc, fCurrY, fColorTable); |
415 | 416 |
416 // Move to the next row and return the result | 417 // Move to the next row and return the result |
| 418 fCurrY++; |
417 fDstRow = SkTAddOffset<void>(fDstRow, fDstRowBytes); | 419 fDstRow = SkTAddOffset<void>(fDstRow, fDstRowBytes); |
418 return result; | 420 return result; |
419 } | 421 } |
420 | 422 |
421 SkSwizzler::ResultAlpha SkSwizzler::next(const uint8_t* SK_RESTRICT src, | 423 SkSwizzler::ResultAlpha SkSwizzler::next(const uint8_t* SK_RESTRICT src, |
422 int y) { | 424 int y) { |
423 SkASSERT(0 <= y && y < fDstInfo.height()); | 425 SkASSERT(0 <= y && y < fDstInfo.height()); |
424 SkASSERT(kConsecutive_NextMode != fNextMode); | 426 SkASSERT(kConsecutive_NextMode != fNextMode); |
425 SkDEBUGCODE(fNextMode = kDesignateRow_NextMode); | 427 SkDEBUGCODE(fNextMode = kDesignateRow_NextMode); |
426 | 428 |
427 // Choose the row | 429 // Choose the row |
428 void* row = SkTAddOffset<void>(fDstRow, y*fDstRowBytes); | 430 void* row = SkTAddOffset<void>(fDstRow, y*fDstRowBytes); |
429 | 431 |
430 // Decode the row | 432 // Decode the row |
431 return fRowProc(row, src, fDstInfo.width(), fDeltaSrc, fCurrY, | 433 return fRowProc(row, src, fDstInfo.width(), fDeltaSrc, fCurrY, |
432 fColorTable); | 434 fColorTable); |
433 } | 435 } |
OLD | NEW |