src/java.desktop/share/native/libsplashscreen/splashscreen_gif.c

Print this page




 279         case GIF_DISPOSE_RESTORE:
 280             {
 281                 int lineSize = cw * splash->imageFormat.depthBytes;
 282                 if (lineSize > 0) {
 283                     int lineOffset = cx * splash->imageFormat.depthBytes;
 284                     int lineIndex = cy * stride + lineOffset;
 285                     for (j=0; j<ch; j++) {
 286                         memcpy(pBitmapBits + lineIndex, pOldBitmapBits + lineIndex,
 287                                lineSize);
 288                         lineIndex += stride;
 289                     }
 290                 }
 291             }
 292             break;
 293         }
 294     }
 295 
 296     free(pBitmapBits);
 297     free(pOldBitmapBits);
 298 
 299     DGifCloseFile(gif, NULL);





 300 
 301     return 1;
 302 }
 303 
 304 int
 305 SplashDecodeGifStream(Splash * splash, SplashStream * stream)
 306 {

 307     GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc, NULL);



 308 
 309     if (!gif)
 310         return 0;
 311     return SplashDecodeGif(splash, gif);
 312 }


 279         case GIF_DISPOSE_RESTORE:
 280             {
 281                 int lineSize = cw * splash->imageFormat.depthBytes;
 282                 if (lineSize > 0) {
 283                     int lineOffset = cx * splash->imageFormat.depthBytes;
 284                     int lineIndex = cy * stride + lineOffset;
 285                     for (j=0; j<ch; j++) {
 286                         memcpy(pBitmapBits + lineIndex, pOldBitmapBits + lineIndex,
 287                                lineSize);
 288                         lineIndex += stride;
 289                     }
 290                 }
 291             }
 292             break;
 293         }
 294     }
 295 
 296     free(pBitmapBits);
 297     free(pOldBitmapBits);
 298 
 299 #if GIFLIB_MAJOR > 5 || (GIFLIB_MAJOR == 5 && GIFLIB_MINOR >= 1)
 300     if (DGifCloseFile(gif, NULL) == GIF_ERROR)
 301         return 0;
 302 #else
 303     DGifCloseFile(gif);
 304 #endif
 305 
 306     return 1;
 307 }
 308 
 309 int
 310 SplashDecodeGifStream(Splash * splash, SplashStream * stream)
 311 {
 312 #if GIFLIB_MAJOR >= 5
 313     GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc, NULL);
 314 #else
 315     GifFileType *gif = DGifOpen((void *) stream, SplashStreamGifInputFunc);
 316 #endif
 317 
 318     if (!gif)
 319         return 0;
 320     return SplashDecodeGif(splash, gif);
 321 }