changeset 8190:a1834394c688

S8081315, PR2405: Avoid giflib interlacing workaround with giflib 5.0.0 on Summary: Sync with version of splashscreen_gif.c in OpenJDK 8 post-8081315.
author andrew
date Tue, 07 Jul 2015 16:05:01 +0100
parents f4a43a71c2ba
children 95bbd38a7741
files src/share/native/sun/awt/splashscreen/splashscreen_gif.c
diffstat 1 files changed, 10 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/awt/splashscreen/splashscreen_gif.c	Mon Jul 06 11:59:12 2015 +0100
+++ b/src/share/native/sun/awt/splashscreen/splashscreen_gif.c	Tue Jul 07 16:05:01 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -213,16 +213,16 @@
             byte_t *pSrc = image->RasterBits;
             ImageFormat srcFormat;
             ImageRect srcRect, dstRect;
-            int pass, npass;
+            int pass = 4, npass = 5;
 
+#if GIFLIB_MAJOR < 5
+            /* Interlaced gif support is broken in giflib < 5
+               so we need to work around this */
             if (desc->Interlace) {
                 pass = 0;
                 npass = 4;
             }
-            else {
-                pass = 4;
-                npass = 5;
-            }
+#endif
 
             srcFormat.colorMap = colorMapBuf;
             srcFormat.depthBytes = 1;
@@ -311,8 +311,9 @@
     free(pOldBitmapBits);
 
 #if GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1)
-    if (DGifCloseFile(gif, NULL) == GIF_ERROR)
+    if (DGifCloseFile(gif, NULL) == GIF_ERROR) {
         return 0;
+    }
 #else
     DGifCloseFile(gif);
 #endif
@@ -324,17 +325,12 @@
 SplashDecodeGifStream(Splash * splash, SplashStream * stream)
 {
 #if GIFLIB_MAJOR >= 5
-    int error = 0;
-    GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc, &error);
-
-    if (error)
-	return 0;
+    GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc, NULL);
 #else
     GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc);
+#endif
 
     if (!gif)
         return 0;
-#endif
-
     return SplashDecodeGif(splash, gif);
 }