raster pushed a commit to branch master.

commit 7fd0cf1731035e36f2bed7e6db69ae319c6f6d3a
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Thu Apr 11 21:23:07 2013 +0900

    this is not a big change - not worth changelog, but allow gl partial
    updates to be rounded up to specific tile sizes (and make it 16x16 by
    default).
---
 src/lib/evas/common/evas_tiler.c              | 28 ++++++++++++++++++++++++++-
 src/lib/evas/include/evas_common.h            | 15 +++++++-------
 src/modules/evas/engines/gl_x11/evas_engine.c | 10 ++++++++--
 3 files changed, 42 insertions(+), 11 deletions(-)

diff --git a/src/lib/evas/common/evas_tiler.c b/src/lib/evas/common/evas_tiler.c
index bd16d12..b61e770 100644
--- a/src/lib/evas/common/evas_tiler.c
+++ b/src/lib/evas/common/evas_tiler.c
@@ -933,6 +933,12 @@ evas_common_tilebuf_get_tile_size(Tilebuf *tb, int *tw, 
int *th)
    if (th) *th = tb->tile_size.h;
 }
 
+EAPI void
+evas_common_tilebuf_tile_strict_set(Tilebuf *tb, Eina_Bool strict)
+{
+   tb->strict_tiles = strict;
+}
+
 #ifdef EVAS_RECT_SPLIT
 static inline int
 _add_redraw(list_t *rects, int x, int y, int w, int h)
@@ -1166,17 +1172,37 @@ evas_common_tilebuf_get_render_rects(Tilebuf *tb)
  */
 #elif defined(EVAS_RECT_SPLIT)
    list_node_t *n;
+   list_t to_merge;
    Tilebuf_Rect *rects = NULL;
    int bx1 = 0, bx2 = 0, by1 = 0, by2 = 0, num = 0;
 
    if (tb->need_merge)
      {
-        list_t to_merge;
         to_merge = tb->rects;
         tb->rects = list_zeroed;
         rect_list_merge_rects(&tb->rects, &to_merge, FUZZ * FUZZ);
         tb->need_merge = 0;
      }
+   if (tb->strict_tiles)
+     {
+        // round up rects to tb->tile_size.w and tb->tile_size.h
+        to_merge = list_zeroed;
+        for (n = tb->rects.head; n; n = n->next)
+          {
+             int x1, x2, y1, y2;
+
+             x1 = ((rect_node_t *)n)->rect.left;
+             x2 = x1 + ((rect_node_t *)n)->rect.width;
+             y1 = ((rect_node_t *)n)->rect.top;
+             y2 = y1 + ((rect_node_t *)n)->rect.height;
+             x1 = tb->tile_size.w * (x1 / tb->tile_size.w);
+             y1 = tb->tile_size.h * (y1 / tb->tile_size.h);
+             x2 = tb->tile_size.w * ((x2 + tb->tile_size.w - 1) / 
tb->tile_size.w);
+             y2 = tb->tile_size.h * ((y2 + tb->tile_size.h - 1) / 
tb->tile_size.h);
+             _add_redraw(&to_merge, x1, y1, x2 - x1, y2 - y1);
+          }
+        rect_list_merge_rects(&tb->rects, &to_merge, FUZZ * FUZZ);
+     }
    
    n = tb->rects.head;
    if (n)
diff --git a/src/lib/evas/include/evas_common.h 
b/src/lib/evas/include/evas_common.h
index 2a9012b..1e8907b 100644
--- a/src/lib/evas/include/evas_common.h
+++ b/src/lib/evas/include/evas_common.h
@@ -1042,16 +1042,10 @@ struct rect_node
 
 struct _Tilebuf
 {
-   int outbuf_w;
-   int outbuf_h;
-
+   int outbuf_w, outbuf_h;
    struct {
-      int           w, h;
+      short w, h;
    } tile_size;
-
-   struct {
-      int x, y, w, h;
-   } prev_add, prev_del;
 #ifdef RECTUPDATE
 /*
    Regionbuf *rb;
@@ -1067,6 +1061,10 @@ struct _Tilebuf
    } tiles;
  */
 #endif
+   struct {
+      int x, y, w, h;
+   } prev_add, prev_del;
+   Eina_Bool strict_tiles : 1;
 };
 
 struct _Tilebuf_Tile
@@ -1224,6 +1222,7 @@ EAPI Tilebuf      *evas_common_tilebuf_new               
(int w, int h);
 EAPI void          evas_common_tilebuf_free              (Tilebuf *tb);
 EAPI void          evas_common_tilebuf_set_tile_size     (Tilebuf *tb, int tw, 
int th);
 EAPI void          evas_common_tilebuf_get_tile_size     (Tilebuf *tb, int 
*tw, int *th);
+EAPI void          evas_common_tilebuf_tile_strict_set   (Tilebuf *tb, 
Eina_Bool strict);
 EAPI int           evas_common_tilebuf_add_redraw        (Tilebuf *tb, int x, 
int y, int w, int h);
 EAPI int           evas_common_tilebuf_del_redraw        (Tilebuf *tb, int x, 
int y, int w, int h);
 EAPI int           evas_common_tilebuf_add_motion_vector (Tilebuf *tb, int x, 
int y, int w, int h, int dx, int dy, int alpha);
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c 
b/src/modules/evas/engines/gl_x11/evas_engine.c
index de3be42..e486e0d 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -17,6 +17,8 @@
 #define EVAS_GL_NO_GL_H_CHECK 1
 #include "Evas_GL.h"
 
+#define EVAS_GL_UPDATE_TILE_SIZE 16
+
 enum {
    MERGE_BOUNDING,
    MERGE_FULL
@@ -992,7 +994,8 @@ eng_setup(Evas *eo_e, void *in)
         free(re);
         return 0;
      }
-   evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
+   evas_common_tilebuf_set_tile_size(re->tb, EVAS_GL_UPDATE_TILE_SIZE, 
EVAS_GL_UPDATE_TILE_SIZE);
+   evas_common_tilebuf_tile_strict_set(re->tb, EINA_TRUE);
 
    if (!e->engine.data.context)
      e->engine.data.context =
@@ -1070,7 +1073,10 @@ eng_output_resize(void *data, int w, int h)
    evas_common_tilebuf_free(re->tb);
    re->tb = evas_common_tilebuf_new(w, h);
    if (re->tb)
-     evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
+     {
+        evas_common_tilebuf_set_tile_size(re->tb, EVAS_GL_UPDATE_TILE_SIZE, 
EVAS_GL_UPDATE_TILE_SIZE);
+        evas_common_tilebuf_tile_strict_set(re->tb, EINA_TRUE);
+     }
 }
 
 static void

-- 

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter

Reply via email to