aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evas/canvas/render2
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-08-12 20:06:30 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-08-12 20:08:14 +0900
commit40fc5a928219daaaf461d6cdeabd558a38a5463f (patch)
tree2677c521374a50a36ba509c795818cbc9a39d252 /src/lib/evas/canvas/render2
parentevas - handle case where layer->evas is null - don't crash (diff)
downloadefl-40fc5a928219daaaf461d6cdeabd558a38a5463f.tar.gz
evas render 2 - tiled rouding of updates to keep number regions down
tile to 16x16 (we can cahnge) to keep number of update rects down/minimal with render2
Diffstat (limited to 'src/lib/evas/canvas/render2')
-rw-r--r--src/lib/evas/canvas/render2/evas_render2_th_main.c32
-rw-r--r--src/lib/evas/canvas/render2/region.c11
2 files changed, 36 insertions, 7 deletions
diff --git a/src/lib/evas/canvas/render2/evas_render2_th_main.c b/src/lib/evas/canvas/render2/evas_render2_th_main.c
index 77912294ee..1379b88556 100644
--- a/src/lib/evas/canvas/render2/evas_render2_th_main.c
+++ b/src/lib/evas/canvas/render2/evas_render2_th_main.c
@@ -167,6 +167,30 @@ _evas_render2_th_main_obj_process(Evas_Public_Data *e,
offx, offy, l);
}
+static Region *
+_evas_render2_regions_merge(Region *region)
+{
+ Region *region2;
+ Box *rects;
+ int num, i;
+ int tsize = 16;
+
+ region2 = region_new();
+ rects = region_rects(region);
+ num = region_rects_num(region);
+ for (i = 0; i < num; i++)
+ {
+ region_rect_add
+ (region2,
+ (rects[i].x1 / tsize) * tsize,
+ (rects[i].y1 / tsize) * tsize,
+ (((rects[i].x2 - rects[i].x1) + tsize - 1) / tsize) * tsize,
+ (((rects[i].y2 - rects[i].y1) + tsize - 1) / tsize) * tsize);
+ }
+ region_free(region);
+ return region2;
+}
+
static void
_evas_render2_th_main_do(Eo *eo_e, Evas_Public_Data *e)
{
@@ -207,6 +231,8 @@ _evas_render2_th_main_do(Eo *eo_e, Evas_Public_Data *e)
t = get_time() - t;
printf("T: update generation: "); out_time(t);
+ updates = _evas_render2_regions_merge(updates);
+
rects = region_rects(updates);
rects_num = region_rects_num(updates);
for (i = 0; i < rects_num; i++)
@@ -214,6 +240,8 @@ _evas_render2_th_main_do(Eo *eo_e, Evas_Public_Data *e)
rect = malloc(sizeof(Eina_Rectangle));
if (rect)
{
+ if (rects[i].x2 > e->output.w) rects[i].x2 = e->output.w;
+ if (rects[i].y2 > e->output.h) rects[i].y2 = e->output.h;
rect->x = rects[i].x1;
rect->y = rects[i].y1;
rect->w = rects[i].x2 - rects[i].x1;
@@ -223,6 +251,10 @@ _evas_render2_th_main_do(Eo *eo_e, Evas_Public_Data *e)
updates_list = eina_list_append(updates_list, rect);
}
}
+ t = get_time() - t;
+ printf("T: merge updates: "); out_time(t);
+
+ // ... now render every update region
region_free(updates);
e->changed = EINA_FALSE;
diff --git a/src/lib/evas/canvas/render2/region.c b/src/lib/evas/canvas/render2/region.c
index 70fb39b030..30999d92f3 100644
--- a/src/lib/evas/canvas/render2/region.c
+++ b/src/lib/evas/canvas/render2/region.c
@@ -744,8 +744,6 @@ region_rects(Region *region)
Eina_Bool
region_copy(Region *dest, Region *src)
{
- if (dest == src) return EINA_TRUE;
-
dest->last_del.w = 0;
dest->last_add.w = 0;
@@ -827,9 +825,6 @@ region_add(Region *dest, Region *source)
// Return EINA_TRUE if some overlap between dest, source
// checks all the simple cases
- // Region 1 and 2 are the same
- if (dest == source) return region_copy(dest, dest);
-
dest->last_del.w = 0;
dest->last_add.w = 0;
@@ -1343,7 +1338,7 @@ region_point_inside(Region *region, int x, int y, Box *box)
if ((!num) || (!INBOX(&region->bound, x, y))) return EINA_FALSE;
if (num == 1)
{
- *box = region->bound;
+ if (box) *box = region->bound;
return EINA_TRUE;
}
for (bx = PIXREGION_BOXPTR(region), bxend = bx + num; bx != bxend; bx++)
@@ -1351,7 +1346,7 @@ region_point_inside(Region *region, int x, int y, Box *box)
if (y >= bx->y2) continue; // not there yet
if ((y < bx->y1) || (x < bx->x1)) break; // missed it
if (x >= bx->x2) continue; // not there yet
- *box = *bx;
+ if (box) *box = *bx;
return EINA_TRUE;
}
return EINA_FALSE;
@@ -1370,6 +1365,8 @@ region_empty(Region *region)
region->bound.x2 = region->bound.x1;
region->bound.y2 = region->bound.y1;
region->data = &_region_emptydata;
+ region->last_del.w = 0;
+ region->last_add.w = 0;
}
Box *