diff options
author | David Walter Seikel | 2012-04-22 09:19:23 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-04-22 09:19:23 +1000 |
commit | c963d75dfdeec11f82e79e727062fbf89afa2c04 (patch) | |
tree | 895633dbf641110be46f117c29890c49b3ffc0bd /libraries/evas/src/modules/loaders/jpeg/evas_image_load_jpeg.c | |
parent | Adding the new extantz viewer and grid manager. (diff) | |
download | SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.zip SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.gz SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.bz2 SledjHamr-c963d75dfdeec11f82e79e727062fbf89afa2c04.tar.xz |
Update EFL to latest beta.
Diffstat (limited to '')
-rw-r--r-- | libraries/evas/src/modules/loaders/jpeg/evas_image_load_jpeg.c | 85 |
1 files changed, 47 insertions, 38 deletions
diff --git a/libraries/evas/src/modules/loaders/jpeg/evas_image_load_jpeg.c b/libraries/evas/src/modules/loaders/jpeg/evas_image_load_jpeg.c index 797c76d..73a7310 100644 --- a/libraries/evas/src/modules/loaders/jpeg/evas_image_load_jpeg.c +++ b/libraries/evas/src/modules/loaders/jpeg/evas_image_load_jpeg.c | |||
@@ -272,7 +272,7 @@ evas_image_load_file_head_jpeg_internal(Image_Entry *ie, | |||
272 | *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; | 272 | *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; |
273 | return EINA_FALSE; | 273 | return EINA_FALSE; |
274 | } | 274 | } |
275 | jpeg_create_decompress(&cinfo); | 275 | jpeg_create_decompress(&cinfo); |
276 | 276 | ||
277 | if (_evas_jpeg_membuf_src(&cinfo, map, length)) | 277 | if (_evas_jpeg_membuf_src(&cinfo, map, length)) |
278 | { | 278 | { |
@@ -508,11 +508,11 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, | |||
508 | unsigned int x, y, l, i, scans; | 508 | unsigned int x, y, l, i, scans; |
509 | int region = 0; | 509 | int region = 0; |
510 | /* rotation setting */ | 510 | /* rotation setting */ |
511 | unsigned int tmp; | 511 | unsigned int ie_w = 0, ie_h = 0; |
512 | unsigned int load_region_x = 0, load_region_y = 0; | 512 | unsigned int load_region_x = 0, load_region_y = 0; |
513 | unsigned int load_region_w = 0, load_region_h = 0; | 513 | unsigned int load_region_w = 0, load_region_h = 0; |
514 | int degree = 0; | 514 | volatile int degree = 0; |
515 | Eina_Bool change_wh = EINA_FALSE; | 515 | volatile Eina_Bool change_wh = EINA_FALSE; |
516 | Eina_Bool line_done = EINA_FALSE; | 516 | Eina_Bool line_done = EINA_FALSE; |
517 | 517 | ||
518 | if (ie->flags.rotated) | 518 | if (ie->flags.rotated) |
@@ -582,9 +582,13 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, | |||
582 | 582 | ||
583 | if (change_wh) | 583 | if (change_wh) |
584 | { | 584 | { |
585 | tmp = ie->w; | 585 | ie_w = ie->h; |
586 | ie->w = ie->h; | 586 | ie_h = ie->w; |
587 | ie->h = tmp; | 587 | } |
588 | else | ||
589 | { | ||
590 | ie_w = ie->w; | ||
591 | ie_h = ie->h; | ||
588 | } | 592 | } |
589 | 593 | ||
590 | if ((ie->load_opts.region.w > 0) && (ie->load_opts.region.h > 0)) | 594 | if ((ie->load_opts.region.w > 0) && (ie->load_opts.region.h > 0)) |
@@ -629,20 +633,31 @@ evas_image_load_file_data_jpeg_internal(Image_Entry *ie, | |||
629 | cinfo.region_h = ie->load_opts.region.h; | 633 | cinfo.region_h = ie->load_opts.region.h; |
630 | #endif | 634 | #endif |
631 | } | 635 | } |
632 | if ((!region) && ((w != ie->w) || (h != ie->h))) | 636 | if ((!region) && ((w != ie_w) || (h != ie_h))) |
633 | { | 637 | { |
634 | // race condition, the file could have change from when we call header | 638 | // race condition, the file could have change from when we call header |
635 | // this test will not solve the problem with region code. | 639 | // this test will not solve the problem with region code. |
636 | jpeg_destroy_decompress(&cinfo); | 640 | jpeg_destroy_decompress(&cinfo); |
637 | _evas_jpeg_membuf_src_term(&cinfo); | 641 | _evas_jpeg_membuf_src_term(&cinfo); |
638 | *error = EVAS_LOAD_ERROR_GENERIC; | 642 | *error = EVAS_LOAD_ERROR_GENERIC; |
639 | return EINA_FALSE; | 643 | return EINA_FALSE; |
640 | } | 644 | } |
641 | if ((region) && | 645 | if ((region) && |
642 | ((ie->w != ie->load_opts.region.w) || (ie->h != ie->load_opts.region.h))) | 646 | ((ie_w != ie->load_opts.region.w) || (ie_h != ie->load_opts.region.h))) |
643 | { | 647 | { |
644 | ie->w = ie->load_opts.region.w; | 648 | ie_w = ie->load_opts.region.w; |
645 | ie->h = ie->load_opts.region.h; | 649 | ie_h = ie->load_opts.region.h; |
650 | if (change_wh) | ||
651 | { | ||
652 | ie->w = ie_h; | ||
653 | ie->h = ie_w; | ||
654 | } | ||
655 | else | ||
656 | { | ||
657 | ie->w = ie_w; | ||
658 | ie->h = ie_h; | ||
659 | } | ||
660 | |||
646 | } | 661 | } |
647 | 662 | ||
648 | if (!(((cinfo.out_color_space == JCS_RGB) && | 663 | if (!(((cinfo.out_color_space == JCS_RGB) && |
@@ -971,31 +986,24 @@ done: | |||
971 | if (ie->flags.rotated) | 986 | if (ie->flags.rotated) |
972 | { | 987 | { |
973 | DATA32 *data1, *data2, *to, *from; | 988 | DATA32 *data1, *data2, *to, *from; |
974 | int x, y, w, h, hw; | 989 | int lx, ly, lw, lh, hw; |
975 | |||
976 | if (change_wh) | ||
977 | { | ||
978 | tmp = ie->w; | ||
979 | ie->w = ie->h; | ||
980 | ie->h = tmp; | ||
981 | } | ||
982 | 990 | ||
983 | w = ie->w; | 991 | lw = ie->w; |
984 | h = ie->h; | 992 | lh = ie->h; |
985 | hw =w * h; | 993 | hw =lw * lh; |
986 | 994 | ||
987 | data1 = evas_cache_image_pixels(ie); | 995 | data1 = evas_cache_image_pixels(ie); |
988 | 996 | ||
989 | if (degree == 180) | 997 | if (degree == 180) |
990 | { | 998 | { |
991 | DATA32 tmp; | 999 | DATA32 tmpd; |
992 | 1000 | ||
993 | data2 = data1 + (h * w) -1; | 1001 | data2 = data1 + (lh * lw) -1; |
994 | for (x = (w * h) / 2; --x >= 0;) | 1002 | for (lx = (lw * lh) / 2; --lx >= 0;) |
995 | { | 1003 | { |
996 | tmp = *data1; | 1004 | tmpd = *data1; |
997 | *data1 = *data2; | 1005 | *data1 = *data2; |
998 | *data2 = tmp; | 1006 | *data2 = tmpd; |
999 | data1++; | 1007 | data1++; |
1000 | data2--; | 1008 | data2--; |
1001 | } | 1009 | } |
@@ -1008,26 +1016,26 @@ done: | |||
1008 | 1016 | ||
1009 | if (degree == 90) | 1017 | if (degree == 90) |
1010 | { | 1018 | { |
1011 | to = data1 + w - 1; | 1019 | to = data1 + lw - 1; |
1012 | hw = -hw - 1; | 1020 | hw = -hw - 1; |
1013 | } | 1021 | } |
1014 | else if (degree == 270) | 1022 | else if (degree == 270) |
1015 | { | 1023 | { |
1016 | to = data1 + hw - w; | 1024 | to = data1 + hw - lw; |
1017 | w = -w; | 1025 | lw = -lw; |
1018 | hw = hw + 1; | 1026 | hw = hw + 1; |
1019 | } | 1027 | } |
1020 | 1028 | ||
1021 | if (to) | 1029 | if (to) |
1022 | { | 1030 | { |
1023 | from = data2; | 1031 | from = data2; |
1024 | for (x = ie->w; --x >= 0;) | 1032 | for (lx = ie->w; --lx >= 0;) |
1025 | { | 1033 | { |
1026 | for (y =ie->h; --y >= 0;) | 1034 | for (ly =ie->h; --ly >= 0;) |
1027 | { | 1035 | { |
1028 | *to = *from; | 1036 | *to = *from; |
1029 | from++; | 1037 | from++; |
1030 | to += w; | 1038 | to += lw; |
1031 | } | 1039 | } |
1032 | to += hw; | 1040 | to += hw; |
1033 | } | 1041 | } |
@@ -1046,6 +1054,7 @@ done: | |||
1046 | ie->load_opts.region.h = load_region_h; | 1054 | ie->load_opts.region.h = load_region_h; |
1047 | } | 1055 | } |
1048 | } | 1056 | } |
1057 | |||
1049 | if (line_done) | 1058 | if (line_done) |
1050 | { | 1059 | { |
1051 | jpeg_destroy_decompress(&cinfo); | 1060 | jpeg_destroy_decompress(&cinfo); |