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

(-)file_not_specified_in_diff (-16 / +16 lines)
Line  Link Here
0
-- fbsplash/image.c
0
++ fbsplash/image.c
Lines 112-140 Link Here
112
	png_init_io(png_ptr, fp);
112
	png_init_io(png_ptr, fp);
113
	png_read_info(png_ptr, info_ptr);
113
	png_read_info(png_ptr, info_ptr);
114
114
115
	if (cmap && info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) {
115
	if (cmap && png_get_color_type(png_ptr, info_ptr) != PNG_COLOR_TYPE_PALETTE) {
116
		printerr("Could not read file %s. Not a palette-based image.\n", filename);
116
		printerr("Could not read file %s. Not a palette-based image.\n", filename);
117
		goto failed;
117
		goto failed;
118
	}
118
	}
119
119
120
	if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY ||
120
	if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY ||
121
	    info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
121
	    png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA)
122
		png_set_gray_to_rgb(png_ptr);
122
		png_set_gray_to_rgb(png_ptr);
123
123
124
	if (info_ptr->bit_depth == 16)
124
	if (png_get_bit_depth(png_ptr, info_ptr) == 16)
125
		png_set_strip_16(png_ptr);
125
		png_set_strip_16(png_ptr);
126
126
127
	if (!want_alpha && info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
127
	if (!want_alpha && png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_ALPHA)
128
		png_set_strip_alpha(png_ptr);
128
		png_set_strip_alpha(png_ptr);
129
129
130
#ifndef TARGET_KERNEL	
130
#ifndef TARGET_KERNEL	
131
	if (!(info_ptr->color_type & PNG_COLOR_MASK_ALPHA) & want_alpha) {
131
	if (!(png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_ALPHA) & want_alpha) {
132
		png_set_add_alpha(png_ptr, 0xff, PNG_FILLER_AFTER);
132
		png_set_add_alpha(png_ptr, 0xff, PNG_FILLER_AFTER);
133
	}
133
	}
134
#endif
134
#endif
135
	png_read_update_info(png_ptr, info_ptr);
135
	png_read_update_info(png_ptr, info_ptr);
136
136
137
	if (!cmap && info_ptr->color_type != PNG_COLOR_TYPE_RGB && info_ptr->color_type != PNG_COLOR_TYPE_RGBA) {
137
	if (!cmap && png_get_color_type(png_ptr, info_ptr) != PNG_COLOR_TYPE_RGB && png_get_color_type(png_ptr, info_ptr) != PNG_COLOR_TYPE_RGBA) {
138
		printerr("Could not read file %s. Not an RGB image.\n", filename);
138
		printerr("Could not read file %s. Not an RGB image.\n", filename);
139
		goto failed;
139
		goto failed;
140
	}
140
	}
Lines 150-161 Link Here
150
150
151
	rowbytes = png_get_rowbytes(png_ptr, info_ptr);	
151
	rowbytes = png_get_rowbytes(png_ptr, info_ptr);	
152
152
153
	if ((width && *width && info_ptr->width != *width) || (height && *height && info_ptr->height != *height)) {
153
	if ((width && *width && png_get_image_width(png_ptr, info_ptr) != *width) || (height && *height && png_get_image_height(png_ptr, info_ptr) != *height)) {
154
		printerr("Image size mismatch: %s.\n", filename);
154
		printerr("Image size mismatch: %s.\n", filename);
155
		goto failed;
155
		goto failed;
156
	} else {
156
	} else {
157
		*width = info_ptr->width;
157
		*width = png_get_image_width(png_ptr, info_ptr);
158
		*height = info_ptr->height;
158
		*height = png_get_image_height(png_ptr, info_ptr);
159
	}
159
	}
160
160
161
	*data = malloc(fb_var.xres * fb_var.yres * bytespp);
161
	*data = malloc(fb_var.xres * fb_var.yres * bytespp);
Lines 171-181 Link Here
171
		goto failed;
171
		goto failed;
172
	}
172
	}
173
	
173
	
174
	for (i = 0; i < info_ptr->height; i++) {
174
	for (i = 0; i < png_get_image_height(png_ptr, info_ptr); i++) {
175
		if (cmap) {
175
		if (cmap) {
176
			row_pointer = *data + info_ptr->width * i;
176
			row_pointer = *data + png_get_image_width(png_ptr, info_ptr) * i;
177
		} else if (want_alpha) {
177
		} else if (want_alpha) {
178
			row_pointer = *data + info_ptr->width * i * 4;
178
			row_pointer = *data + png_get_image_width(png_ptr, info_ptr) * i * 4;
179
		} else {
179
		} else {
180
			row_pointer = buf;
180
			row_pointer = buf;
181
		}
181
		}
Lines 184-190 Link Here
184
		
184
		
185
		if (cmap) {
185
		if (cmap) {
186
			int h = 256 - cmap->len;
186
			int h = 256 - cmap->len;
187
			t = *data + info_ptr->width * i;
187
			t = *data + png_get_image_width(png_ptr, info_ptr) * i;
188
188
189
			if (h) {
189
			if (h) {
190
				/* Move the colors up by 'h' offset. This is used because fbcon
190
				/* Move the colors up by 'h' offset. This is used because fbcon
Lines 196-202 Link Here
196
		
196
		
197
		/* We only need to convert the image if we the alpha channel is not required */	
197
		/* We only need to convert the image if we the alpha channel is not required */	
198
		} else if (!want_alpha) {
198
		} else if (!want_alpha) {
199
			truecolor2fb((truecolor*)buf, *data + info_ptr->width * bytespp * i, info_ptr->width, i, 0);
199
			truecolor2fb((truecolor*)buf, *data + png_get_image_width(png_ptr, info_ptr) * bytespp * i, png_get_image_width(png_ptr, info_ptr), i, 0);
200
		}
200
		}
201
	}
201
	}
202
202

Return to bug 384481