Chromium Code Reviews| Index: src/codec/SkCodec_libgif.cpp |
| diff --git a/src/codec/SkCodec_libgif.cpp b/src/codec/SkCodec_libgif.cpp |
| index 7c07ab96641fee2c0391aebaaf7c92758d1e17e9..3a04ad7e3cd2fd5f38561cbba1acee6482acd0b2 100644 |
| --- a/src/codec/SkCodec_libgif.cpp |
| +++ b/src/codec/SkCodec_libgif.cpp |
| @@ -125,7 +125,7 @@ inline uint32_t get_output_row_interlaced(uint32_t encodedRow, uint32_t height) |
| * It is used in a SkAutoTCallIProc template |
| */ |
| void SkGifCodec::CloseGif(GifFileType* gif) { |
| - DGifCloseFile(gif, NULL); |
| + DGifCloseFile(gif, nullptr); |
|
scroggo
2015/10/08 20:16:07
This change deserves to be a separate CL. It makes
msarett
2015/10/09 20:03:44
Removing.
|
| } |
| /* |
| @@ -133,7 +133,7 @@ void SkGifCodec::CloseGif(GifFileType* gif) { |
| * decoder |
| */ |
| void SkGifCodec::FreeExtension(SavedImage* image) { |
| - if (NULL != image->ExtensionBlocks) { |
| + if (nullptr != image->ExtensionBlocks) { |
| GifFreeExtensions(&image->ExtensionBlockCount, &image->ExtensionBlocks); |
| } |
| } |
| @@ -246,8 +246,8 @@ SkGifCodec::SkGifCodec(const SkImageInfo& srcInfo, SkStream* stream, GifFileType |
| , fFillIndex(0) |
| , fFrameRect(frameRect) |
| , fFrameIsSubset(frameIsSubset) |
| - , fColorTable(NULL) |
| - , fSwizzler(NULL) |
| + , fColorTable(nullptr) |
| + , fSwizzler(nullptr) |
| {} |
| bool SkGifCodec::onRewind() { |
| @@ -380,7 +380,7 @@ void SkGifCodec::initializeColorTable(const SkImageInfo& dstInfo, SkPMColor* inp |
| // Set up our own color table |
| const uint32_t maxColors = 256; |
| SkPMColor colorPtr[256]; |
| - if (NULL != inputColorCount) { |
| + if (nullptr != inputColorCount) { |
| // We set the number of colors to maxColors in order to ensure |
| // safe memory accesses. Otherwise, an invalid pixel could |
| // access memory outside of our color table array. |
| @@ -390,12 +390,12 @@ void SkGifCodec::initializeColorTable(const SkImageInfo& dstInfo, SkPMColor* inp |
| // Get local color table |
| ColorMapObject* colorMap = fGif->Image.ColorMap; |
| // If there is no local color table, use the global color table |
| - if (NULL == colorMap) { |
| + if (nullptr == colorMap) { |
| colorMap = fGif->SColorMap; |
| } |
| uint32_t colorCount = 0; |
| - if (NULL != colorMap) { |
| + if (nullptr != colorMap) { |
| colorCount = colorMap->ColorCount; |
| // giflib guarantees these properties |
| SkASSERT(colorCount == (unsigned) (1 << (colorMap->BitsPerPixel))); |
| @@ -435,10 +435,6 @@ void SkGifCodec::initializeColorTable(const SkImageInfo& dstInfo, SkPMColor* inp |
| SkCodec::Result SkGifCodec::prepareToDecode(const SkImageInfo& dstInfo, SkPMColor* inputColorPtr, |
| int* inputColorCount, const Options& opts) { |
| // Check for valid input parameters |
| - if (opts.fSubset) { |
| - // Subsets are not supported. |
| - return kUnimplemented; |
| - } |
| if (!conversion_possible(dstInfo, this->getInfo())) { |
| return gif_error("Cannot convert input type to output type.\n", |
| kInvalidConversion); |
| @@ -449,11 +445,9 @@ SkCodec::Result SkGifCodec::prepareToDecode(const SkImageInfo& dstInfo, SkPMColo |
| return kSuccess; |
| } |
| -SkCodec::Result SkGifCodec::initializeSwizzler(const SkImageInfo& dstInfo, |
| - ZeroInitialized zeroInit) { |
| +SkCodec::Result SkGifCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& opts) { |
| const SkPMColor* colorPtr = get_color_ptr(fColorTable.get()); |
| - fSwizzler.reset(SkSwizzler::CreateSwizzler(SkSwizzler::kIndex, |
| - colorPtr, dstInfo, zeroInit)); |
| + fSwizzler.reset(SkSwizzler::CreateSwizzler(SkSwizzler::kIndex, colorPtr, dstInfo, opts)); |
| if (nullptr != fSwizzler.get()) { |
| return kSuccess; |
| } |
| @@ -485,7 +479,7 @@ SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo, |
| // Initialize the swizzler |
| if (fFrameIsSubset) { |
| const SkImageInfo subsetDstInfo = dstInfo.makeWH(fFrameRect.width(), fFrameRect.height()); |
| - if (kSuccess != this->initializeSwizzler(subsetDstInfo, opts.fZeroInitialized)) { |
| + if (kSuccess != this->initializeSwizzler(subsetDstInfo, opts)) { |
| return gif_error("Could not initialize swizzler.\n", kUnimplemented); |
| } |
| @@ -499,7 +493,7 @@ SkCodec::Result SkGifCodec::onGetPixels(const SkImageInfo& dstInfo, |
| dst = SkTAddOffset<void*>(dst, dstRowBytes * fFrameRect.top() + |
| dstBytesPerPixel * fFrameRect.left()); |
| } else { |
| - if (kSuccess != this->initializeSwizzler(dstInfo, opts.fZeroInitialized)) { |
| + if (kSuccess != this->initializeSwizzler(dstInfo, opts)) { |
| return gif_error("Could not initialize swizzler.\n", kUnimplemented); |
| } |
| } |
| @@ -536,11 +530,11 @@ SkCodec::Result SkGifCodec::onStartScanlineDecode(const SkImageInfo& dstInfo, |
| // Initialize the swizzler |
| if (fFrameIsSubset) { |
| const SkImageInfo subsetDstInfo = dstInfo.makeWH(fFrameRect.width(), fFrameRect.height()); |
| - if (kSuccess != this->initializeSwizzler(subsetDstInfo, opts.fZeroInitialized)) { |
| + if (kSuccess != this->initializeSwizzler(subsetDstInfo, opts)) { |
| return gif_error("Could not initialize swizzler.\n", kUnimplemented); |
| } |
| } else { |
| - if (kSuccess != this->initializeSwizzler(dstInfo, opts.fZeroInitialized)) { |
| + if (kSuccess != this->initializeSwizzler(dstInfo, opts)) { |
| return gif_error("Could not initialize swizzler.\n", kUnimplemented); |
| } |
| } |