| 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 "SkCodec_libpng.h" | 8 #include "SkCodec_libpng.h" |
| 9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 10 #include "SkColorTable.h" | 10 #include "SkColorTable.h" |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 // Note: we check the destination, since otherwise we would have | 426 // Note: we check the destination, since otherwise we would have |
| 427 // told png to upscale. | 427 // told png to upscale. |
| 428 SkASSERT(PNG_COLOR_TYPE_GRAY == pngColorType); | 428 SkASSERT(PNG_COLOR_TYPE_GRAY == pngColorType); |
| 429 sc = SkSwizzler::kGray; | 429 sc = SkSwizzler::kGray; |
| 430 } else if (this->getOriginalInfo().alphaType() == kOpaque_SkAlphaType) { | 430 } else if (this->getOriginalInfo().alphaType() == kOpaque_SkAlphaType) { |
| 431 sc = SkSwizzler::kRGBX; | 431 sc = SkSwizzler::kRGBX; |
| 432 } else { | 432 } else { |
| 433 sc = SkSwizzler::kRGBA; | 433 sc = SkSwizzler::kRGBA; |
| 434 } | 434 } |
| 435 const SkPMColor* colors = colorTable ? colorTable->readColors() : NULL; | 435 const SkPMColor* colors = colorTable ? colorTable->readColors() : NULL; |
| 436 // TODO: Support skipZeroes. | |
| 437 swizzler.reset(SkSwizzler::CreateSwizzler(sc, colors, requestedInfo, | 436 swizzler.reset(SkSwizzler::CreateSwizzler(sc, colors, requestedInfo, |
| 438 dst, rowBytes, false)); | 437 dst, rowBytes, |
| 438 this->getZeroInitialized())); |
| 439 if (!swizzler) { | 439 if (!swizzler) { |
| 440 // FIXME: CreateSwizzler could fail for another reason. | 440 // FIXME: CreateSwizzler could fail for another reason. |
| 441 return kUnimplemented; | 441 return kUnimplemented; |
| 442 } | 442 } |
| 443 | 443 |
| 444 // FIXME: Here is where we should likely insert some of the modifications | 444 // FIXME: Here is where we should likely insert some of the modifications |
| 445 // made in the factory. | 445 // made in the factory. |
| 446 png_read_update_info(fPng_ptr, fInfo_ptr); | 446 png_read_update_info(fPng_ptr, fInfo_ptr); |
| 447 | 447 |
| 448 if (numberPasses > 1) { | 448 if (numberPasses > 1) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 | 483 |
| 484 // FIXME: do we need substituteTranspColor? | 484 // FIXME: do we need substituteTranspColor? |
| 485 | 485 |
| 486 if (reallyHasAlpha && requestedInfo.alphaType() != kOpaque_SkAlphaType) { | 486 if (reallyHasAlpha && requestedInfo.alphaType() != kOpaque_SkAlphaType) { |
| 487 // FIXME: We want to alert the caller. Is this the right way? | 487 // FIXME: We want to alert the caller. Is this the right way? |
| 488 SkImageInfo* modInfo = const_cast<SkImageInfo*>(&requestedInfo); | 488 SkImageInfo* modInfo = const_cast<SkImageInfo*>(&requestedInfo); |
| 489 *modInfo = requestedInfo.makeAlphaType(kOpaque_SkAlphaType); | 489 *modInfo = requestedInfo.makeAlphaType(kOpaque_SkAlphaType); |
| 490 } | 490 } |
| 491 return kSuccess; | 491 return kSuccess; |
| 492 } | 492 } |
| OLD | NEW |