forked from pool/xemacs
a4f1b72b5d
- build also against libpng15 * libpng15.patch OBS-URL: https://build.opensuse.org/request/show/99215 OBS-URL: https://build.opensuse.org/package/show/M17N/xemacs?expand=0&rev=36
90 lines
3.5 KiB
Diff
90 lines
3.5 KiB
Diff
Index: xemacs-beta-b604d235f028/src/glyphs-eimage.c
|
|
===================================================================
|
|
--- xemacs-beta-b604d235f028.orig/src/glyphs-eimage.c
|
|
+++ xemacs-beta-b604d235f028/src/glyphs-eimage.c
|
|
@@ -887,7 +887,8 @@ png_instantiate (Lisp_Object image_insta
|
|
Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
|
|
struct png_unwind_data unwind;
|
|
int speccount = specpdl_depth ();
|
|
- int height, width;
|
|
+ png_uint_32 height, width;
|
|
+ int bit_depth, color_type;
|
|
struct png_memory_storage tbr; /* Data to be read */
|
|
|
|
/* PNG variables */
|
|
@@ -955,8 +956,7 @@ png_instantiate (Lisp_Object image_insta
|
|
int y, padding;
|
|
Binbyte **row_pointers;
|
|
UINT_64_BIT pixels_sq;
|
|
- height = info_ptr->height;
|
|
- width = info_ptr->width;
|
|
+ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, NULL, NULL, NULL);
|
|
pixels_sq = (UINT_64_BIT) width * (UINT_64_BIT) height;
|
|
if (pixels_sq > ((size_t) -1) / 3)
|
|
signal_image_error ("PNG image too large to instantiate", instantiator);
|
|
@@ -1018,29 +1018,29 @@ png_instantiate (Lisp_Object image_insta
|
|
/* Now that we're using EImage, ask for 8bit RGB triples for any type
|
|
of image*/
|
|
/* convert palette images to RGB */
|
|
- if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
|
+ if (color_type == PNG_COLOR_TYPE_PALETTE)
|
|
png_set_palette_to_rgb (png_ptr);
|
|
/* convert grayscale images to RGB */
|
|
- else if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
|
|
- info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
|
+ else if (color_type == PNG_COLOR_TYPE_GRAY ||
|
|
+ color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
|
png_set_gray_to_rgb (png_ptr);
|
|
/* pad images with depth < 8 bits */
|
|
- else if (info_ptr->bit_depth < 8)
|
|
+ else if (bit_depth < 8)
|
|
{
|
|
- if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY)
|
|
+ if (color_type == PNG_COLOR_TYPE_GRAY)
|
|
png_set_expand (png_ptr);
|
|
else
|
|
png_set_packing (png_ptr);
|
|
}
|
|
/* strip 16-bit depth files down to 8 bits */
|
|
- if (info_ptr->bit_depth == 16)
|
|
+ if (bit_depth == 16)
|
|
png_set_strip_16 (png_ptr);
|
|
/* strip alpha channel
|
|
#### shouldn't we handle this?
|
|
first call png_read_update_info in case above transformations
|
|
have generated an alpha channel */
|
|
png_read_update_info(png_ptr, info_ptr);
|
|
- if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
|
|
+ if (color_type & PNG_COLOR_MASK_ALPHA)
|
|
png_set_strip_alpha (png_ptr);
|
|
|
|
png_read_image (png_ptr, row_pointers);
|
|
@@ -1050,19 +1050,22 @@ png_instantiate (Lisp_Object image_insta
|
|
* into the glyph code, where you can get to it from lisp
|
|
* anyway. - WMP */
|
|
{
|
|
- int i;
|
|
+ int i, num_text;
|
|
+ png_textp text_ptr;
|
|
DECLARE_EISTRING (key);
|
|
DECLARE_EISTRING (text);
|
|
-
|
|
- for (i = 0 ; i < info_ptr->num_text ; i++)
|
|
+
|
|
+ png_get_text(png_ptr, info_ptr, &text_ptr, &num_text);
|
|
+
|
|
+ for (i = 0 ; i < num_text ; i++)
|
|
{
|
|
/* How paranoid do I have to be about no trailing NULLs, and
|
|
using (int)info_ptr->text[i].text_length, and strncpy and a temp
|
|
string somewhere? */
|
|
eireset(key);
|
|
eireset(text);
|
|
- eicpy_ext(key, info_ptr->text[i].key, Qbinary);
|
|
- eicpy_ext(text, info_ptr->text[i].text, Qbinary);
|
|
+ eicpy_ext(key, text_ptr[i].key, Qbinary);
|
|
+ eicpy_ext(text, text_ptr[i].text, Qbinary);
|
|
|
|
warn_when_safe (Qpng, Qinfo, "%s - %s",
|
|
eidata(key), eidata(text));
|