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_libgif.h" | 8 #include "SkCodec_libgif.h" |
9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 */ | 60 */ |
61 static GifFileType* open_gif(SkStream* stream) { | 61 static GifFileType* open_gif(SkStream* stream) { |
62 return DGifOpen(stream, read_bytes_callback, NULL); | 62 return DGifOpen(stream, read_bytes_callback, NULL); |
63 } | 63 } |
64 | 64 |
65 /* | 65 /* |
66 * This function cleans up the gif object after the decode completes | 66 * This function cleans up the gif object after the decode completes |
67 * It is used in a SkAutoTCallIProc template | 67 * It is used in a SkAutoTCallIProc template |
68 */ | 68 */ |
69 void SkGifCodec::CloseGif(GifFileType* gif) { | 69 void SkGifCodec::CloseGif(GifFileType* gif) { |
70 #if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0) | |
71 DGifCloseFile(gif); | |
72 #else | |
73 DGifCloseFile(gif, NULL); | 70 DGifCloseFile(gif, NULL); |
74 #endif | |
75 } | 71 } |
76 | 72 |
77 /* | 73 /* |
78 * This function free extension data that has been saved to assist the image | 74 * This function free extension data that has been saved to assist the image |
79 * decoder | 75 * decoder |
80 */ | 76 */ |
81 void SkGifCodec::FreeExtension(SavedImage* image) { | 77 void SkGifCodec::FreeExtension(SavedImage* image) { |
82 if (NULL != image->ExtensionBlocks) { | 78 if (NULL != image->ExtensionBlocks) { |
83 GifFreeExtensions(&image->ExtensionBlockCount, &image->ExtensionBlocks); | 79 GifFreeExtensions(&image->ExtensionBlockCount, &image->ExtensionBlocks); |
84 } | 80 } |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 // giflib returns an error code if the record type is not known. | 523 // giflib returns an error code if the record type is not known. |
528 // We should catch this error immediately. | 524 // We should catch this error immediately. |
529 SkASSERT(false); | 525 SkASSERT(false); |
530 break; | 526 break; |
531 } | 527 } |
532 } while (TERMINATE_RECORD_TYPE != recordType); | 528 } while (TERMINATE_RECORD_TYPE != recordType); |
533 | 529 |
534 return gif_error("Could not find any images to decode in gif file.\n", | 530 return gif_error("Could not find any images to decode in gif file.\n", |
535 kInvalidInput); | 531 kInvalidInput); |
536 } | 532 } |
OLD | NEW |