Evas snapshot: Fix proxies of snapshot objects
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 7 Oct 2015 11:03:37 +0000 (20:03 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Mon, 12 Oct 2015 04:40:20 +0000 (13:40 +0900)
This was broken because the wrong image size was used
in the proxy's fast path (proxy of another image).
Why did snapshot use a specific surface_w,h instead of
reusing the usual cur->image.w,h? (@cedric)

Simplify code.

src/lib/evas/canvas/evas_object_image.c

index 7214b9a..6b05037 100644 (file)
@@ -69,8 +69,6 @@ struct _Evas_Object_Image_Pixels
 
    Evas_Video_Surface video;
    unsigned int video_caps;
-
-   int surface_w, surface_h; /* used by snapshot feature */
 };
 
 struct _Evas_Object_Image_State
@@ -3313,8 +3311,8 @@ _evas_image_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
    else if (obj->cur->snapshot)
      {
         pixels = o->engine_data;
-        imagew = o->pixels->surface_w;
-        imageh = o->pixels->surface_h;
+        imagew = o->cur->image.w;
+        imageh = o->cur->image.h;
         uvw = imagew;
         uvh = imageh;
      }
@@ -4790,24 +4788,24 @@ _evas_object_image_surface_get(Evas_Object *eo, Evas_Object_Protected_Data *obj)
    Evas_Image_Data *pd = eo_data_scope_get(eo, EVAS_IMAGE_CLASS);
 
    if (pd->engine_data &&
-       pd->pixels->surface_w == obj->cur->geometry.w &&
-       pd->pixels->surface_h == obj->cur->geometry.h)
+       (pd->cur->image.w == obj->cur->geometry.w) &&
+       (pd->cur->image.h == obj->cur->geometry.h))
      return pd->engine_data;
 
    if (pd->engine_data)
      ENFN->image_free(ENDT, pd->engine_data);
 
    // FIXME: alpha forced to 1 for now, need to figure out Evas alpha here
-   EINA_COW_PIXEL_WRITE_BEGIN(pd, pixi_write)
+   EINA_COW_IMAGE_STATE_WRITE_BEGIN(pd, state_write)
      {
         pd->engine_data = ENFN->image_map_surface_new(ENDT,
                                                       obj->cur->geometry.w,
                                                       obj->cur->geometry.h,
                                                       1);
-        pixi_write->surface_w = obj->cur->geometry.w;
-        pixi_write->surface_h = obj->cur->geometry.h;
+        state_write->image.w = obj->cur->geometry.w;
+        state_write->image.h = obj->cur->geometry.h;
      }
-   EINA_COW_PIXEL_WRITE_END(pd, pixi_write);
+   EINA_COW_IMAGE_STATE_WRITE_END(pd, state_write);
 
    return pd->engine_data;
 }