aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-01-20 12:38:06 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-20 12:38:06 -0800
commit59c69479d44242350b303714a2cec8764c7f11a3 (patch)
treec787fe8bd71c28bc084544d860e9d789b116df8d /src
parente1a828c555223e75ebf83d0674daa2e6fd5889a3 (diff)
Upstream support for giflib >= 5.1.
DGifCloseFile now takes two arugments. The second argument appears to be an optional out-param with more information on failures. ( c.f. http://giflib.sourceforge.net/gif_lib.html ) PS 1 is the original patch we received from google3. I've updated it a bit to be pedantically legal C++98. BUG=skia: Review URL: https://codereview.chromium.org/860853003
Diffstat (limited to 'src')
-rw-r--r--src/images/SkImageDecoder_libgif.cpp11
-rw-r--r--src/images/SkMovie_gif.cpp8
2 files changed, 16 insertions, 3 deletions
diff --git a/src/images/SkImageDecoder_libgif.cpp b/src/images/SkImageDecoder_libgif.cpp
index 0701eb68ae..fa12301e99 100644
--- a/src/images/SkImageDecoder_libgif.cpp
+++ b/src/images/SkImageDecoder_libgif.cpp
@@ -229,6 +229,15 @@ static void sanitize_indexed_bitmap(SkBitmap* bm) {
}
}
+int close_gif(GifFileType*); // This function is a template argument, so can't be static.
+int close_gif(GifFileType* gif) {
+#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+ return DGifCloseFile(gif);
+#else
+ return DGifCloseFile(gif, NULL);
+#endif
+}
+
SkImageDecoder::Result SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* bm, Mode mode) {
#if GIFLIB_MAJOR < 5
GifFileType* gif = DGifOpen(sk_stream, DecodeCallBackProc);
@@ -239,7 +248,7 @@ SkImageDecoder::Result SkGIFImageDecoder::onDecode(SkStream* sk_stream, SkBitmap
return error_return(*bm, "DGifOpen");
}
- SkAutoTCallIProc<GifFileType, DGifCloseFile> acp(gif);
+ SkAutoTCallIProc<GifFileType, close_gif> acp(gif);
SavedImage temp_save;
temp_save.ExtensionBlocks=NULL;
diff --git a/src/images/SkMovie_gif.cpp b/src/images/SkMovie_gif.cpp
index 3810db5662..40e5520def 100644
--- a/src/images/SkMovie_gif.cpp
+++ b/src/images/SkMovie_gif.cpp
@@ -16,6 +16,10 @@
#include "gif_lib.h"
+#if GIFLIB_MAJOR < 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR == 0)
+#define DGifCloseFile(a, b) DGifCloseFile(a)
+#endif
+
class SkGIFMovie : public SkMovie {
public:
SkGIFMovie(SkStream* stream);
@@ -50,7 +54,7 @@ SkGIFMovie::SkGIFMovie(SkStream* stream)
if (DGifSlurp(fGIF) != GIF_OK)
{
- DGifCloseFile(fGIF);
+ DGifCloseFile(fGIF, NULL);
fGIF = NULL;
}
fCurrIndex = -1;
@@ -60,7 +64,7 @@ SkGIFMovie::SkGIFMovie(SkStream* stream)
SkGIFMovie::~SkGIFMovie()
{
if (fGIF)
- DGifCloseFile(fGIF);
+ DGifCloseFile(fGIF, NULL);
}
static SkMSec savedimage_duration(const SavedImage* image)