evas: Fix region test in jpeg load with region + zoom
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 17 Aug 2016 07:45:16 +0000 (16:45 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Wed, 17 Aug 2016 08:28:53 +0000 (17:28 +0900)
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.

src/lib/emile/emile_image.c
src/modules/evas/image_loaders/png/evas_image_load_png.c

index 5c12035..7c1db48 100644 (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);
index 15660af..3444c0f 100644 (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;