evas: Fix region test in jpeg load with region + zoom

The previous commit exposed an issue with the region test
does not take into account the scale down factor.

Not a @fix in itself, as it depends on the previous patch.
This commit is contained in:
Jean-Philippe Andre 2016-08-17 16:45:16 +09:00
parent fecbcf8a90
commit 0193e40d8c
2 changed files with 9 additions and 2 deletions

View File

@ -1562,6 +1562,13 @@ _emile_jpeg_head(Emile_Image *image,
prop->w, prop->h,
degree, prop->flipped);
}
if (prop->scale > 1)
{
load_region_x /= prop->scale;
load_region_y /= prop->scale;
load_region_w /= prop->scale;
load_region_h /= prop->scale;
}
RECTS_CLIP_TO_RECT(load_region_x, load_region_y,
load_region_w, load_region_h,
0, 0, prop->w, prop->h);

View File

@ -159,8 +159,8 @@ evas_image_load_file_head_png(void *loader_data,
if (opts->region.w > 0 && opts->region.h > 0)
{
if ((w32 < opts->region.x + opts->region.w) ||
(h32 < opts->region.y + opts->region.h))
if (((int) w32 < opts->region.x + opts->region.w) ||
((int) h32 < opts->region.y + opts->region.h))
{
*error = EVAS_LOAD_ERROR_GENERIC;
goto close_file;