Evas (wayland_shm): Support evas cserve2.
authordevilhorns <devilhorns@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 3 Jul 2012 07:32:52 +0000 (07:32 +0000)
committerdevilhorns <devilhorns@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 3 Jul 2012 07:32:52 +0000 (07:32 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@73200 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/engines/wayland_shm/Makefile.am
src/modules/engines/wayland_shm/evas_engine.c
src/modules/engines/wayland_shm/evas_engine.h
src/modules/engines/wayland_shm/evas_outbuf.c

index e064803..6a180ab 100644 (file)
@@ -5,11 +5,11 @@ AM_CPPFLAGS = \
 -I. \
 -I$(top_srcdir)/src/lib \
 -I$(top_srcdir)/src/lib/include \
+-I$(top_srcdir)/src/lib/cserve2 \
 -I$(top_srcdir)/src/modules/engines \
 @FREETYPE_CFLAGS@ \
 @PIXMAN_CFLAGS@ \
 @EINA_CFLAGS@ \
-@FRIBIDI_CFLAGS@ \
 @evas_engine_wayland_shm_cflags@
 
 if BUILD_ENGINE_WAYLAND_SHM
index dcf3aa1..ac37ff9 100644 (file)
@@ -261,9 +261,9 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i
         re->rects = NULL;
         re->end = EINA_TRUE;
      }
-   if ((ux + uw) > re->ob->w) uw = re->ob->w - ux;
-   if ((uy + uh) > re->ob->h) uh = re->ob->h - uy;
-   if ((uw <= 0) || (uh <= 0)) return NULL;
+   /* if ((ux + uw) > re->ob->w) uw = re->ob->w - ux; */
+   /* if ((uy + uh) > re->ob->h) uh = re->ob->h - uy; */
+   /* if ((uw <= 0) || (uh <= 0)) return NULL; */
    surface = 
      re->outbuf_new_region_for_update(re->ob, ux, uy, uw, uh, cx, cy, cw, ch);
    if (x) *x = ux;
index 1869d16..8806207 100644 (file)
@@ -46,7 +46,13 @@ struct _Outbuf
    struct 
      {
         void *dest;
+
         RGBA_Image *buffer;
+        Eina_List *buffer_regions;
+
+        Eina_List *pending_writes;
+        Eina_List *prev_pending_writes;
+
         Eina_Bool destination_alpha : 1;
      } priv;
 };
index 4dee9a2..352b2c2 100644 (file)
@@ -1,3 +1,11 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef EVAS_CSERVE2
+# include "evas_cs2_private.h"
+#endif
+
 #include "evas_common.h"
 #include "evas_engine.h"
 
@@ -5,7 +13,16 @@ void
 evas_outbuf_free(Outbuf *ob) 
 {
    if (!ob) return;
-   if (ob->priv.buffer) evas_cache_image_drop(&ob->priv.buffer->cache_entry);
+   if (ob->priv.buffer)
+     {
+#ifdef EVAS_CSERVE2
+        if (evas_cserve2_use_get())
+          evas_cache2_image_close(&ob->priv.buffer->cache_entry);
+        else
+#endif
+          evas_cache_image_drop(&ob->priv.buffer->cache_entry);
+     }
+
    free(ob);
 }
 
@@ -16,7 +33,15 @@ evas_outbuf_resize(Outbuf *ob, int w, int h)
    if ((ob->w == w) && (ob->h == h)) return;
    ob->w = w;
    ob->h = h;
-   if (ob->priv.buffer) evas_cache_image_drop(&ob->priv.buffer->cache_entry);
+   if (ob->priv.buffer)
+     {
+#ifdef EVAS_CSERVE2
+        if (evas_cserve2_use_get())
+          evas_cache2_image_close(&ob->priv.buffer->cache_entry);
+        else
+#endif
+          evas_cache_image_drop(&ob->priv.buffer->cache_entry);
+     }
    ob->priv.buffer = NULL;
 }
 
@@ -33,10 +58,22 @@ evas_outbuf_setup(int w, int h, int rot, Eina_Bool alpha, void *dest)
    ob->priv.dest = dest;
    ob->priv.destination_alpha = alpha;
 
