while looking into the infintie loop issue - update regions can become

a lot in these pathological cases, so limit them to 24 and if > use
bounding box as a single region.



SVN revision: 67917
This commit is contained in:
Carsten Haitzler 2012-02-14 11:45:23 +00:00
parent b1bb770688
commit 6ead226a93
1 changed files with 69 additions and 25 deletions

View File

@ -1167,8 +1167,10 @@ evas_common_tilebuf_get_render_rects(Tilebuf *tb)
#elif defined(EVAS_RECT_SPLIT)
list_node_t *n;
Tilebuf_Rect *rects = NULL;
int bx1 = 0, bx2 = 0, by1 = 0, by2 = 0, num = 0;
if (tb->need_merge) {
if (tb->need_merge)
{
list_t to_merge;
to_merge = tb->rects;
tb->rects = list_zeroed;
@ -1176,7 +1178,49 @@ evas_common_tilebuf_get_render_rects(Tilebuf *tb)
tb->need_merge = 0;
}
for (n = tb->rects.head; n; n = n->next) {
n = tb->rects.head;
if (n)
{
bx1 = ((rect_node_t *)n)->rect.left;
bx2 = bx1 + ((rect_node_t *)n)->rect.width;
by1 = ((rect_node_t *)n)->rect.top;
by2 = by1 + ((rect_node_t *)n)->rect.height;
n = n->next;
for (; n; n = n->next)
{
int x1, x2, y1, y2;
x1 = ((rect_node_t *)n)->rect.left;
if (x1 < bx1) bx1 = x1;
x2 = x1 + ((rect_node_t *)n)->rect.width;
if (x2 > bx2) bx2 = x2;
y1 = ((rect_node_t *)n)->rect.top;
if (y1 < by1) by1 = y1;
y2 = y1 + ((rect_node_t *)n)->rect.height;
if (y2 > by2) by2 = y2;
num++;
}
}
#define MAXREG 24
/* magic number - but if we have > MAXREG regions to update, take bounding box */
if (num > MAXREG)
{
Tilebuf_Rect *r;
r = malloc(sizeof(Tilebuf_Rect));
r->x = bx1;
r->y = by1;
r->w = bx2 - bx1;
r->h = by2 - by1;
rects = (Tilebuf_Rect *)eina_inlist_append(EINA_INLIST_GET(rects), EINA_INLIST_GET(r));
return rects;
}
for (n = tb->rects.head; n; n = n->next)
{
rect_t cur;
cur = ((rect_node_t *)n)->rect;