summaryrefslogtreecommitdiff
path: root/src/modules/evas/loaders/jpeg/evas_image_load_jpeg.c
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@samsung.com>2013-05-02 17:17:42 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-05-06 19:02:04 +0900
commit7d83e4204677a4501e1c7ec3ad08a2ec0d625dbc (patch)
treece3c72a9a2c1dee302ff377c19d6170c31747292 /src/modules/evas/loaders/jpeg/evas_image_load_jpeg.c
parent6f802ab2340b95d9c6422b814bc71e5707ed9353 (diff)
evas: move evas cache API outside of the image data loader API.
Diffstat (limited to '')
-rw-r--r--src/modules/evas/loaders/jpeg/evas_image_load_jpeg.c250
1 files changed, 110 insertions, 140 deletions
diff --git a/src/modules/evas/loaders/jpeg/evas_image_load_jpeg.c b/src/modules/evas/loaders/jpeg/evas_image_load_jpeg.c
index 390fe6e0de..5417e4aa2d 100644
--- a/src/modules/evas/loaders/jpeg/evas_image_load_jpeg.c
+++ b/src/modules/evas/loaders/jpeg/evas_image_load_jpeg.c
@@ -29,34 +29,10 @@ static int _get_orientation_app0(char *app0_head, size_t remain_length);
29static int _get_orientation_app1(char *app1_head, size_t remain_length); 29static int _get_orientation_app1(char *app1_head, size_t remain_length);
30static int _get_orientation(void *map, size_t length); 30static int _get_orientation(void *map, size_t length);
31 31
32static Eina_Bool evas_image_load_file_head_jpeg_internal(unsigned int *w,
33 unsigned int *h,
34 unsigned char *scale,
35 Evas_Image_Load_Opts *opts,
36 void *map,
37 size_t len,
38 int *error);
39static Eina_Bool evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
40 void *map,
41 size_t len,
42 int *error) EINA_ARG_NONNULL(1, 2, 4);
43#if 0 /* not used at the moment */ 32#if 0 /* not used at the moment */
44static int evas_image_load_file_data_jpeg_alpha_internal(Image_Entry *ie, FILE *f) EINA_ARG_NONNULL(1, 2); 33static int evas_image_load_file_data_jpeg_alpha_internal(Image_Entry *ie, FILE *f) EINA_ARG_NONNULL(1, 2);
45#endif 34#endif
46 35
47static Eina_Bool evas_image_load_file_head_jpeg(Eina_File *f, const char *key, Evas_Image_Property *prop, Evas_Image_Load_Opts *opts, Evas_Image_Animated *animated, int *error);
48static Eina_Bool evas_image_load_file_data_jpeg(Image_Entry *ie, const char *file, const char *key, int *error) EINA_ARG_NONNULL(1, 2, 4);
49
50static Evas_Image_Load_Func evas_image_load_jpeg_func =
51{
52 EINA_TRUE,
53 evas_image_load_file_head_jpeg,
54 evas_image_load_file_data_jpeg,
55 NULL,
56 EINA_TRUE
57};
58
59
60static void 36static void
61_JPEGFatalErrorHandler(j_common_ptr cinfo) 37_JPEGFatalErrorHandler(j_common_ptr cinfo)
62{ 38{
@@ -309,7 +285,7 @@ _get_orientation(void *map, size_t length)
309 285
310static Eina_Bool 286static Eina_Bool
311evas_image_load_file_head_jpeg_internal(unsigned int *w, unsigned int *h, 287evas_image_load_file_head_jpeg_internal(unsigned int *w, unsigned int *h,
312 unsigned char *scale, 288 unsigned char *scale, unsigned char *rotated,
313 Evas_Image_Load_Opts *opts, 289 Evas_Image_Load_Opts *opts,
314 void *map, size_t length, 290 void *map, size_t length,
315 int *error) 291 int *error)
@@ -320,7 +296,7 @@ evas_image_load_file_head_jpeg_internal(unsigned int *w, unsigned int *h,
320 296
321 /* for rotation decoding */ 297 /* for rotation decoding */
322 int degree = 0; 298 int degree = 0;
323 Eina_Bool change_wh = EINA_FALSE, rotated = EINA_FALSE; 299 Eina_Bool change_wh = EINA_FALSE;
324 unsigned int load_opts_w = 0, load_opts_h = 0; 300 unsigned int load_opts_w = 0, load_opts_h = 0;
325 301
326 memset(&cinfo, 0, sizeof(cinfo)); 302 memset(&cinfo, 0, sizeof(cinfo));
@@ -362,7 +338,7 @@ evas_image_load_file_head_jpeg_internal(unsigned int *w, unsigned int *h,
362 if (degree != 0) 338 if (degree != 0)
363 { 339 {
364 opts->degree = degree; 340 opts->degree = degree;
365 rotated = EINA_TRUE; 341 *rotated = EINA_TRUE;
366 342
367 if (degree == 90 || degree == 270) 343 if (degree == 90 || degree == 270)
368 change_wh = EINA_TRUE; 344 change_wh = EINA_TRUE;
@@ -484,7 +460,7 @@ evas_image_load_file_head_jpeg_internal(unsigned int *w, unsigned int *h,
484 { 460 {
485 unsigned int load_region_x = 0, load_region_y = 0; 461 unsigned int load_region_x = 0, load_region_y = 0;
486 unsigned int load_region_w = 0, load_region_h = 0; 462 unsigned int load_region_w = 0, load_region_h = 0;
487 if (rotated) 463 if (*rotated)
488 { 464 {
489 load_region_x = opts->region.x; 465 load_region_x = opts->region.x;
490 load_region_y = opts->region.y; 466 load_region_y = opts->region.y;
@@ -527,7 +503,7 @@ evas_image_load_file_head_jpeg_internal(unsigned int *w, unsigned int *h,
527 } 503 }
528 *w = opts->region.w; 504 *w = opts->region.w;
529 *h = opts->region.h; 505 *h = opts->region.h;
530 if (rotated) 506 if (*rotated)
531 { 507 {
532 opts->region.x = load_region_x; 508 opts->region.x = load_region_x;
533 opts->region.y = load_region_y; 509 opts->region.y = load_region_y;
@@ -562,7 +538,9 @@ get_time(void)
562*/ 538*/
563 539
564static Eina_Bool 540static Eina_Bool
565evas_image_load_file_data_jpeg_internal(Image_Entry *ie, 541evas_image_load_file_data_jpeg_internal(Evas_Image_Load_Opts *opts,
542 Evas_Image_Property *prop,
543 void *pixels,
566 void *map, size_t size, 544 void *map, size_t size,
567 int *error) 545 int *error)
568{ 546{
@@ -582,9 +560,9 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
582 Eina_Bool line_done = EINA_FALSE; 560 Eina_Bool line_done = EINA_FALSE;
583 561
584 memset(&cinfo, 0, sizeof(cinfo)); 562 memset(&cinfo, 0, sizeof(cinfo));
585 if (ie->flags.rotated) 563 if (prop->rotated)
586 { 564 {
587 degree = ie->load_opts.degree; 565 degree = opts->degree;
588 if (degree == 90 || degree == 270) 566 if (degree == 90 || degree == 270)
589 change_wh = EINA_TRUE; 567 change_wh = EINA_TRUE;
590 } 568 }
@@ -616,10 +594,10 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
616 cinfo.dct_method = JDCT_ISLOW; // JDCT_FLOAT JDCT_IFAST(quality loss) 594 cinfo.dct_method = JDCT_ISLOW; // JDCT_FLOAT JDCT_IFAST(quality loss)
617 cinfo.dither_mode = JDITHER_ORDERED; 595 cinfo.dither_mode = JDITHER_ORDERED;
618 596
619 if (ie->scale > 1) 597 if (prop->scale > 1)
620 { 598 {
621 cinfo.scale_num = 1; 599 cinfo.scale_num = 1;
622 cinfo.scale_denom = ie->scale; 600 cinfo.scale_denom = prop->scale;
623 } 601 }
624 602
625 /* Colorspace conversion options */ 603 /* Colorspace conversion options */
@@ -652,44 +630,44 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
652 630
653 if (change_wh) 631 if (change_wh)
654 { 632 {
655 ie_w = ie->h; 633 ie_w = prop->h;
656 ie_h = ie->w; 634 ie_h = prop->w;
657 } 635 }
658 else 636 else
659 { 637 {
660 ie_w = ie->w; 638 ie_w = prop->w;
661 ie_h = ie->h; 639 ie_h = prop->h;
662 } 640 }
663 641
664 if ((ie->load_opts.region.w > 0) && (ie->load_opts.region.h > 0)) 642 if ((opts->region.w > 0) && (opts->region.h > 0))
665 { 643 {
666 region = 1; 644 region = 1;
667 645
668 if (ie->flags.rotated) 646 if (prop->rotated)
669 { 647 {
670 load_region_x = ie->load_opts.region.x; 648 load_region_x = opts->region.x;
671 load_region_y = ie->load_opts.region.y; 649 load_region_y = opts->region.y;
672 load_region_w = ie->load_opts.region.w; 650 load_region_w = opts->region.w;
673 load_region_h = ie->load_opts.region.h; 651 load_region_h = opts->region.h;
674 652
675 switch (degree) 653 switch (degree)
676 { 654 {
677 case 90: 655 case 90:
678 ie->load_opts.region.x = load_region_y; 656 opts->region.x = load_region_y;
679 ie->load_opts.region.y = h - (load_region_x + load_region_w); 657 opts->region.y = h - (load_region_x + load_region_w);
680 ie->load_opts.region.w = load_region_h; 658 opts->region.w = load_region_h;
681 ie->load_opts.region.h = load_region_w; 659 opts->region.h = load_region_w;
682 break; 660 break;
683 case 180: 661 case 180:
684 ie->load_opts.region.x = w - (load_region_x+ load_region_w); 662 opts->region.x = w - (load_region_x+ load_region_w);
685 ie->load_opts.region.y = h - (load_region_y + load_region_h); 663 opts->region.y = h - (load_region_y + load_region_h);
686 664
687 break; 665 break;
688 case 270: 666 case 270:
689 ie->load_opts.region.x = w - (load_region_y + load_region_h); 667 opts->region.x = w - (load_region_y + load_region_h);
690 ie->load_opts.region.y = load_region_x; 668 opts->region.y = load_region_x;
691 ie->load_opts.region.w = load_region_h; 669 opts->region.w = load_region_h;
692 ie->load_opts.region.h = load_region_w; 670 opts->region.h = load_region_w;
693 break; 671 break;
694 default: 672 default:
695 break; 673 break;
@@ -697,10 +675,10 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
697 675
698 } 676 }
699#ifdef BUILD_LOADER_JPEG_REGION 677#ifdef BUILD_LOADER_JPEG_REGION
700 cinfo.region_x = ie->load_opts.region.x; 678 cinfo.region_x = opts->region.x;
701 cinfo.region_y = ie->load_opts.region.y; 679 cinfo.region_y = opts->region.y;
702 cinfo.region_w = ie->load_opts.region.w; 680 cinfo.region_w = opts->region.w;
703 cinfo.region_h = ie->load_opts.region.h; 681 cinfo.region_h = opts->region.h;
704#endif 682#endif
705 } 683 }
706 if ((!region) && ((w != ie_w) || (h != ie_h))) 684 if ((!region) && ((w != ie_w) || (h != ie_h)))
@@ -713,21 +691,24 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
713 return EINA_FALSE; 691 return EINA_FALSE;
714 } 692 }
715 if ((region) && 693 if ((region) &&
716 ((ie_w != ie->load_opts.region.w) || (ie_h != ie->load_opts.region.h))) 694 ((ie_w != opts->region.w) || (ie_h != opts->region.h)))
717 { 695 {
718 ie_w = ie->load_opts.region.w; 696 jpeg_destroy_decompress(&cinfo);
719 ie_h = ie->load_opts.region.h; 697 _evas_jpeg_membuf_src_term(&cinfo);
720 if (change_wh) 698 *error = EVAS_LOAD_ERROR_GENERIC;
721 { 699 return EINA_FALSE;
722 ie->w = ie_h; 700 /* ie_w = opts->region.w; */
723 ie->h = ie_w; 701 /* ie_h = opts->region.h; */
724 } 702 /* if (change_wh) */
725 else 703 /* { */
726 { 704 /* ie->w = ie_h; */
727 ie->w = ie_w; 705 /* ie->h = ie_w; */
728 ie->h = ie_h; 706 /* } */
729 } 707 /* else */
730 708 /* { */
709 /* ie->w = ie_w; */
710 /* ie->h = ie_h; */
711 /* } */
731 } 712 }
732 713
733 if (!(((cinfo.out_color_space == JCS_RGB) && 714 if (!(((cinfo.out_color_space == JCS_RGB) &&
@@ -750,28 +731,13 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
750 return EINA_FALSE; 731 return EINA_FALSE;
751 } 732 }
752 data = alloca(w * 16 * cinfo.output_components); 733 data = alloca(w * 16 * cinfo.output_components);
753 evas_cache_image_surface_alloc(ie, ie->w, ie->h); 734 if ((prop->rotated) && change_wh)
754 if (ie->flags.loaded)
755 { 735 {
756 jpeg_destroy_decompress(&cinfo); 736 ptr2 = malloc(w * h * sizeof(DATA32));
757 _evas_jpeg_membuf_src_term(&cinfo);
758 *error = EVAS_LOAD_ERROR_NONE;
759 if (region && ie->flags.rotated)
760 {
761 ie->load_opts.region.x = load_region_x;
762 ie->load_opts.region.y = load_region_y;
763 ie->load_opts.region.w = load_region_w;
764 ie->load_opts.region.h = load_region_h;
765 }
766 return EINA_TRUE;
767 }
768 if ((ie->flags.rotated) && change_wh)
769 {
770 ptr2 = malloc(ie->w * ie->h * sizeof(DATA32));
771 ptr_rotate = ptr2; 737 ptr_rotate = ptr2;
772 } 738 }
773 else 739 else
774 ptr2 = evas_cache_image_pixels(ie); 740 ptr2 = pixels;
775 741
776 if (!ptr2) 742 if (!ptr2)
777 { 743 {
@@ -841,7 +807,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
841 else 807 else
842 { 808 {
843 // if line # > region last line, break 809 // if line # > region last line, break
844 if (l >= (ie->load_opts.region.y + ie->load_opts.region.h)) 810 if (l >= (opts->region.y + opts->region.h))
845 { 811 {
846 line_done = EINA_TRUE; 812 line_done = EINA_TRUE;
847 /* if rotation flag is set , we have to rotate image */ 813 /* if rotation flag is set , we have to rotate image */
@@ -853,17 +819,17 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
853 } 819 }
854 // els if scan block intersects region start or later 820 // els if scan block intersects region start or later
855 else if ((l + scans) > 821 else if ((l + scans) >
856 (ie->load_opts.region.y)) 822 (opts->region.y))
857 { 823 {
858 for (y = 0; y < scans; y++) 824 for (y = 0; y < scans; y++)
859 { 825 {
860 if (((y + l) >= ie->load_opts.region.y) && 826 if (((y + l) >= opts->region.y) &&
861 ((y + l) < (ie->load_opts.region.y + ie->load_opts.region.h))) 827 ((y + l) < (opts->region.y + opts->region.h)))
862 { 828 {
863 ptr += ie->load_opts.region.x; 829 ptr += opts->region.x;
864 if (cinfo.saw_Adobe_marker) 830 if (cinfo.saw_Adobe_marker)
865 { 831 {
866 for (x = 0; x < ie->load_opts.region.w; x++) 832 for (x = 0; x < opts->region.w; x++)
867 { 833 {
868 /* According to libjpeg doc, Photoshop inverse the values of C, M, Y and K, */ 834 /* According to libjpeg doc, Photoshop inverse the values of C, M, Y and K, */
869 /* that is C is replaces by 255 - C, etc...*/ 835 /* that is C is replaces by 255 - C, etc...*/
@@ -879,7 +845,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
879 } 845 }
880 else 846 else
881 { 847 {
882 for (x = 0; x < ie->load_opts.region.w; x++) 848 for (x = 0; x < opts->region.w; x++)
883 { 849 {
884 /* Conversion from CMYK to RGB is done in 2 steps: */ 850 /* Conversion from CMYK to RGB is done in 2 steps: */
885 /* CMYK => CMY => RGB (see http://www.easyrgb.com/index.php?X=MATH) */ 851 /* CMYK => CMY => RGB (see http://www.easyrgb.com/index.php?X=MATH) */
@@ -902,7 +868,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
902 ptr2++; 868 ptr2++;
903 } 869 }
904 } 870 }
905 ptr += (4 * (w - (ie->load_opts.region.x + ie->load_opts.region.w))); 871 ptr += (4 * (w - (opts->region.x + opts->region.w)));
906 } 872 }
907 else 873 else
908 ptr += (4 * w); 874 ptr += (4 * w);
@@ -923,10 +889,10 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
923 ie, 889 ie,
924 ie->w, ie->h, 890 ie->w, ie->h,
925 ie->file, 891 ie->file,
926 ie->load_opts.region.x, 892 opts->region.x,
927 ie->load_opts.region.y, 893 opts->region.y,
928 ie->load_opts.region.w, 894 opts->region.w,
929 ie->load_opts.region.h); 895 opts->region.h);
930 } 896 }
931 t = get_time(); 897 t = get_time();
932 */ 898 */
@@ -954,7 +920,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
954 { 920 {
955 // if line # > region last line, break 921 // if line # > region last line, break
956 // but not return immediately for rotation job 922 // but not return immediately for rotation job
957 if (l >= (ie->load_opts.region.y + ie->load_opts.region.h)) 923 if (l >= (opts->region.y + opts->region.h))
958 { 924 {
959 line_done = EINA_TRUE; 925 line_done = EINA_TRUE;
960 /* if rotation flag is set , we have to rotate image */ 926 /* if rotation flag is set , we have to rotate image */
@@ -962,21 +928,21 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
962 } 928 }
963 // else if scan block intersects region start or later 929 // else if scan block intersects region start or later
964 else if ((l + scans) > 930 else if ((l + scans) >
965 (ie->load_opts.region.y)) 931 (opts->region.y))
966 { 932 {
967 for (y = 0; y < scans; y++) 933 for (y = 0; y < scans; y++)
968 { 934 {
969 if (((y + l) >= ie->load_opts.region.y) && 935 if (((y + l) >= opts->region.y) &&
970 ((y + l) < (ie->load_opts.region.y + ie->load_opts.region.h))) 936 ((y + l) < (opts->region.y + opts->region.h)))
971 { 937 {
972 ptr += (3 * ie->load_opts.region.x); 938 ptr += (3 * opts->region.x);
973 for (x = 0; x < ie->load_opts.region.w; x++) 939 for (x = 0; x < opts->region.w; x++)
974 { 940 {
975 *ptr2 = ARGB_JOIN(0xff, ptr[0], ptr[1], ptr[2]); 941 *ptr2 = ARGB_JOIN(0xff, ptr[0], ptr[1], ptr[2]);
976 ptr += 3; 942 ptr += 3;
977 ptr2++; 943 ptr2++;
978 } 944 }
979 ptr += (3 * (w - (ie->load_opts.region.x + ie->load_opts.region.w))); 945 ptr += (3 * (w - (opts->region.x + opts->region.w)));
980 } 946 }
981 else 947 else
982 ptr += (3 * w); 948 ptr += (3 * w);
@@ -1015,7 +981,7 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
1015 else 981 else
1016 { 982 {
1017 // if line # > region last line, break 983 // if line # > region last line, break
1018 if (l >= (ie->load_opts.region.y + ie->load_opts.region.h)) 984 if (l >= (opts->region.y + opts->region.h))
1019 { 985 {
1020 line_done = EINA_TRUE; 986 line_done = EINA_TRUE;
1021 /* if rotation flag is set , we have to rotate image */ 987 /* if rotation flag is set , we have to rotate image */
@@ -1027,21 +993,21 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
1027 } 993 }
1028 // els if scan block intersects region start or later 994 // els if scan block intersects region start or later
1029 else if ((l + scans) > 995 else if ((l + scans) >
1030 (ie->load_opts.region.y)) 996 (opts->region.y))
1031 { 997 {
1032 for (y = 0; y < scans; y++) 998 for (y = 0; y < scans; y++)
1033 { 999 {
1034 if (((y + l) >= ie->load_opts.region.y) && 1000 if (((y + l) >= opts->region.y) &&
1035 ((y + l) < (ie->load_opts.region.y + ie->load_opts.region.h))) 1001 ((y + l) < (opts->region.y + opts->region.h)))
1036 { 1002 {
1037 ptr += ie->load_opts.region.x; 1003 ptr += opts->region.x;
1038 for (x = 0; x < ie->load_opts.region.w; x++) 1004 for (x = 0; x < opts->region.w; x++)
1039 { 1005 {
1040 *ptr2 = ARGB_JOIN(0xff, ptr[0], ptr[0], ptr[0]); 1006 *ptr2 = ARGB_JOIN(0xff, ptr[0], ptr[0], ptr[0]);
1041 ptr++; 1007 ptr++;
1042 ptr2++; 1008 ptr2++;
1043 } 1009 }
1044 ptr += w - (ie->load_opts.region.x + ie->load_opts.region.w); 1010 ptr += w - (opts->region.x + opts->region.w);
1045 } 1011 }
1046 else 1012 else
1047 ptr += w; 1013 ptr += w;
@@ -1053,16 +1019,16 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie,
1053 /* if rotation operation need, rotate it */ 1019 /* if rotation operation need, rotate it */
1054done: 1020done:
1055 1021
1056 if (ie->flags.rotated) 1022 if (prop->rotated)
1057 { 1023 {
1058 DATA32 *data1, *data2, *to, *from; 1024 DATA32 *data1, *data2, *to, *from;
1059 int lx, ly, lw, lh, hw; 1025 int lx, ly, lw, lh, hw;
1060 1026
1061 lw = ie->w; 1027 lw = w;
1062 lh = ie->h; 1028 lh = h;
1063 hw =lw * lh; 1029 hw = lw * lh;
1064 1030
1065 data1 = evas_cache_image_pixels(ie); 1031 data1 = pixels;
1066 1032
1067 if (degree == 180) 1033 if (degree == 180)
1068 { 1034 {
@@ -1099,9 +1065,9 @@ done:
1099 if (to) 1065 if (to)
1100 { 1066 {
1101 from = data2; 1067 from = data2;
1102 for (lx = ie->w; --lx >= 0;) 1068 for (lx = w; --lx >= 0;)
1103 { 1069 {
1104 for (ly =ie->h; --ly >= 0;) 1070 for (ly = h; --ly >= 0;)
1105 { 1071 {
1106 *to = *from; 1072 *to = *from;
1107 from++; 1073 from++;
@@ -1118,10 +1084,10 @@ done:
1118 } 1084 }
1119 if (region) 1085 if (region)
1120 { 1086 {
1121 ie->load_opts.region.x = load_region_x; 1087 opts->region.x = load_region_x;
1122 ie->load_opts.region.y = load_region_y; 1088 opts->region.y = load_region_y;
1123 ie->load_opts.region.w = load_region_w; 1089 opts->region.w = load_region_w;
1124 ie->load_opts.region.h = load_region_h; 1090 opts->region.h = load_region_h;
1125 } 1091 }
1126 } 1092 }
1127 1093
@@ -1261,7 +1227,7 @@ evas_image_load_file_head_jpeg(Eina_File *f, const char *key EINA_UNUSED, Evas_I
1261 } 1227 }
1262 1228
1263 val = evas_image_load_file_head_jpeg_internal(&prop->w, &prop->h, 1229 val = evas_image_load_file_head_jpeg_internal(&prop->w, &prop->h,
1264 &prop->scale, 1230 &prop->scale, &prop->rotated,
1265 opts, 1231 opts,
1266 map, eina_file_size_get(f), 1232 map, eina_file_size_get(f),
1267 error); 1233 error);
@@ -1273,20 +1239,16 @@ evas_image_load_file_head_jpeg(Eina_File *f, const char *key EINA_UNUSED, Evas_I
1273} 1239}
1274 1240
1275static Eina_Bool 1241static Eina_Bool
1276evas_image_load_file_data_jpeg(Image_Entry *ie, 1242evas_image_load_file_data_jpeg(Eina_File *f, const char *key EINA_UNUSED,
1277 const char *file, const char *key EINA_UNUSED, 1243 Evas_Image_Property *prop,
1278 int *error) 1244 Evas_Image_Load_Opts *opts,
1245 Evas_Image_Animated *animated EINA_UNUSED,
1246 void *pixels,
1247 int *error)
1279{ 1248{
1280 Eina_File *f;
1281 void *map; 1249 void *map;
1282 Eina_Bool val = EINA_FALSE; 1250 Eina_Bool val = EINA_FALSE;
1283 1251
1284 f = eina_file_open(file, EINA_FALSE);
1285 if (!f)
1286 {
1287 *error = EVAS_LOAD_ERROR_DOES_NOT_EXIST;
1288 return EINA_FALSE;
1289 }
1290 map = eina_file_map_all(f, EINA_FILE_WILLNEED); 1252 map = eina_file_map_all(f, EINA_FILE_WILLNEED);
1291 if (!map) 1253 if (!map)
1292 { 1254 {
@@ -1294,17 +1256,25 @@ evas_image_load_file_data_jpeg(Image_Entry *ie,
1294 goto on_error; 1256 goto on_error;
1295 } 1257 }
1296 1258
1297 val = evas_image_load_file_data_jpeg_internal(ie, 1259 val = evas_image_load_file_data_jpeg_internal(opts, prop, pixels,
1298 map, eina_file_size_get(f), 1260 map, eina_file_size_get(f),
1299 error); 1261 error);
1300 1262
1301 eina_file_map_free(f, map); 1263 eina_file_map_free(f, map);
1302 1264
1303 on_error: 1265 on_error:
1304 eina_file_close(f);
1305 return val; 1266 return val;
1306} 1267}
1307 1268
1269static Evas_Image_Load_Func evas_image_load_jpeg_func =
1270{
1271 EINA_TRUE,
1272 evas_image_load_file_head_jpeg,
1273 evas_image_load_file_data_jpeg,
1274 NULL,
1275 EINA_TRUE
1276};
1277
1308static int 1278static int
1309module_open(Evas_Module *em) 1279module_open(Evas_Module *em)
1310{ 1280{