comparison src/xfns.c @ 51236:29a68043c861

(png_load): Remove `unused vars intent, image_gamma' warning.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 25 May 2003 17:46:34 +0000
parents 28ea05de2dc5
children e57c833c7053
comparison
equal deleted inserted replaced
51235:2710810008b2 51236:29a68043c861
7577 png_uint_32 width, height; 7577 png_uint_32 width, height;
7578 int bit_depth, color_type, interlace_type; 7578 int bit_depth, color_type, interlace_type;
7579 png_byte channels; 7579 png_byte channels;
7580 png_uint_32 row_bytes; 7580 png_uint_32 row_bytes;
7581 int transparent_p; 7581 int transparent_p;
7582 double screen_gamma, image_gamma; 7582 double screen_gamma;
7583 int intent;
7584 struct png_memory_storage tbr; /* Data to be read */ 7583 struct png_memory_storage tbr; /* Data to be read */
7585 7584
7586 /* Find out what file to load. */ 7585 /* Find out what file to load. */
7587 specified_file = image_spec_value (img->spec, QCfile, NULL); 7586 specified_file = image_spec_value (img->spec, QCfile, NULL);
7588 specified_data = image_spec_value (img->spec, QCdata, NULL); 7587 specified_data = image_spec_value (img->spec, QCdata, NULL);
7717 png_set_gray_to_rgb (png_ptr); 7716 png_set_gray_to_rgb (png_ptr);
7718 7717
7719 screen_gamma = (f->gamma ? 1 / f->gamma / 0.45455 : 2.2); 7718 screen_gamma = (f->gamma ? 1 / f->gamma / 0.45455 : 2.2);
7720 7719
7721 #if 0 /* Avoid double gamma correction for PNG images. */ 7720 #if 0 /* Avoid double gamma correction for PNG images. */
7722 /* Tell the PNG lib to handle gamma correction for us. */ 7721 { /* Tell the PNG lib to handle gamma correction for us. */
7722 int intent;
7723 double image_gamma;
7723 #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED) 7724 #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED)
7724 if (png_get_sRGB (png_ptr, info_ptr, &intent)) 7725 if (png_get_sRGB (png_ptr, info_ptr, &intent))
7725 /* The libpng documentation says this is right in this case. */ 7726 /* The libpng documentation says this is right in this case. */
7726 png_set_gamma (png_ptr, screen_gamma, 0.45455); 7727 png_set_gamma (png_ptr, screen_gamma, 0.45455);
7727 else 7728 else
7728 #endif 7729 #endif
7729 if (png_get_gAMA (png_ptr, info_ptr, &image_gamma)) 7730 if (png_get_gAMA (png_ptr, info_ptr, &image_gamma))
7730 /* Image contains gamma information. */ 7731 /* Image contains gamma information. */
7731 png_set_gamma (png_ptr, screen_gamma, image_gamma); 7732 png_set_gamma (png_ptr, screen_gamma, image_gamma);
7732 else 7733 else
7733 /* Use the standard default for the image gamma. */ 7734 /* Use the standard default for the image gamma. */
7734 png_set_gamma (png_ptr, screen_gamma, 0.45455); 7735 png_set_gamma (png_ptr, screen_gamma, 0.45455);
7736 }
7735 #endif /* if 0 */ 7737 #endif /* if 0 */
7736 7738
7737 /* Handle alpha channel by combining the image with a background 7739 /* Handle alpha channel by combining the image with a background
7738 color. Do this only if a real alpha channel is supplied. For 7740 color. Do this only if a real alpha channel is supplied. For
7739 simple transparency, we prefer a clipping mask. */ 7741 simple transparency, we prefer a clipping mask. */