Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 384461
Collapse All | Expand All

(-)xemacs-21.4.22.orig/src/glyphs-eimage.c (-12 / +14 lines)
Lines 946-953 Link Here
946
    int y;
946
    int y;
947
    unsigned char **row_pointers;
947
    unsigned char **row_pointers;
948
    UINT_64_BIT pixels_sq;
948
    UINT_64_BIT pixels_sq;
949
    height = info_ptr->height;
949
    height = png_get_image_height(png_ptr, info_ptr);
950
    width = info_ptr->width;
950
    width = png_get_image_width(png_ptr, info_ptr);
951
    pixels_sq = (UINT_64_BIT) width * (UINT_64_BIT) height;
951
    pixels_sq = (UINT_64_BIT) width * (UINT_64_BIT) height;
952
    if (pixels_sq > ((size_t) -1) / 3)
952
    if (pixels_sq > ((size_t) -1) / 3)
953
      signal_image_error ("PNG image too large to instantiate", instantiator);
953
      signal_image_error ("PNG image too large to instantiate", instantiator);
Lines 1002-1023 Link Here
1002
    /* Now that we're using EImage, ask for 8bit RGB triples for any type
1002
    /* Now that we're using EImage, ask for 8bit RGB triples for any type
1003
       of image*/
1003
       of image*/
1004
    /* convert palette images to full RGB */
1004
    /* convert palette images to full RGB */
1005
    if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
1005
    if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE)
1006
      png_set_expand (png_ptr);
1006
      png_set_expand (png_ptr);
1007
    /* send grayscale images to RGB too */
1007
    /* send grayscale images to RGB too */
1008
    if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
1008
    if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY ||
1009
	info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
1009
	png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA)
1010
      png_set_gray_to_rgb (png_ptr);
1010
      png_set_gray_to_rgb (png_ptr);
1011
    /* we can't handle alpha values */
1011
    /* we can't handle alpha values */
1012
    if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
1012
    if (png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_ALPHA)
1013
      png_set_strip_alpha (png_ptr);
1013
      png_set_strip_alpha (png_ptr);
1014
    /* tell libpng to strip 16 bit depth files down to 8 bits */
1014
    /* tell libpng to strip 16 bit depth files down to 8 bits */
1015
    if (info_ptr->bit_depth == 16)
1015
    if (png_get_bit_depth(png_ptr, info_ptr) == 16)
1016
      png_set_strip_16 (png_ptr);
1016
      png_set_strip_16 (png_ptr);
1017
    /* if the image is < 8 bits, pad it out */
1017
    /* if the image is < 8 bits, pad it out */
1018
    if (info_ptr->bit_depth < 8)
1018
    if (png_get_bit_depth(png_ptr, info_ptr) < 8)
1019
      {
1019
      {
1020
	if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY)
1020
	if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY)
1021
	  png_set_expand (png_ptr);
1021
	  png_set_expand (png_ptr);
1022
	else
1022
	else
1023
	  png_set_packing (png_ptr);
1023
	  png_set_packing (png_ptr);
Lines 1036-1051 Link Here
1036
     */
1036
     */
1037
    {
1037
    {
1038
      int i;
1038
      int i;
1039
      png_textp text;
1040
      int num_text;
1039
1041
1040
      for (i = 0 ; i < info_ptr->num_text ; i++)
1042
      for (i = 0 ; i < num_text ; i++)
1041
	{
1043
	{
1042
	  /* How paranoid do I have to be about no trailing NULLs, and
1044
	  /* How paranoid do I have to be about no trailing NULLs, and
1043
	     using (int)info_ptr->text[i].text_length, and strncpy and a temp
1045
	     using (int)info_ptr->text[i].text_length, and strncpy and a temp
1044
	     string somewhere? */
1046
	     string somewhere? */
1045
1047
1046
	  warn_when_safe (Qpng, Qinfo, "%s - %s",
1048
	  warn_when_safe (Qpng, Qinfo, "%s - %s",
1047
			  info_ptr->text[i].key,
1049
			  text[i].key,
1048
			  info_ptr->text[i].text);
1050
			  text[i].text);
1049
	}
1051
	}
1050
    }
1052
    }
1051
#endif
1053
#endif

Return to bug 384461