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
This commit is contained in:
Carsten Haitzler 2015-08-12 20:06:30 +09:00
parent 9d9e8ffab5
commit 40fc5a9282
2 changed files with 36 additions and 7 deletions

View File

@ -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;

View File

@ -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 *