forked from AuroraMiddleware/gtk
Fixed crash-on-loading bug (width and height are not set until
Fixed crash-on-loading bug (width and height are not set until decompression starts) Mark
This commit is contained in:
parent
451d40642c
commit
7befe28245
@ -67,10 +67,13 @@ GdkPixBuf *image_load(FILE *f)
|
|||||||
jpeg_create_decompress(&cinfo);
|
jpeg_create_decompress(&cinfo);
|
||||||
jpeg_stdio_src(&cinfo, f);
|
jpeg_stdio_src(&cinfo, f);
|
||||||
jpeg_read_header(&cinfo, TRUE);
|
jpeg_read_header(&cinfo, TRUE);
|
||||||
|
jpeg_start_decompress(&cinfo);
|
||||||
cinfo.do_fancy_upsampling = FALSE;
|
cinfo.do_fancy_upsampling = FALSE;
|
||||||
cinfo.do_block_smoothing = FALSE;
|
cinfo.do_block_smoothing = FALSE;
|
||||||
|
|
||||||
w = cinfo.output_width;
|
w = cinfo.output_width;
|
||||||
h = cinfo.output_height;
|
h = cinfo.output_height;
|
||||||
|
g_print("w: %d h: %d\n", w, h);
|
||||||
|
|
||||||
pixels = art_alloc(h * w * 3);
|
pixels = art_alloc(h * w * 3);
|
||||||
if (pixels == NULL) {
|
if (pixels == NULL) {
|
||||||
@ -80,7 +83,6 @@ GdkPixBuf *image_load(FILE *f)
|
|||||||
dptr = pixels;
|
dptr = pixels;
|
||||||
|
|
||||||
/* decompress all the lines, a few at a time */
|
/* decompress all the lines, a few at a time */
|
||||||
jpeg_start_decompress(&cinfo);
|
|
||||||
|
|
||||||
while (cinfo.output_scanline < cinfo.output_height) {
|
while (cinfo.output_scanline < cinfo.output_height) {
|
||||||
lptr = lines;
|
lptr = lines;
|
||||||
|
Loading…
Reference in New Issue
Block a user