diff options
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 69 |
1 files changed, 32 insertions, 37 deletions
diff --git a/src/image.c b/src/image.c index 07db6cece1f..cac23b7fa87 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Functions for image support on window system. | 1 | /* Functions for image support on window system. |
| 2 | 2 | ||
| 3 | Copyright (C) 1989, 1992-2012 Free Software Foundation, Inc. | 3 | Copyright (C) 1989, 1992-2013 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -68,8 +68,6 @@ typedef struct x_bitmap_record Bitmap_Record; | |||
| 68 | #define GET_PIXEL(ximg, x, y) XGetPixel (ximg, x, y) | 68 | #define GET_PIXEL(ximg, x, y) XGetPixel (ximg, x, y) |
| 69 | #define NO_PIXMAP None | 69 | #define NO_PIXMAP None |
| 70 | 70 | ||
| 71 | #define RGB_PIXEL_COLOR unsigned long | ||
| 72 | |||
| 73 | #define PIX_MASK_RETAIN 0 | 71 | #define PIX_MASK_RETAIN 0 |
| 74 | #define PIX_MASK_DRAW 1 | 72 | #define PIX_MASK_DRAW 1 |
| 75 | #endif /* HAVE_X_WINDOWS */ | 73 | #endif /* HAVE_X_WINDOWS */ |
| @@ -88,8 +86,6 @@ typedef struct w32_bitmap_record Bitmap_Record; | |||
| 88 | #define GET_PIXEL(ximg, x, y) GetPixel (ximg, x, y) | 86 | #define GET_PIXEL(ximg, x, y) GetPixel (ximg, x, y) |
| 89 | #define NO_PIXMAP 0 | 87 | #define NO_PIXMAP 0 |
| 90 | 88 | ||
| 91 | #define RGB_PIXEL_COLOR COLORREF | ||
| 92 | |||
| 93 | #define PIX_MASK_RETAIN 0 | 89 | #define PIX_MASK_RETAIN 0 |
| 94 | #define PIX_MASK_DRAW 1 | 90 | #define PIX_MASK_DRAW 1 |
| 95 | 91 | ||
| @@ -110,7 +106,6 @@ typedef struct ns_bitmap_record Bitmap_Record; | |||
| 110 | #define GET_PIXEL(ximg, x, y) XGetPixel (ximg, x, y) | 106 | #define GET_PIXEL(ximg, x, y) XGetPixel (ximg, x, y) |
| 111 | #define NO_PIXMAP 0 | 107 | #define NO_PIXMAP 0 |
| 112 | 108 | ||
| 113 | #define RGB_PIXEL_COLOR unsigned long | ||
| 114 | #define ZPixmap 0 | 109 | #define ZPixmap 0 |
| 115 | 110 | ||
| 116 | #define PIX_MASK_RETAIN 0 | 111 | #define PIX_MASK_RETAIN 0 |
| @@ -159,15 +154,15 @@ XGetImage (Display *display, Pixmap pixmap, int x, int y, | |||
| 159 | return pixmap; | 154 | return pixmap; |
| 160 | } | 155 | } |
| 161 | 156 | ||
| 162 | /* use with imgs created by ns_image_for_XPM */ | 157 | /* Use with images created by ns_image_for_XPM. */ |
| 163 | unsigned long | 158 | unsigned long |
| 164 | XGetPixel (XImagePtr ximage, int x, int y) | 159 | XGetPixel (XImagePtr ximage, int x, int y) |
| 165 | { | 160 | { |
| 166 | return ns_get_pixel (ximage, x, y); | 161 | return ns_get_pixel (ximage, x, y); |
| 167 | } | 162 | } |
| 168 | 163 | ||
| 169 | /* use with imgs created by ns_image_for_XPM; alpha set to 1; | 164 | /* Use with images created by ns_image_for_XPM; alpha set to 1; |
| 170 | pixel is assumed to be in form RGB */ | 165 | pixel is assumed to be in RGB form. */ |
| 171 | void | 166 | void |
| 172 | XPutPixel (XImagePtr ximage, int x, int y, unsigned long pixel) | 167 | XPutPixel (XImagePtr ximage, int x, int y, unsigned long pixel) |
| 173 | { | 168 | { |
| @@ -7378,11 +7373,10 @@ gif_load (struct frame *f, struct image *img) | |||
| 7378 | y < subimg_height; | 7373 | y < subimg_height; |
| 7379 | y++, row += interlace_increment[pass]) | 7374 | y++, row += interlace_increment[pass]) |
| 7380 | { | 7375 | { |
| 7381 | if (row >= subimg_height) | 7376 | while (subimg_height <= row) |
| 7382 | { | 7377 | { |
| 7378 | lint_assume (pass < 3); | ||
| 7383 | row = interlace_start[++pass]; | 7379 | row = interlace_start[++pass]; |
| 7384 | while (row >= subimg_height) | ||
| 7385 | row = interlace_start[++pass]; | ||
| 7386 | } | 7380 | } |
| 7387 | 7381 | ||
| 7388 | for (x = 0; x < subimg_width; x++) | 7382 | for (x = 0; x < subimg_width; x++) |
| @@ -7792,11 +7786,6 @@ imagemagick_load_image (struct frame *f, struct image *img, | |||
| 7792 | } | 7786 | } |
| 7793 | } | 7787 | } |
| 7794 | 7788 | ||
| 7795 | /* Finally we are done manipulating the image. Figure out the | ||
| 7796 | resulting width/height and transfer ownership to Emacs. */ | ||
| 7797 | height = MagickGetImageHeight (image_wand); | ||
| 7798 | width = MagickGetImageWidth (image_wand); | ||
| 7799 | |||
| 7800 | /* Set the canvas background color to the frame or specified | 7789 | /* Set the canvas background color to the frame or specified |
| 7801 | background, and flatten the image. Note: as of ImageMagick | 7790 | background, and flatten the image. Note: as of ImageMagick |
| 7802 | 6.6.0, SVG image transparency is not handled properly | 7791 | 6.6.0, SVG image transparency is not handled properly |
| @@ -7813,6 +7802,11 @@ imagemagick_load_image (struct frame *f, struct image *img, | |||
| 7813 | image_wand = new_wand; | 7802 | image_wand = new_wand; |
| 7814 | } | 7803 | } |
| 7815 | 7804 | ||
| 7805 | /* Finally we are done manipulating the image. Figure out the | ||
| 7806 | resulting width/height and transfer ownership to Emacs. */ | ||
| 7807 | height = MagickGetImageHeight (image_wand); | ||
| 7808 | width = MagickGetImageWidth (image_wand); | ||
| 7809 | |||
| 7816 | if (! (width <= INT_MAX && height <= INT_MAX | 7810 | if (! (width <= INT_MAX && height <= INT_MAX |
| 7817 | && check_image_size (f, width, height))) | 7811 | && check_image_size (f, width, height))) |
| 7818 | { | 7812 | { |
| @@ -8126,24 +8120,25 @@ svg_image_p (Lisp_Object object) | |||
| 8126 | #ifdef WINDOWSNT | 8120 | #ifdef WINDOWSNT |
| 8127 | 8121 | ||
| 8128 | /* SVG library functions. */ | 8122 | /* SVG library functions. */ |
| 8129 | DEF_IMGLIB_FN (RsvgHandle *, rsvg_handle_new); | 8123 | DEF_IMGLIB_FN (RsvgHandle *, rsvg_handle_new, (void)); |
| 8130 | DEF_IMGLIB_FN (void, rsvg_handle_get_dimensions); | 8124 | DEF_IMGLIB_FN (void, rsvg_handle_get_dimensions, (RsvgHandle *, RsvgDimensionData *)); |
| 8131 | DEF_IMGLIB_FN (gboolean, rsvg_handle_write); | 8125 | DEF_IMGLIB_FN (gboolean, rsvg_handle_write, (RsvgHandle *, const guchar *, gsize, GError **)); |
| 8132 | DEF_IMGLIB_FN (gboolean, rsvg_handle_close); | 8126 | DEF_IMGLIB_FN (gboolean, rsvg_handle_close, (RsvgHandle *, GError **)); |
| 8133 | DEF_IMGLIB_FN (GdkPixbuf *, rsvg_handle_get_pixbuf); | 8127 | DEF_IMGLIB_FN (GdkPixbuf *, rsvg_handle_get_pixbuf, (RsvgHandle *)); |
| 8134 | 8128 | DEF_IMGLIB_FN (void *, rsvg_handle_set_size_callback, (RsvgHandle *, RsvgSizeFunc, gpointer, GDestroyNotify)); | |
| 8135 | DEF_IMGLIB_FN (int, gdk_pixbuf_get_width); | 8129 | |
| 8136 | DEF_IMGLIB_FN (int, gdk_pixbuf_get_height); | 8130 | DEF_IMGLIB_FN (int, gdk_pixbuf_get_width, (const GdkPixbuf *)); |
| 8137 | DEF_IMGLIB_FN (guchar *, gdk_pixbuf_get_pixels); | 8131 | DEF_IMGLIB_FN (int, gdk_pixbuf_get_height, (const GdkPixbuf *)); |
| 8138 | DEF_IMGLIB_FN (int, gdk_pixbuf_get_rowstride); | 8132 | DEF_IMGLIB_FN (guchar *, gdk_pixbuf_get_pixels, (const GdkPixbuf *)); |
| 8139 | DEF_IMGLIB_FN (GdkColorspace, gdk_pixbuf_get_colorspace); | 8133 | DEF_IMGLIB_FN (int, gdk_pixbuf_get_rowstride, (const GdkPixbuf *)); |
| 8140 | DEF_IMGLIB_FN (int, gdk_pixbuf_get_n_channels); | 8134 | DEF_IMGLIB_FN (GdkColorspace, gdk_pixbuf_get_colorspace, (const GdkPixbuf *)); |
| 8141 | DEF_IMGLIB_FN (gboolean, gdk_pixbuf_get_has_alpha); | 8135 | DEF_IMGLIB_FN (int, gdk_pixbuf_get_n_channels, (const GdkPixbuf *)); |
| 8142 | DEF_IMGLIB_FN (int, gdk_pixbuf_get_bits_per_sample); | 8136 | DEF_IMGLIB_FN (gboolean, gdk_pixbuf_get_has_alpha, (const GdkPixbuf *)); |
| 8143 | 8137 | DEF_IMGLIB_FN (int, gdk_pixbuf_get_bits_per_sample, (const GdkPixbuf *)); | |
| 8144 | DEF_IMGLIB_FN (void, g_type_init); | 8138 | |
| 8145 | DEF_IMGLIB_FN (void, g_object_unref); | 8139 | DEF_IMGLIB_FN (void, g_type_init, (void)); |
| 8146 | DEF_IMGLIB_FN (void, g_error_free); | 8140 | DEF_IMGLIB_FN (void, g_object_unref, (gpointer)); |
| 8141 | DEF_IMGLIB_FN (void, g_error_free, (GError *)); | ||
| 8147 | 8142 | ||
| 8148 | Lisp_Object Qgdk_pixbuf, Qglib, Qgobject; | 8143 | Lisp_Object Qgdk_pixbuf, Qglib, Qgobject; |
| 8149 | 8144 | ||
| @@ -8559,10 +8554,10 @@ gs_load (struct frame *f, struct image *img) | |||
| 8559 | info. */ | 8554 | info. */ |
| 8560 | pt_width = image_spec_value (img->spec, QCpt_width, NULL); | 8555 | pt_width = image_spec_value (img->spec, QCpt_width, NULL); |
| 8561 | in_width = INTEGERP (pt_width) ? XFASTINT (pt_width) / 72.0 : 0; | 8556 | in_width = INTEGERP (pt_width) ? XFASTINT (pt_width) / 72.0 : 0; |
| 8562 | in_width *= FRAME_X_DISPLAY_INFO (f)->resx; | 8557 | in_width *= FRAME_RES_X (f); |
| 8563 | pt_height = image_spec_value (img->spec, QCpt_height, NULL); | 8558 | pt_height = image_spec_value (img->spec, QCpt_height, NULL); |
| 8564 | in_height = INTEGERP (pt_height) ? XFASTINT (pt_height) / 72.0 : 0; | 8559 | in_height = INTEGERP (pt_height) ? XFASTINT (pt_height) / 72.0 : 0; |
| 8565 | in_height *= FRAME_X_DISPLAY_INFO (f)->resy; | 8560 | in_height *= FRAME_RES_Y (f); |
| 8566 | 8561 | ||
| 8567 | if (! (in_width <= INT_MAX && in_height <= INT_MAX | 8562 | if (! (in_width <= INT_MAX && in_height <= INT_MAX |
| 8568 | && check_image_size (f, in_width, in_height))) | 8563 | && check_image_size (f, in_width, in_height))) |