aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorEli Zaretskii2014-10-14 21:10:37 +0300
committerEli Zaretskii2014-10-14 21:10:37 +0300
commite3060a0c4d2f418ac786775109d71e5843ccf42e (patch)
tree347b37fc39d0db9cd23b3e9f79ee81b4bbc40f08 /src/image.c
parent1a3eca0656bdb764200e10a4f264138e94b1f3ce (diff)
parent980d78b3587560c13a46aef352ed8d5ed744acf6 (diff)
downloademacs-e3060a0c4d2f418ac786775109d71e5843ccf42e.tar.gz
emacs-e3060a0c4d2f418ac786775109d71e5843ccf42e.zip
Merge from trunk and resolve conflicts.
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/src/image.c b/src/image.c
index 804da436ee9..4b73a5fe80c 100644
--- a/src/image.c
+++ b/src/image.c
@@ -3037,13 +3037,16 @@ xbm_load (struct frame *f, struct image *img)
3037 + SBYTES (data))); 3037 + SBYTES (data)));
3038 else 3038 else
3039 { 3039 {
3040 USE_SAFE_ALLOCA;
3041
3040 if (VECTORP (data)) 3042 if (VECTORP (data))
3041 { 3043 {
3042 int i; 3044 int i;
3043 char *p; 3045 char *p;
3044 int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR; 3046 int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR;
3045 3047
3046 p = bits = alloca (nbytes * img->height); 3048 SAFE_NALLOCA (bits, nbytes, img->height);
3049 p = bits;
3047 for (i = 0; i < img->height; ++i, p += nbytes) 3050 for (i = 0; i < img->height; ++i, p += nbytes)
3048 { 3051 {
3049 Lisp_Object line = AREF (data, i); 3052 Lisp_Object line = AREF (data, i);
@@ -3064,9 +3067,8 @@ xbm_load (struct frame *f, struct image *img)
3064 int nbytes, i; 3067 int nbytes, i;
3065 /* Windows mono bitmaps are reversed compared with X. */ 3068 /* Windows mono bitmaps are reversed compared with X. */
3066 invertedBits = bits; 3069 invertedBits = bits;
3067 nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR 3070 nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR;
3068 * img->height; 3071 SAFE_NALLOCA (bits, nbytes, img->height);
3069 bits = alloca (nbytes);
3070 for (i = 0; i < nbytes; i++) 3072 for (i = 0; i < nbytes; i++)
3071 bits[i] = XBM_BIT_SHUFFLE (invertedBits[i]); 3073 bits[i] = XBM_BIT_SHUFFLE (invertedBits[i]);
3072 } 3074 }
@@ -3088,6 +3090,8 @@ xbm_load (struct frame *f, struct image *img)
3088 img->spec, Qnil); 3090 img->spec, Qnil);
3089 x_clear_image (f, img); 3091 x_clear_image (f, img);
3090 } 3092 }
3093
3094 SAFE_FREE ();
3091 } 3095 }
3092 } 3096 }
3093 3097
@@ -3494,6 +3498,8 @@ xpm_load (struct frame *f, struct image *img)
3494 int rc; 3498 int rc;
3495 XpmAttributes attrs; 3499 XpmAttributes attrs;
3496 Lisp_Object specified_file, color_symbols; 3500 Lisp_Object specified_file, color_symbols;
3501 USE_SAFE_ALLOCA;
3502
3497#ifdef HAVE_NTGUI 3503#ifdef HAVE_NTGUI
3498 HDC hdc; 3504 HDC hdc;
3499 xpm_XImage * xpm_image = NULL, * xpm_mask = NULL; 3505 xpm_XImage * xpm_image = NULL, * xpm_mask = NULL;
@@ -3536,7 +3542,7 @@ xpm_load (struct frame *f, struct image *img)
3536 { 3542 {
3537 Lisp_Object tail; 3543 Lisp_Object tail;
3538 XpmColorSymbol *xpm_syms; 3544 XpmColorSymbol *xpm_syms;
3539 int i, size; 3545 ptrdiff_t i, size;
3540 3546
3541 attrs.valuemask |= XpmColorSymbols; 3547 attrs.valuemask |= XpmColorSymbols;
3542 3548
@@ -3546,8 +3552,8 @@ xpm_load (struct frame *f, struct image *img)
3546 ++attrs.numsymbols; 3552 ++attrs.numsymbols;
3547 3553
3548 /* Allocate an XpmColorSymbol array. */ 3554 /* Allocate an XpmColorSymbol array. */
3555 SAFE_NALLOCA (xpm_syms, 1, attrs.numsymbols);
3549 size = attrs.numsymbols * sizeof *xpm_syms; 3556 size = attrs.numsymbols * sizeof *xpm_syms;
3550 xpm_syms = alloca (size);
3551 memset (xpm_syms, 0, size); 3557 memset (xpm_syms, 0, size);
3552 attrs.colorsymbols = xpm_syms; 3558 attrs.colorsymbols = xpm_syms;
3553 3559
@@ -3569,17 +3575,11 @@ xpm_load (struct frame *f, struct image *img)
3569 name = XCAR (XCAR (tail)); 3575 name = XCAR (XCAR (tail));
3570 color = XCDR (XCAR (tail)); 3576 color = XCDR (XCAR (tail));
3571 if (STRINGP (name)) 3577 if (STRINGP (name))
3572 { 3578 SAFE_ALLOCA_STRING (xpm_syms[i].name, name);
3573 xpm_syms[i].name = alloca (SCHARS (name) + 1);
3574 strcpy (xpm_syms[i].name, SSDATA (name));
3575 }
3576 else 3579 else
3577 xpm_syms[i].name = empty_string; 3580 xpm_syms[i].name = empty_string;
3578 if (STRINGP (color)) 3581 if (STRINGP (color))
3579 { 3582 SAFE_ALLOCA_STRING (xpm_syms[i].value, color);
3580 xpm_syms[i].value = alloca (SCHARS (color) + 1);
3581 strcpy (xpm_syms[i].value, SSDATA (color));
3582 }
3583 else 3583 else
3584 xpm_syms[i].value = empty_string; 3584 xpm_syms[i].value = empty_string;
3585 } 3585 }
@@ -3610,6 +3610,7 @@ xpm_load (struct frame *f, struct image *img)
3610#ifdef ALLOC_XPM_COLORS 3610#ifdef ALLOC_XPM_COLORS
3611 xpm_free_color_cache (); 3611 xpm_free_color_cache ();
3612#endif 3612#endif
3613 SAFE_FREE ();
3613 return 0; 3614 return 0;
3614 } 3615 }
3615 3616
@@ -3640,6 +3641,7 @@ xpm_load (struct frame *f, struct image *img)
3640#ifdef ALLOC_XPM_COLORS 3641#ifdef ALLOC_XPM_COLORS
3641 xpm_free_color_cache (); 3642 xpm_free_color_cache ();
3642#endif 3643#endif
3644 SAFE_FREE ();
3643 return 0; 3645 return 0;
3644 } 3646 }
3645#ifdef HAVE_NTGUI 3647#ifdef HAVE_NTGUI
@@ -3782,6 +3784,7 @@ xpm_load (struct frame *f, struct image *img)
3782#ifdef ALLOC_XPM_COLORS 3784#ifdef ALLOC_XPM_COLORS
3783 xpm_free_color_cache (); 3785 xpm_free_color_cache ();
3784#endif 3786#endif
3787 SAFE_FREE ();
3785 return rc == XpmSuccess; 3788 return rc == XpmSuccess;
3786} 3789}
3787 3790
@@ -6580,6 +6583,7 @@ jpeg_load_body (struct frame *f, struct image *img,
6580 colors generated, and mgr->cinfo.colormap is a two-dimensional array 6583 colors generated, and mgr->cinfo.colormap is a two-dimensional array
6581 of color indices in the range 0..mgr->cinfo.actual_number_of_colors. 6584 of color indices in the range 0..mgr->cinfo.actual_number_of_colors.
6582 No more than 255 colors will be generated. */ 6585 No more than 255 colors will be generated. */
6586 USE_SAFE_ALLOCA;
6583 { 6587 {
6584 int i, ir, ig, ib; 6588 int i, ir, ig, ib;
6585 6589
@@ -6595,7 +6599,7 @@ jpeg_load_body (struct frame *f, struct image *img,
6595 a default color, and we don't have to care about which colors 6599 a default color, and we don't have to care about which colors
6596 can be freed safely, and which can't. */ 6600 can be freed safely, and which can't. */
6597 init_color_table (); 6601 init_color_table ();
6598 colors = alloca (mgr->cinfo.actual_number_of_colors * sizeof *colors); 6602 SAFE_NALLOCA (colors, 1, mgr->cinfo.actual_number_of_colors);
6599 6603
6600 for (i = 0; i < mgr->cinfo.actual_number_of_colors; ++i) 6604 for (i = 0; i < mgr->cinfo.actual_number_of_colors; ++i)
6601 { 6605 {
@@ -6638,6 +6642,7 @@ jpeg_load_body (struct frame *f, struct image *img,
6638 6642
6639 /* Put ximg into the image. */ 6643 /* Put ximg into the image. */
6640 image_put_x_image (f, img, ximg, 0); 6644 image_put_x_image (f, img, ximg, 0);
6645 SAFE_FREE ();
6641 return 1; 6646 return 1;
6642} 6647}
6643 6648
@@ -8226,6 +8231,12 @@ imagemagick_load_image (struct frame *f, struct image *img,
8226 return 0; 8231 return 0;
8227 } 8232 }
8228 8233
8234 if (MagickGetImageDelay (image_wand) > 0)
8235 img->lisp_data =
8236 Fcons (Qdelay,
8237 Fcons (make_float (MagickGetImageDelay (image_wand) / 100.0),
8238 img->lisp_data));
8239
8229 if (MagickGetNumberImages (image_wand) > 1) 8240 if (MagickGetNumberImages (image_wand) > 1)
8230 img->lisp_data = 8241 img->lisp_data =
8231 Fcons (Qcount, 8242 Fcons (Qcount,