vector: apply backingstore for supporting gl drawing. 13/43313/1
authorChunEon Park <chuneon.park@samsung.com>
Sun, 24 May 2015 06:25:18 +0000 (15:25 +0900)
committerSubhransu Mohanty <sub.mohanty@samsung.com>
Wed, 8 Jul 2015 02:15:41 +0000 (11:15 +0900)
This is temporary solution for gl drawing.
Since the gl image is not drawn while it's free the image directly.
Just keeping the image and free when it's vector rendering is totally finished.

Change-Id: I143f9123ff0fa74036fb534f9874f80530a8a204

src/lib/evas/canvas/evas_object_vg.c
src/lib/evas/include/evas_private.h
src/modules/evas/engines/gl_generic/evas_engine.c
src/modules/evas/engines/software_generic/evas_engine.c

index 731eec6..6fbd41e 100644 (file)
@@ -22,6 +22,9 @@ struct _Evas_VG_Data
    Eina_Rectangle fill;
 
    unsigned int width, height;
+
+   //TIZE ONLY: backingstore. temporary solution for supporting gl drawing.
+   void *backing_store;
 };
 
 static void evas_object_vg_render(Evas_Object *eo_obj,
@@ -95,6 +98,15 @@ void
 _evas_vg_eo_base_destructor(Eo *eo_obj, Evas_VG_Data *pd)
 {
    eo_unref(pd->root);
+
+   //TIZE ONLY: backingstore. temporary solution for supporting gl drawing.
+   if (pd->backing_store)
+     {
+        Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJECT_CLASS);
+        obj->layer->evas->engine.func->image_free(obj->layer->evas->engine.data.output, pd->backing_store);
+        pd->backing_store = NULL;
+     }
+
    eo_do_super(eo_obj, MY_CLASS, eo_destructor());
 }
 
@@ -184,7 +196,18 @@ evas_object_vg_render(Evas_Object *eo_obj EINA_UNUSED,
                                               do_async);
    _evas_vg_render(obj, output, context, surface, vd->root, NULL,
                    do_async);
+#if 0
    obj->layer->evas->engine.func->ector_end(output, context, surface, do_async);
+#else
+   //TIZE ONLY: backingstore. temporary solution for supporting gl drawing.
+
+   if (vd->backing_store)
+     {
+        obj->layer->evas->engine.func->image_free(output, vd->backing_store);
+        vd->backing_store = NULL;
+     }
+   vd->backing_store = obj->layer->evas->engine.func->ector_end(output, context, surface, do_async);
+#endif
 }
 
 static void
index 7bef005..9738154 100644 (file)
@@ -1339,7 +1339,7 @@ struct _Evas_Func
    Ector_Surface *(*ector_get)           (void *data);
    void  (*ector_begin)                  (void *data, void *context, void *surface, int x, int y, Eina_Bool do_async);
    void  (*ector_renderer_draw)          (void *data, void *context, void *surface, Ector_Renderer *r, Eina_Array *clips, Eina_Bool do_async);
-   void  (*ector_end)                    (void *data, void *context, void *surface, Eina_Bool do_async);
+   void  *(*ector_end)                    (void *data, void *context, void *surface, Eina_Bool do_async);
 };
 
 struct _Evas_Image_Save_Func
index 86a2a48..f8fdf85 100644 (file)
@@ -2063,7 +2063,7 @@ eng_ector_begin(void *data EINA_UNUSED, void *context EINA_UNUSED, void *surface
      }
 }
 
-static void
+static void *
 eng_ector_end(void *data, void *context EINA_UNUSED, void *surface EINA_UNUSED, Eina_Bool do_async EINA_UNUSED)
 {
    Evas_Engine_GL_Context *gl_context;
@@ -2093,8 +2093,13 @@ eng_ector_end(void *data, void *context EINA_UNUSED, void *surface EINA_UNUSED,
    // using GL backend, you just need to turn on Evas_Map on
    // the Evas_Object_VG.
    evas_gl_common_image_draw(gl_context, im, 0, 0, w, h, 0, 0, w, h, 0);
-
+#if 0
    evas_gl_common_image_free(im);
+#else
+   return im;
+#endif
+
+   return NULL;
 }
 
 static Evas_Func func, pfunc;
index 1b50ded..74f898f 100644 (file)
@@ -3337,7 +3337,7 @@ eng_ector_begin(void *data EINA_UNUSED, void *context EINA_UNUSED, void *surface
      }
 }
 
-static void
+static void *
 eng_ector_end(void *data EINA_UNUSED, void *context EINA_UNUSED, void *surface EINA_UNUSED, Eina_Bool do_async)
 {
    if (do_async)
@@ -3345,7 +3345,7 @@ eng_ector_end(void *data EINA_UNUSED, void *context EINA_UNUSED, void *surface E
         Evas_Thread_Command_Ector_Surface *nes;
 
         nes = eina_mempool_malloc(_mp_command_ector_surface, sizeof (Evas_Thread_Command_Ector_Surface));
-        if (!nes) return ;
+        if (!nes) return NULL;
 
         nes->surface = NULL;
 
@@ -3357,6 +3357,7 @@ eng_ector_end(void *data EINA_UNUSED, void *context EINA_UNUSED, void *surface E
 
         evas_common_cpu_end_opt();
      }
+   return NULL;
 }
 
 //------------------------------------------------//