{
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;
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)))
{