summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiin.moon <jiin.moon@samsung.com>2016-08-17 16:39:13 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-08-17 17:28:53 +0900
commitfecbcf8a905e30345d3454c9cdb665a6d7b098bc (patch)
tree8935497d41d8c6a37cdb70b04d29a4d20c65d4fb
parent3bdefaf31fde9801ce6702f850aac24bc2157842 (diff)
downloadefl-fecbcf8a905e30345d3454c9cdb665a6d7b098bc.tar.gz
emile: region_set does not working in jpeg loader if scale_down has set
Summary: If both region and scale_down has set, ERR would be returned by loader of jpeg. @fix Test Plan: sample code Reviewers: raster, jypark, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4200
-rw-r--r--src/lib/emile/emile_image.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/lib/emile/emile_image.c b/src/lib/emile/emile_image.c
index 5bad68ce36..5c12035fd7 100644
--- a/src/lib/emile/emile_image.c
+++ b/src/lib/emile/emile_image.c
@@ -1724,11 +1724,6 @@ _emile_jpeg_data(Emile_Image *image,
{
region = 1;
- opts_region.x = opts->region.x;
- opts_region.y = opts->region.y;
- opts_region.w = opts->region.w;
- opts_region.h = opts->region.h;
-
if (prop->rotated)
{
unsigned int load_region_x = 0, load_region_y = 0;
@@ -1738,19 +1733,31 @@ _emile_jpeg_data(Emile_Image *image,
load_region_y = opts->region.y;
load_region_w = opts->region.w;
load_region_h = opts->region.h;
-
_rotate_region(&opts_region.x, &opts_region.y,
&opts_region.w, &opts_region.h,
load_region_x, load_region_y,
load_region_w, load_region_h,
w, h, degree, prop->flipped);
}
-#ifdef BUILD_LOADER_JPEG_REGION
- cinfo.region_x = opts_region.x;
- cinfo.region_y = opts_region.y;
- cinfo.region_w = opts_region.w;
- cinfo.region_h = opts_region.h;
-#endif
+
+ /* scale value already applied when decompress.
+ When access to decoded image, have to apply scale value to region value */
+ if (prop->scale > 1)
+ {
+ opts_region.x = opts->region.x / prop->scale;
+ opts_region.y = opts->region.y / prop->scale;
+ opts_region.w = opts->region.w / prop->scale;
+ opts_region.h = opts->region.h / prop->scale;
+
+ }
+ else
+ {
+ opts_region.x = opts->region.x;
+ opts_region.y = opts->region.y;
+ opts_region.w = opts->region.w;
+ opts_region.h = opts->region.h;
+ }
+
}
if ((!region) && ((w != ie_w) || (h != ie_h)))
{