| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 "SkColor.h" | 8 #include "SkColor.h" |
| 9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 10 #include "SkColorTable.h" | 10 #include "SkColorTable.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 addr += rowBytes; | 222 addr += rowBytes; |
| 223 } | 223 } |
| 224 if (warning) { | 224 if (warning) { |
| 225 gif_warning(*bm, "Index out of bounds."); | 225 gif_warning(*bm, "Index out of bounds."); |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 | 231 |
| 232 int close_gif(GifFileType*); // This function is a template argument, so can't
be static. |
| 233 int close_gif(GifFileType* gif) { |
| 234 #if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0) |
| 235 return DGifCloseFile(gif); |
| 236 #else |
| 237 return DGifCloseFile(gif, NULL); |
| 238 #endif |
| 239 } |
| 240 |
| 232 SkImageDecoder::Result SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap
* bm, Mode mode) { | 241 SkImageDecoder::Result SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap
* bm, Mode mode) { |
| 233 #if GIFLIB_MAJOR < 5 | 242 #if GIFLIB_MAJOR < 5 |
| 234 GifFileType* gif = DGifOpen(sk_stream, DecodeCallBackProc); | 243 GifFileType* gif = DGifOpen(sk_stream, DecodeCallBackProc); |
| 235 #else | 244 #else |
| 236 GifFileType* gif = DGifOpen(sk_stream, DecodeCallBackProc, NULL); | 245 GifFileType* gif = DGifOpen(sk_stream, DecodeCallBackProc, NULL); |
| 237 #endif | 246 #endif |
| 238 if (NULL == gif) { | 247 if (NULL == gif) { |
| 239 return error_return(*bm, "DGifOpen"); | 248 return error_return(*bm, "DGifOpen"); |
| 240 } | 249 } |
| 241 | 250 |
| 242 SkAutoTCallIProc<GifFileType, DGifCloseFile> acp(gif); | 251 SkAutoTCallIProc<GifFileType, close_gif> acp(gif); |
| 243 | 252 |
| 244 SavedImage temp_save; | 253 SavedImage temp_save; |
| 245 temp_save.ExtensionBlocks=NULL; | 254 temp_save.ExtensionBlocks=NULL; |
| 246 temp_save.ExtensionBlockCount=0; | 255 temp_save.ExtensionBlockCount=0; |
| 247 SkAutoTCallVProc<SavedImage, CheckFreeExtension> acp2(&temp_save); | 256 SkAutoTCallVProc<SavedImage, CheckFreeExtension> acp2(&temp_save); |
| 248 | 257 |
| 249 int width, height; | 258 int width, height; |
| 250 GifRecordType recType; | 259 GifRecordType recType; |
| 251 GifByteType *extData; | 260 GifByteType *extData; |
| 252 #if GIFLIB_MAJOR >= 5 | 261 #if GIFLIB_MAJOR >= 5 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory); | 530 static SkImageDecoder_DecodeReg gReg(sk_libgif_dfactory); |
| 522 | 531 |
| 523 static SkImageDecoder::Format get_format_gif(SkStreamRewindable* stream) { | 532 static SkImageDecoder::Format get_format_gif(SkStreamRewindable* stream) { |
| 524 if (is_gif(stream)) { | 533 if (is_gif(stream)) { |
| 525 return SkImageDecoder::kGIF_Format; | 534 return SkImageDecoder::kGIF_Format; |
| 526 } | 535 } |
| 527 return SkImageDecoder::kUnknown_Format; | 536 return SkImageDecoder::kUnknown_Format; |
| 528 } | 537 } |
| 529 | 538 |
| 530 static SkImageDecoder_FormatReg gFormatReg(get_format_gif); | 539 static SkImageDecoder_FormatReg gFormatReg(get_format_gif); |
| OLD | NEW |