Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: src/codec/SkGifCodec.cpp

Issue 1705503002: Add SkCodec to the CMake build (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/codec/SkGifCodec.cpp
diff --git a/src/codec/SkGifCodec.cpp b/src/codec/SkGifCodec.cpp
index a938f5fc48fac46ece1f929597ae5844675d3917..922a1501787494a92dcb5a68db76ac35e6f65f8c 100644
--- a/src/codec/SkGifCodec.cpp
+++ b/src/codec/SkGifCodec.cpp
@@ -49,7 +49,11 @@ static int32_t read_bytes_callback(GifFileType* fileType, GifByteType* out, int3
* Open the gif file
*/
static GifFileType* open_gif(SkStream* stream) {
+#if GIFLIB_MAJOR < 5
+ return DGifOpen(stream, read_bytes_callback);
+#else
return DGifOpen(stream, read_bytes_callback, nullptr);
+#endif
}
/*
@@ -117,7 +121,11 @@ 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);
+#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+ DGifCloseFile(gif);
+#else
+ DGifCloseFile(gif, nullptr);
+#endif
}
/*
@@ -126,7 +134,11 @@ void SkGifCodec::CloseGif(GifFileType* gif) {
*/
void SkGifCodec::FreeExtension(SavedImage* image) {
if (NULL != image->ExtensionBlocks) {
+#if GIFLIB_MAJOR < 5
+ FreeExtension(image);
+#else
GifFreeExtensions(&image->ExtensionBlockCount, &image->ExtensionBlocks);
+#endif
}
}
@@ -311,10 +323,15 @@ SkCodec::Result SkGifCodec::ReadUpToFirstImage(GifFileType* gif, uint32_t* trans
// Create an extension block with our data
while (nullptr != extData) {
// Add a single block
+
+#if GIFLIB_MAJOR < 5
+ if (AddExtensionBlock(&saveExt, extData[0],
+ &extData[1]) == GIF_ERROR) {
+#else
if (GIF_ERROR == GifAddExtensionBlock(&saveExt.ExtensionBlockCount,
&saveExt.ExtensionBlocks,
- extFunction, extData[0], &extData[1]))
- {
+ extFunction, extData[0], &extData[1])) {
+#endif
return gif_error("Could not add extension block.\n", kIncompleteInput);
}
// Move to the next block
« cmake/CMakeLists.txt ('K') | « cmake/README.md ('k') | src/codec/SkPngCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698