diff options
Diffstat (limited to 'libraries/eet/src/lib/eet_image.c')
-rw-r--r-- | libraries/eet/src/lib/eet_image.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/libraries/eet/src/lib/eet_image.c b/libraries/eet/src/lib/eet_image.c index 8c6c03c..b622236 100644 --- a/libraries/eet/src/lib/eet_image.c +++ b/libraries/eet/src/lib/eet_image.c | |||
@@ -246,7 +246,7 @@ eet_data_image_jpeg_rgb_decode(const void *data, | |||
246 | unsigned int w, | 246 | unsigned int w, |
247 | unsigned int h, | 247 | unsigned int h, |
248 | unsigned int row_stride); | 248 | unsigned int row_stride); |
249 | static void * | 249 | static int |
250 | eet_data_image_jpeg_alpha_decode(const void *data, | 250 | eet_data_image_jpeg_alpha_decode(const void *data, |
251 | int size, | 251 | int size, |
252 | unsigned int src_x, | 252 | unsigned int src_x, |
@@ -560,7 +560,7 @@ eet_data_image_jpeg_rgb_decode(const void *data, | |||
560 | return 1; | 560 | return 1; |
561 | } | 561 | } |
562 | 562 | ||
563 | static void * | 563 | static int |
564 | eet_data_image_jpeg_alpha_decode(const void *data, | 564 | eet_data_image_jpeg_alpha_decode(const void *data, |
565 | int size, | 565 | int size, |
566 | unsigned int src_x, | 566 | unsigned int src_x, |
@@ -577,6 +577,10 @@ eet_data_image_jpeg_alpha_decode(const void *data, | |||
577 | unsigned int x, y, l, scans; | 577 | unsigned int x, y, l, scans; |
578 | unsigned int i, iw; | 578 | unsigned int i, iw; |
579 | 579 | ||
580 | /* FIXME: handle src_x, src_y and row_stride correctly */ | ||
581 | if (!d) | ||
582 | return 0; | ||
583 | |||
580 | memset(&cinfo, 0, sizeof (struct jpeg_decompress_struct)); | 584 | memset(&cinfo, 0, sizeof (struct jpeg_decompress_struct)); |
581 | 585 | ||
582 | cinfo.err = jpeg_std_error(&(jerr.pub)); | 586 | cinfo.err = jpeg_std_error(&(jerr.pub)); |
@@ -584,14 +588,14 @@ eet_data_image_jpeg_alpha_decode(const void *data, | |||
584 | jerr.pub.emit_message = _JPEGErrorHandler2; | 588 | jerr.pub.emit_message = _JPEGErrorHandler2; |
585 | jerr.pub.output_message = _JPEGErrorHandler; | 589 | jerr.pub.output_message = _JPEGErrorHandler; |
586 | if (setjmp(jerr.setjmp_buffer)) | 590 | if (setjmp(jerr.setjmp_buffer)) |
587 | return NULL; | 591 | return 0; |
588 | 592 | ||
589 | jpeg_create_decompress(&cinfo); | 593 | jpeg_create_decompress(&cinfo); |
590 | 594 | ||
591 | if (eet_jpeg_membuf_src(&cinfo, data, (size_t)size)) | 595 | if (eet_jpeg_membuf_src(&cinfo, data, (size_t)size)) |
592 | { | 596 | { |
593 | jpeg_destroy_decompress(&cinfo); | 597 | jpeg_destroy_decompress(&cinfo); |
594 | return NULL; | 598 | return 0; |
595 | } | 599 | } |
596 | 600 | ||
597 | jpeg_read_header(&cinfo, TRUE); | 601 | jpeg_read_header(&cinfo, TRUE); |
@@ -609,7 +613,7 @@ eet_data_image_jpeg_alpha_decode(const void *data, | |||
609 | cinfo.src = NULL; | 613 | cinfo.src = NULL; |
610 | 614 | ||
611 | jpeg_destroy_decompress(&cinfo); | 615 | jpeg_destroy_decompress(&cinfo); |
612 | return NULL; | 616 | return 0; |
613 | } | 617 | } |
614 | 618 | ||
615 | /* end head decoding */ | 619 | /* end head decoding */ |
@@ -620,11 +624,12 @@ eet_data_image_jpeg_alpha_decode(const void *data, | |||
620 | cinfo.src = NULL; | 624 | cinfo.src = NULL; |
621 | 625 | ||
622 | jpeg_destroy_decompress(&cinfo); | 626 | jpeg_destroy_decompress(&cinfo); |
623 | return NULL; | 627 | return 0; |
624 | } | 628 | } |
625 | 629 | ||
626 | tdata = alloca(w * 16 * 3); | 630 | tdata = alloca(w * 16 * 3); |
627 | ptr2 = d; | 631 | ptr2 = d; |
632 | |||
628 | if (cinfo.output_components == 1) | 633 | if (cinfo.output_components == 1) |
629 | { | 634 | { |
630 | for (i = 0; i < (unsigned int)cinfo.rec_outbuf_height; i++) | 635 | for (i = 0; i < (unsigned int)cinfo.rec_outbuf_height; i++) |
@@ -666,7 +671,7 @@ eet_data_image_jpeg_alpha_decode(const void *data, | |||
666 | /* end data decoding */ | 671 | /* end data decoding */ |
667 | jpeg_finish_decompress(&cinfo); | 672 | jpeg_finish_decompress(&cinfo); |
668 | jpeg_destroy_decompress(&cinfo); | 673 | jpeg_destroy_decompress(&cinfo); |
669 | return d; | 674 | return 1; |
670 | } | 675 | } |
671 | 676 | ||
672 | static void * | 677 | static void * |