| Index: src/codec/SkCodec_libgif.cpp
|
| diff --git a/src/codec/SkCodec_libgif.cpp b/src/codec/SkCodec_libgif.cpp
|
| index 7bfbbf6ceb760b7b7d54dbd91084a2196bbb4f50..16b2eca874bf3b05a600a1c939992ef2053b04c9 100644
|
| --- a/src/codec/SkCodec_libgif.cpp
|
| +++ b/src/codec/SkCodec_libgif.cpp
|
| @@ -100,7 +100,7 @@ static uint32_t find_trans_index(const SavedImage& image) {
|
| * It is used in a SkAutoTCallIProc template
|
| */
|
| void SkGifCodec::CloseGif(GifFileType* gif) {
|
| - DGifCloseFile(gif, NULL);
|
| + DGifCloseFile(gif, nullptr);
|
| }
|
|
|
| /*
|
| @@ -108,7 +108,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);
|
| }
|
| }
|
| @@ -221,8 +221,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() {
|
| @@ -355,7 +355,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.
|
| @@ -365,12 +365,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)));
|
| @@ -410,10 +410,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);
|
| @@ -424,11 +420,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;
|
| }
|
| @@ -460,7 +454,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);
|
| }
|
|
|
| @@ -474,7 +468,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);
|
| }
|
| }
|
| @@ -509,11 +503,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);
|
| }
|
| }
|
|
|