evas map: check source image size for direct render 84/264784/1 accepted/tizen/6.5/unified/20211028.225531 accepted/tizen/unified/20211007.154801 submit/tizen/20211007.055733 submit/tizen_6.5/20211028.163301 tizen_6.5.m2_release
authorShinwoo Kim <cinoo.kim@samsung.com>
Wed, 29 Sep 2021 12:54:45 +0000 (21:54 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Wed, 29 Sep 2021 12:54:45 +0000 (21:54 +0900)
The direct render is working correctly only if source image size
is equal to the size of smart object.

So this patch is cheking the size of source image.

Change-Id: I2e6c70360a477283903e4c494410c6683dfaa0c0

src/lib/evas/canvas/evas_render.c

index 63b03a6..a6bbbcd 100644 (file)
@@ -1827,6 +1827,23 @@ _map_source_image_get(Evas_Object *eo_obj, Evas_Object **src_img)
    return EINA_TRUE;
 }
 
+static Eina_Bool
+_map_source_image_is_valid(Evas_Object *eo_obj, Evas_Object *src_img, int w, int h)
+{
+   Evas_Object_Protected_Data *obj;
+   Evas_Object_Protected_Data *src;
+
+   if (w == 0 || h == 0) return EINA_FALSE;
+
+   obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
+   src = efl_data_scope_get(src_img, EFL_CANVAS_OBJECT_CLASS);
+
+   if (obj->cur->geometry.w != src->cur->geometry.w ||
+       obj->cur->geometry.h != src->cur->geometry.h ) return EINA_FALSE;
+
+   return EINA_TRUE;
+}
+
 static void
 _map_direct_render(Evas_Public_Data *evas, void *ctx, Evas_Object *src_img,
                    int w, int h, Evas_Object_Protected_Data *obj,
@@ -2064,7 +2081,8 @@ evas_render_mapped(Evas_Public_Data *evas, Evas_Object *eo_obj,
                {
                   evas_object_image_size_get(direct_render_src_img,
                                              &src_img_w, &src_img_h);
-                  if (src_img_w == 0 || src_img_h == 0)
+                  if (!_map_source_image_is_valid(eo_obj, direct_render_src_img,
+                                                  src_img_w, src_img_h))
                     {
                        direct_render_src_img = NULL;
                     }