aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/modules/loaders/jpeg
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/evas/src/modules/loaders/jpeg')
-rw-r--r--libraries/evas/src/modules/loaders/jpeg/Makefile.am5
-rw-r--r--libraries/evas/src/modules/loaders/jpeg/Makefile.in12
-rw-r--r--libraries/evas/src/modules/loaders/jpeg/evas_image_load_jpeg.c85
3 files changed, 53 insertions, 49 deletions
diff --git a/libraries/evas/src/modules/loaders/jpeg/Makefile.am b/libraries/evas/src/modules/loaders/jpeg/Makefile.am
index 2088ba8..a7a19ab 100644
--- a/libraries/evas/src/modules/loaders/jpeg/Makefile.am
+++ b/libraries/evas/src/modules/loaders/jpeg/Makefile.am
@@ -9,10 +9,7 @@ AM_CPPFLAGS = \
9@PIXMAN_CFLAGS@ \ 9@PIXMAN_CFLAGS@ \
10@EINA_CFLAGS@ \ 10@EINA_CFLAGS@ \
11@evas_image_loader_jpeg_cflags@ \ 11@evas_image_loader_jpeg_cflags@ \
12@EVIL_CFLAGS@ \ 12@EVIL_CFLAGS@
13@WIN32_CPPFLAGS@
14
15AM_CFLAGS = @WIN32_CFLAGS@
16 13
17if BUILD_LOADER_JPEG 14if BUILD_LOADER_JPEG
18if !EVAS_STATIC_BUILD_JPEG 15if !EVAS_STATIC_BUILD_JPEG
diff --git a/libraries/evas/src/modules/loaders/jpeg/Makefile.in b/libraries/evas/src/modules/loaders/jpeg/Makefile.in
index 7c0ca18..4945f85 100644
--- a/libraries/evas/src/modules/loaders/jpeg/Makefile.in
+++ b/libraries/evas/src/modules/loaders/jpeg/Makefile.in
@@ -181,6 +181,8 @@ EVAS_SSE3_CFLAGS = @EVAS_SSE3_CFLAGS@
181EVIL_CFLAGS = @EVIL_CFLAGS@ 181EVIL_CFLAGS = @EVIL_CFLAGS@
182EVIL_LIBS = @EVIL_LIBS@ 182EVIL_LIBS = @EVIL_LIBS@
183EXEEXT = @EXEEXT@ 183EXEEXT = @EXEEXT@
184EXOTIC_CFLAGS = @EXOTIC_CFLAGS@
185EXOTIC_LIBS = @EXOTIC_LIBS@
184FGREP = @FGREP@ 186FGREP = @FGREP@
185FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ 187FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
186FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ 188FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
@@ -231,6 +233,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
231PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ 233PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
232PIXMAN_LIBS = @PIXMAN_LIBS@ 234PIXMAN_LIBS = @PIXMAN_LIBS@
233PKG_CONFIG = @PKG_CONFIG@ 235PKG_CONFIG = @PKG_CONFIG@
236PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
237PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
234PNG_CFLAGS = @PNG_CFLAGS@ 238PNG_CFLAGS = @PNG_CFLAGS@
235PNG_LIBS = @PNG_LIBS@ 239PNG_LIBS = @PNG_LIBS@
236RANLIB = @RANLIB@ 240RANLIB = @RANLIB@
@@ -249,8 +253,6 @@ VERSION = @VERSION@
249VMAJ = @VMAJ@ 253VMAJ = @VMAJ@
250WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ 254WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@
251WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ 255WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@
252WIN32_CFLAGS = @WIN32_CFLAGS@
253WIN32_CPPFLAGS = @WIN32_CPPFLAGS@
254XCB_CFLAGS = @XCB_CFLAGS@ 256XCB_CFLAGS = @XCB_CFLAGS@
255XCB_GL_CFLAGS = @XCB_GL_CFLAGS@ 257XCB_GL_CFLAGS = @XCB_GL_CFLAGS@
256XCB_GL_LIBS = @XCB_GL_LIBS@ 258XCB_GL_LIBS = @XCB_GL_LIBS@
@@ -324,8 +326,6 @@ evas_engine_software_ddraw_cflags = @evas_engine_software_ddraw_cflags@
324evas_engine_software_ddraw_libs = @evas_engine_software_ddraw_libs@ 326evas_engine_software_ddraw_libs = @evas_engine_software_ddraw_libs@
325evas_engine_software_gdi_cflags = @evas_engine_software_gdi_cflags@ 327evas_engine_software_gdi_cflags = @evas_engine_software_gdi_cflags@
326evas_engine_software_gdi_libs = @evas_engine_software_gdi_libs@ 328evas_engine_software_gdi_libs = @evas_engine_software_gdi_libs@
327evas_engine_software_sdl_cflags = @evas_engine_software_sdl_cflags@
328evas_engine_software_sdl_libs = @evas_engine_software_sdl_libs@
329evas_engine_software_xcb_cflags = @evas_engine_software_xcb_cflags@ 329evas_engine_software_xcb_cflags = @evas_engine_software_xcb_cflags@
330evas_engine_software_xcb_libs = @evas_engine_software_xcb_libs@ 330evas_engine_software_xcb_libs = @evas_engine_software_xcb_libs@
331evas_engine_software_xlib_cflags = @evas_engine_software_xlib_cflags@ 331evas_engine_software_xlib_cflags = @evas_engine_software_xlib_cflags@
@@ -417,10 +417,8 @@ AM_CPPFLAGS = \
417@PIXMAN_CFLAGS@ \ 417@PIXMAN_CFLAGS@ \
418@EINA_CFLAGS@ \ 418@EINA_CFLAGS@ \
419@evas_image_loader_jpeg_cflags@ \ 419@evas_image_loader_jpeg_cflags@ \
420@EVIL_CFLAGS@ \ 420@EVIL_CFLAGS@
421@WIN32_CPPFLAGS@
422 421
423AM_CFLAGS = @WIN32_CFLAGS@
424@BUILD_LOADER_JPEG_TRUE@@EVAS_STATIC_BUILD_JPEG_FALSE@pkgdir = $(libdir)/evas/modules/loaders/jpeg/$(MODULE_ARCH) 422@BUILD_LOADER_JPEG_TRUE@@EVAS_STATIC_BUILD_JPEG_FALSE@pkgdir = $(libdir)/evas/modules/loaders/jpeg/$(MODULE_ARCH)
425@BUILD_LOADER_JPEG_TRUE@@EVAS_STATIC_BUILD_JPEG_FALSE@pkg_LTLIBRARIES = module.la 423@BUILD_LOADER_JPEG_TRUE@@EVAS_STATIC_BUILD_JPEG_FALSE@pkg_LTLIBRARIES = module.la
426@BUILD_LOADER_JPEG_TRUE@@EVAS_STATIC_BUILD_JPEG_FALSE@module_la_SOURCES = evas_image_load_jpeg.c 424@BUILD_LOADER_JPEG_TRUE@@EVAS_STATIC_BUILD_JPEG_FALSE@module_la_SOURCES = evas_image_load_jpeg.c
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);