From 6ead226a936059c3f821a1f51e2d1d1af6fbd85f Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Tue, 14 Feb 2012 11:45:23 +0000 Subject: [PATCH] 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 --- .../evas/src/lib/engines/common/evas_tiler.c | 94 ++++++++++++++----- 1 file changed, 69 insertions(+), 25 deletions(-) diff --git a/legacy/evas/src/lib/engines/common/evas_tiler.c b/legacy/evas/src/lib/engines/common/evas_tiler.c index ff359a45cc..bc5e99c44b 100644 --- a/legacy/evas/src/lib/engines/common/evas_tiler.c +++ b/legacy/evas/src/lib/engines/common/evas_tiler.c @@ -1167,40 +1167,84 @@ 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) { - 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->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; + } + + 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; - for (n = tb->rects.head; n; n = n->next) { - rect_t cur; + 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; + } - cur = ((rect_node_t *)n)->rect; + for (n = tb->rects.head; n; n = n->next) + { + rect_t cur; + + cur = ((rect_node_t *)n)->rect; /* disable fuzz - created bugs. cur.left <<= 1; cur.top <<= 1; cur.width <<= 1; cur.height <<= 1; */ - RECTS_CLIP_TO_RECT(cur.left, cur.top, cur.width, cur.height, - 0, 0, tb->outbuf_w, tb->outbuf_h); - if ((cur.width > 0) && (cur.height > 0)) - { - Tilebuf_Rect *r; - - r = malloc(sizeof(Tilebuf_Rect)); - r->x = cur.left; - r->y = cur.top; - r->w = cur.width; - r->h = cur.height; - - rects = (Tilebuf_Rect *)eina_inlist_append(EINA_INLIST_GET(rects), EINA_INLIST_GET(r)); - } - } + RECTS_CLIP_TO_RECT(cur.left, cur.top, cur.width, cur.height, + 0, 0, tb->outbuf_w, tb->outbuf_h); + if ((cur.width > 0) && (cur.height > 0)) + { + Tilebuf_Rect *r; + + r = malloc(sizeof(Tilebuf_Rect)); + r->x = cur.left; + r->y = cur.top; + r->w = cur.width; + r->h = cur.height; + + rects = (Tilebuf_Rect *)eina_inlist_append(EINA_INLIST_GET(rects), EINA_INLIST_GET(r)); + } + } return rects; #else