Mercurial > emacs
comparison src/image.c @ 65723:b88d5090aa86
(gif_load): Fix size of allocated image buffer
for images where a sub-image may be larger than the image's
total height/width specifications.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Wed, 28 Sep 2005 10:48:20 +0000 |
parents | 8105f38368d5 |
children | 375ab086d366 b1c1fc853d2f |
comparison
equal
deleted
inserted
replaced
65722:514b3d667f9e | 65723:b88d5090aa86 |
---|---|
7367 fn_DGifCloseFile (gif); | 7367 fn_DGifCloseFile (gif); |
7368 UNGCPRO; | 7368 UNGCPRO; |
7369 return 0; | 7369 return 0; |
7370 } | 7370 } |
7371 | 7371 |
7372 width = img->width = max (gif->SWidth, gif->Image.Left + gif->Image.Width); | 7372 image_top = gif->SavedImages[ino].ImageDesc.Top; |
7373 height = img->height = max (gif->SHeight, gif->Image.Top + gif->Image.Height); | 7373 image_left = gif->SavedImages[ino].ImageDesc.Left; |
7374 image_width = gif->SavedImages[ino].ImageDesc.Width; | |
7375 image_height = gif->SavedImages[ino].ImageDesc.Height; | |
7376 | |
7377 width = img->width = max (gif->SWidth, | |
7378 max (gif->Image.Left + gif->Image.Width, | |
7379 image_left + image_width)); | |
7380 height = img->height = max (gif->SHeight, | |
7381 max (gif->Image.Top + gif->Image.Height, | |
7382 image_top + image_height)); | |
7374 | 7383 |
7375 /* Create the X image and pixmap. */ | 7384 /* Create the X image and pixmap. */ |
7376 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) | 7385 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) |
7377 { | 7386 { |
7378 fn_DGifCloseFile (gif); | 7387 fn_DGifCloseFile (gif); |
7403 /* Clear the part of the screen image that are not covered by | 7412 /* Clear the part of the screen image that are not covered by |
7404 the image from the GIF file. Full animated GIF support | 7413 the image from the GIF file. Full animated GIF support |
7405 requires more than can be done here (see the gif89 spec, | 7414 requires more than can be done here (see the gif89 spec, |
7406 disposal methods). Let's simply assume that the part | 7415 disposal methods). Let's simply assume that the part |
7407 not covered by a sub-image is in the frame's background color. */ | 7416 not covered by a sub-image is in the frame's background color. */ |
7408 image_top = gif->SavedImages[ino].ImageDesc.Top; | |
7409 image_left = gif->SavedImages[ino].ImageDesc.Left; | |
7410 image_width = gif->SavedImages[ino].ImageDesc.Width; | |
7411 image_height = gif->SavedImages[ino].ImageDesc.Height; | |
7412 | |
7413 for (y = 0; y < image_top; ++y) | 7417 for (y = 0; y < image_top; ++y) |
7414 for (x = 0; x < width; ++x) | 7418 for (x = 0; x < width; ++x) |
7415 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); | 7419 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); |
7416 | 7420 |
7417 for (y = image_top + image_height; y < height; ++y) | 7421 for (y = image_top + image_height; y < height; ++y) |