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

(-)xfig.3.2.5b/f_readpng.c (-7 / +13 lines)
Lines 73-79 read_png(FILE *file, int filetype, F_pic Link Here
73
    }
73
    }
74
74
75
    /* set long jump recovery here */
75
    /* set long jump recovery here */
76
    if (setjmp(png_ptr->jmpbuf)) {
76
    if (setjmp(png_jmpbuf(png_ptr))) {
77
	/* if we get here there was a problem reading the file */
77
	/* if we get here there was a problem reading the file */
78
	png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
78
	png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
79
	close_picfile(file,filetype);
79
	close_picfile(file,filetype);
Lines 90-104 read_png(FILE *file, int filetype, F_pic Link Here
90
    png_get_IHDR(png_ptr, info_ptr, &w, &h, &bit_depth, &color_type,
90
    png_get_IHDR(png_ptr, info_ptr, &w, &h, &bit_depth, &color_type,
91
	&interlace_type, &compression_type, &filter_type);
91
	&interlace_type, &compression_type, &filter_type);
92
92
93
    if (info_ptr->valid & PNG_INFO_gAMA)
93
    png_fixed_point gamma = 0.45;
94
	png_set_gamma(png_ptr, 2.2, info_ptr->gamma);
94
    png_get_gAMA_fixed(png_ptr,info_ptr,&gamma);
95
    else
95
    png_set_gamma(png_ptr, 2.2, gamma);
96
	png_set_gamma(png_ptr, 2.2, 0.45);
97
96
98
    if (info_ptr->valid & PNG_INFO_bKGD)
97
    if (png_get_valid(png_ptr,info_ptr,PNG_INFO_bKGD)) {
99
	/* set the background to the one supplied */
98
	/* set the background to the one supplied */
100
	png_set_background(png_ptr, &info_ptr->background,
99
	png_color_16p background;
100
	png_get_bKGD(png_ptr,info_ptr,&background);
101
	png_set_background(png_ptr, background,
101
		PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
102
		PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
103
    }
102
    else {
104
    else {
103
	/* blend the canvas background using the alpha channel */
105
	/* blend the canvas background using the alpha channel */
104
	background.red   = x_bg_color.red >> 8;
106
	background.red   = x_bg_color.red >> 8;
Lines 136-142 read_png(FILE *file, int filetype, F_pic Link Here
136
138
137
	if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette)) {
139
	if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette)) {
138
	    png_get_hIST(png_ptr, info_ptr, &histogram);
140
	    png_get_hIST(png_ptr, info_ptr, &histogram);
141
#if PNG_LIBPNG_VER_MAJOR <= 1 && PNG_LIBPNG_VER_MINOR < 5
139
	    png_set_dither(png_ptr, palette, num_palette, 256, histogram, 0);
142
	    png_set_dither(png_ptr, palette, num_palette, 256, histogram, 0);
143
#else
144
	    png_set_quantize(png_ptr, palette, num_palette, 256, histogram, 0);
145
#endif
140
	}
146
	}
141
    }
147
    }
142
    if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
148
    if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
(-)xfig.3.2.5b/f_wrpng.c (-1 / +2 lines)
Lines 20-25 Link Here
20
#include "w_msgpanel.h"
20
#include "w_msgpanel.h"
21
#include "w_setup.h"
21
#include "w_setup.h"
22
#include <png.h>
22
#include <png.h>
23
#include <zlib.h>
23
24
24
/*
25
/*
25
 * Write PNG file from rgb data
26
 * Write PNG file from rgb data
Lines 59-65 write_png(FILE *file, unsigned char *dat Link Here
59
    }
60
    }
60
61
61
    /* set long jump recovery here */
62
    /* set long jump recovery here */
62
    if (setjmp(png_ptr->jmpbuf)) {
63
    if (setjmp(png_jmpbuf(png_ptr))) {
63
	/* if we get here there was a problem reading the file */
64
	/* if we get here there was a problem reading the file */
64
	png_destroy_write_struct(&png_ptr, &info_ptr);
65
	png_destroy_write_struct(&png_ptr, &info_ptr);
65
	return False;
66
	return False;

Return to bug 356753