-   ob->priv.buffer = 
-     (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), 
-                                         w, h, ob->priv.dest, 
-                                         1, EVAS_COLORSPACE_ARGB8888);
+#ifdef EVAS_CSERVE2
+   if (evas_cserve2_use_get())
+     {
+        ob->priv.buffer = 
+          (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(), 
+                                               w, h, ob->priv.dest, 
+                                               1, EVAS_COLORSPACE_ARGB8888);
+     }
+   else
+#endif
+     {
+        ob->priv.buffer = 
+          (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), 
+                                              w, h, ob->priv.dest, 
+                                              1, EVAS_COLORSPACE_ARGB8888);
+     }
 
    return ob;
 }
@@ -54,11 +91,22 @@ evas_outbuf_new_region_for_update(Outbuf *ob, int x, int y, int w, int h, int *c
        RGBA_Image *im;
 
        *cx = 0; *cy = 0; *cw = w; *ch = h;
-       im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
+#ifdef EVAS_CSERVE2
+        if (evas_cserve2_use_get())
+          im = (RGBA_Image *)evas_cache2_image_empty(evas_common_image_cache2_get());
+        else
+#endif
+          im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
+
         if (im) 
           {
              im->cache_entry.flags.alpha = ob->priv.destination_alpha;
-             im = (RGBA_Image *)evas_cache_image_size_set(&im->cache_entry, w, h);
+#ifdef EVAS_CSERVE2
+             if (evas_cserve2_use_get())
+               evas_cache2_image_size_set(&im->cache_entry, w, h);
+             else
+#endif
+               im = (RGBA_Image *)evas_cache_image_size_set(&im->cache_entry, w, h);
           }
 
         return im;
@@ -68,9 +116,20 @@ evas_outbuf_new_region_for_update(Outbuf *ob, int x, int y, int w, int h, int *c
 }
 
 void 
-evas_outbuf_push_updated_region(Outbuf *ob, RGBA_Image *update, int x __UNUSED__, int y, int w, int h) 
+evas_outbuf_push_updated_region(Outbuf *ob, RGBA_Image *update, int x, int y, int w, int h) 
 {
+   DATA32 *dst, *src, *dest;
+   int bytes = 0;
+
    if (!ob->priv.dest) return;
+
+   bytes = ((w * sizeof(int)) * h);
+   dest = (DATA32 *)((DATA8 *)(ob->priv.dest) + (y * bytes) + (x * 4));
+   /* if (ob->func.new_update_region) */
+   /*   { */
+   /*      dest = ob->func.new_update_region(x, y, w, h, &bytes); */
+   /*   } */
+
    if (!ob->priv.buffer) 
      {
         Gfx_Func_Copy func;
@@ -78,10 +137,8 @@ evas_outbuf_push_updated_region(Outbuf *ob, RGBA_Image *update, int x __UNUSED__
         func = evas_common_draw_func_copy_get(w, 0);
         if (func) 
           {
-             DATA32 *dst, *src;
-             int yy = 0, bytes = 0;
+             int yy = 0;
 
-             bytes = ((w * sizeof(int)) * h);
              for (yy = 0; yy < h; yy++) 
                {
                   src = update->image.data + (yy * update->cache_entry.w);
@@ -91,11 +148,21 @@ evas_outbuf_push_updated_region(Outbuf *ob, RGBA_Image *update, int x __UNUSED__
                }
           }
      }
+   /* if (ob->func.free_update_region) */
+   /*   ob->func.free_update_region(x, y, w, h, dest); */
 }
 
 void 
 evas_outbuf_free_region_for_update(Outbuf *ob, RGBA_Image *update) 
 {
    if (!ob) return;
-   if (update != ob->priv.buffer) evas_cache_image_drop(&update->cache_entry);
+   if (update != ob->priv.buffer)
+     {
+#ifdef EVAS_CSERVE2
+        if (evas_cserve2_use_get())
+          evas_cache2_image_close(&update->cache_entry);
+        else
+#endif
+          evas_cache_image_drop(&update->cache_entry);
+     }
 }