add evas_render_copy to dump evas canvas 47/38347/1 accepted/tizen/common/20150420.081646 accepted/tizen/mobile/20150420.233101 accepted/tizen/tv/20150420.233017 accepted/tizen/wearable/20150420.233038 submit/tizen/20150420.062645
authorBoram Park <boram1288.park@samsung.com>
Fri, 17 Apr 2015 02:29:01 +0000 (11:29 +0900)
committerBoram Park <boram1288.park@samsung.com>
Fri, 17 Apr 2015 05:47:23 +0000 (14:47 +0900)
summary:
In case of x, if client knows xid, then client can get a image from
window. But in case of wayland, client only knows window resource.
And buffer is hidden inside of evas engine backend. To get a image
from window, evas should offer a way to allow client to get a image.

Change-Id: I475266fe92ded534c4adce26092676464db02cc5

src/lib/evas/canvas/evas_canvas.eo
src/lib/evas/canvas/evas_render.c
src/lib/evas/include/evas_private.h
src/modules/evas/engines/drm/evas_engine.c
src/modules/evas/engines/drm/evas_engine.h
src/modules/evas/engines/drm/evas_outbuf.c

index 94e1082..652351d 100644 (file)
@@ -1519,6 +1519,28 @@ class Evas.Canvas (Eo.Base, Evas.Common_Interface)
          @ingroup Evas_Canvas */
 
       }
+      render_copy {
+         /*@
+         Get a image from evas
+
+         @ingroup Evas_Canvas */
+
+         params {
+            @in void *buffer;
+            @in int stride;
+            @in int width;
+            @in int height;
+            @in uint format;
+            @in int sx;
+            @in int sy;
+            @in int sw;
+            @in int sh;
+            @in int dx;
+            @in int dy;
+            @in int dw;
+            @in int dh;
+         }
+      }
       event_feed_mouse_in {
          /*@
          Mouse in event feed.
index 42a6e4b..41c0ad0 100644 (file)
@@ -2942,6 +2942,14 @@ _evas_canvas_render_dump(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
      }
 }
 
+EOLIAN void
+_evas_canvas_render_copy(Eo *obj EINA_UNUSED, Evas_Public_Data *e, void *buffer, int stride, int width, int height, uint format, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)
+{
+  if ((e->engine.func) && (e->engine.func->output_copy) &&
+      (e->engine.data.output))
+    e->engine.func->output_copy(e->engine.data.output, buffer, stride, width, height, format, sx, sy, sw, sh, dx, dy, dw, dh);
+}
+
 void
 evas_render_invalidate(Evas *eo_e)
 {
index 673b6aa..a852979 100644 (file)
@@ -1331,6 +1331,8 @@ struct _Evas_Func
    void  (*texture_filter_set)           (void *data, void *texture, Evas_3D_Texture_Filter min, Evas_3D_Texture_Filter mag);
    void  (*texture_filter_get)           (void *data, void *texture, Evas_3D_Texture_Filter *min, Evas_3D_Texture_Filter *mag);
    void  (*texture_image_set)            (void *data, void *texture, void *image);
+
+   void  (*output_copy)                  (void *data, void *buffer, int stride, int width, int height, uint format, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh);
 };
 
 struct _Evas_Image_Save_Func
@@ -1587,6 +1589,7 @@ void _canvas_norender(Eo *e, void *_pd, va_list *list);
 void _canvas_render_idle_flush(Eo *e, void *_pd, va_list *list);
 void _canvas_sync(Eo *obj, void *_pd, va_list *list);
 void _canvas_render_dump(Eo *obj, void *_pd, va_list *list);
+void _canvas_render_copy(Eo *obj, void *_pd, va_list *list);
 
 void _canvas_object_bottom_get(Eo *e, void *_pd, va_list *list);
 void _canvas_object_top_get(Eo *e, void *_pd, va_list *list);
index 0d8582f..1daf8be 100644 (file)
@@ -16,6 +16,13 @@ static Evas_Func func, pfunc;
 /* external variables */
 int _evas_engine_drm_log_dom;
 
+/* local inline functions */
+static inline Outbuf *
+eng_get_ob(Render_Engine *re)
+{
+   return re->generic.ob;
+}
+
 /* local functions */
 static void *
 _output_setup(Evas_Engine_Info_Drm *info, int w, int h)
@@ -163,6 +170,20 @@ eng_output_free(void *data)
    evas_common_image_shutdown();
 }
 
+static void
+eng_output_copy(void *data, void *buffer, int stride, int width, int height, uint format, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)
+{
+   Render_Engine *re = (Render_Engine *)data;
+   Outbuf *ob;
+
+   EINA_SAFETY_ON_NULL_RETURN(re);
+
+   ob = eng_get_ob(re);
+   EINA_SAFETY_ON_NULL_RETURN(ob);
+
+   evas_outbuf_copy(ob, buffer, stride, width, height, format, sx, sy, sw, sh, dx, dy, dw, dh);
+}
+
 /* module api functions */
 static int
 module_open(Evas_Module *em)
@@ -192,6 +213,7 @@ module_open(Evas_Module *em)
    EVAS_API_OVERRIDE(info_free, &func, eng_);
    EVAS_API_OVERRIDE(setup, &func, eng_);
    EVAS_API_OVERRIDE(output_free, &func, eng_);
+   EVAS_API_OVERRIDE(output_copy, &func, eng_);
 
    /* advertise our engine functions */
    em->functions = (void *)(&func);
index 4bb6a91..bc1e5d5 100644 (file)
@@ -127,6 +127,8 @@ void evas_outbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int y
 void evas_outbuf_update_region_free(Outbuf *ob, RGBA_Image *update);
 void evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode);
 
+void evas_outbuf_copy(Outbuf *ob, void *buffer, int stride, int width, int height, uint format, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh);
+
 Eina_Bool evas_drm_outbuf_setup(Outbuf *ob);
 void evas_drm_outbuf_framebuffer_set(Outbuf *ob, Buffer *buffer);
 Eina_Bool evas_drm_framebuffer_create(int fd, Buffer *buffer, int depth);
index 0583c5a..3e230c1 100644 (file)
@@ -493,3 +493,11 @@ evas_outbuf_get_rot(Outbuf *ob)
 {
    return ob->info->info.rotation;
 }
+
+void
+evas_outbuf_copy(Outbuf *ob, void *buffer, int stride, int width, int height, uint format, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)
+{
+   Buffer *buff = &(ob->priv.buffer[ob->priv.last]);
+
+   memcpy (buffer, buff->data, stride * height);
+}
\ No newline at end of file