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

(-)tucnak2-2.43.orig/src/gfx_png.c (-6 / +1 lines)
Lines 56-67 Link Here
56
	    
56
	    
57
    png_init_io(png_ptr, fi);
57
    png_init_io(png_ptr, fi);
58
58
59
    info_ptr->width = surf->w;
59
    png_set_IHDR(png_ptr, info_ptr, surf->w, surf->h, 8, PNG_COLOR_TYPE_RGB, 1, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
60
    info_ptr->height = surf->h;
61
    info_ptr->bit_depth = 8;
62
    info_ptr->color_type = PNG_COLOR_TYPE_RGB;
63
    info_ptr->interlace_type = 1;
64
    info_ptr->valid = 0;
65
60
66
    /* Set headers */
61
    /* Set headers */
67
62
(-)tucnak2-2.43.orig/src/img_png.c (-10 / +11 lines)
Lines 144-150 Link Here
144
	 * the normal method of doing things with libpng).  REQUIRED unless you
144
	 * the normal method of doing things with libpng).  REQUIRED unless you
145
	 * set up your own error handlers in png_create_read_struct() earlier.
145
	 * set up your own error handlers in png_create_read_struct() earlier.
146
	 */
146
	 */
147
	if ( setjmp(png_ptr->jmpbuf) ) {
147
	if ( setjmp(png_jmpbuf(png_ptr)) ) {
148
		IMG_SetError("Error reading the PNG file.");
148
		IMG_SetError("Error reading the PNG file.");
149
		goto done;
149
		goto done;
150
	}
150
	}
Lines 213-221 Link Here
213
			Rmask = 0x000000FF;
213
			Rmask = 0x000000FF;
214
			Gmask = 0x0000FF00;
214
			Gmask = 0x0000FF00;
215
			Bmask = 0x00FF0000;
215
			Bmask = 0x00FF0000;
216
			Amask = (info_ptr->channels == 4) ? 0xFF000000 : 0;
216
			Amask = (png_get_channels(png_ptr, info_ptr) == 4) ? 0xFF000000 : 0;
217
		} else {
217
		} else {
218
		        int s = (info_ptr->channels == 4) ? 0 : 8;
218
		        int s = (png_get_channels(png_ptr, info_ptr) == 4) ? 0 : 8;
219
			Rmask = 0xFF000000 >> s;
219
			Rmask = 0xFF000000 >> s;
220
			Gmask = 0x00FF0000 >> s;
220
			Gmask = 0x00FF0000 >> s;
221
			Bmask = 0x0000FF00 >> s;
221
			Bmask = 0x0000FF00 >> s;
Lines 223-229 Link Here
223
		}
223
		}
224
	}
224
	}
225
	surface = SDL_AllocSurface(SDL_SWSURFACE, width, height,
225
	surface = SDL_AllocSurface(SDL_SWSURFACE, width, height,
226
			bit_depth*info_ptr->channels, Rmask,Gmask,Bmask,Amask);
226
			bit_depth*png_get_channels(png_ptr, info_ptr), Rmask,Gmask,Bmask,Amask);
227
	if ( surface == NULL ) {
227
	if ( surface == NULL ) {
228
		IMG_SetError("Out of memory");
228
		IMG_SetError("Out of memory");
229
		goto done;
229
		goto done;
Lines 264-269 Link Here
264
	*/
264
	*/
265
265
266
	/* Load the palette, if any */
266
	/* Load the palette, if any */
267
	int num_palette;
267
	palette = surface->format->palette;
268
	palette = surface->format->palette;
268
	if ( palette ) {
269
	if ( palette ) {
269
	    if(color_type == PNG_COLOR_TYPE_GRAY) {
270
	    if(color_type == PNG_COLOR_TYPE_GRAY) {
Lines 273-284 Link Here
273
		    palette->colors[i].g = i;
274
		    palette->colors[i].g = i;
274
		    palette->colors[i].b = i;
275
		    palette->colors[i].b = i;
275
		}
276
		}
276
	    } else if (info_ptr->num_palette > 0 ) {
277
	    } else if (num_palette > 0 ) {
277
		palette->ncolors = info_ptr->num_palette; 
278
		palette->ncolors = num_palette; 
278
		for( i=0; i<info_ptr->num_palette; ++i ) {
279
		for( i=0; i<num_palette; ++i ) {
279
		    palette->colors[i].b = info_ptr->palette[i].blue;
280
		    palette->colors[i].b = palette[i].blue;
280
		    palette->colors[i].g = info_ptr->palette[i].green;
281
		    palette->colors[i].g = palette[i].green;
281
		    palette->colors[i].r = info_ptr->palette[i].red;
282
		    palette->colors[i].r = palette[i].red;
282
		}
283
		}
283
	    }
284
	    }
284
	}
285
	}

Return to bug 378521