summaryrefslogtreecommitdiff
path: root/src/lib/evas/common
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-09-24 20:40:38 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-09-24 20:45:14 +0900
commit974e82c5e51d5c5049c13818843fb78464dd6be2 (patch)
treef314da421007988b6d0db1660c12412f90b2246f /src/lib/evas/common
parent08ee7d4b8c708eac2f94e2792df69867d47f0a32 (diff)
evas - make new exact regions round up to 16x16 to keep count sane
make region count sane by rounding to 16x16
Diffstat (limited to 'src/lib/evas/common')
-rw-r--r--src/lib/evas/common/evas_tiler.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/src/lib/evas/common/evas_tiler.c b/src/lib/evas/common/evas_tiler.c
index 74f5d18..91d8fd2 100644
--- a/src/lib/evas/common/evas_tiler.c
+++ b/src/lib/evas/common/evas_tiler.c
@@ -67,20 +67,56 @@ evas_common_tilebuf_clear(Tilebuf *tb)
67 tb->region = region_new(tb->outbuf_w, tb->outbuf_h); 67 tb->region = region_new(tb->outbuf_w, tb->outbuf_h);
68} 68}
69 69
70static Region *
71_region_round(Region *region, int tsize)
72{
73 Region *region2;
74 Box *rects;
75 int num, i, w, h;
76
77 region_size_get(region, &w, &h);
78 region2 = region_new(w, h);
79 rects = region_rects(region);
80 num = region_rects_num(region);
81 for (i = 0; i < num; i++)
82 {
83 int x1, y1, x2, y2;
84
85 x1 = (rects[i].x1 / tsize) * tsize;
86 y1 = (rects[i].y1 / tsize) * tsize;
87 x2 = ((rects[i].x2 + tsize - 1) / tsize) * tsize;
88 y2 = ((rects[i].y2 + tsize - 1) / tsize) * tsize;
89 region_rect_add(region2, x1, y1, x2 - x1, y2 - y1);
90 }
91 return region2;
92}
93
70EAPI Tilebuf_Rect * 94EAPI Tilebuf_Rect *
71evas_common_tilebuf_get_render_rects(Tilebuf *tb) 95evas_common_tilebuf_get_render_rects(Tilebuf *tb)
72{ 96{
73 Tilebuf_Rect *rects = NULL, *r, *rend, *rbuf; 97 Tilebuf_Rect *rects = NULL, *r, *rend, *rbuf;
98 Region *region2;
74 Box *rects2, *rs; 99 Box *rects2, *rs;
75 int n; 100 int n;
76 101
77 rects2 = region_rects(tb->region); 102 region2 = _region_round(tb->region, 16);
78 if (!rects2) return NULL; 103 if (!region2) return NULL;
79 n = region_rects_num(tb->region); 104
105 rects2 = region_rects(region2);
106 if (!rects2)
107 {
108 region_free(region2);
109 return NULL;
110 }
111 n = region_rects_num(region2);
80 if (n <= 0) return NULL; 112 if (n <= 0) return NULL;
81 113
82 rbuf = malloc(n * sizeof(Tilebuf_Rect)); 114 rbuf = malloc(n * sizeof(Tilebuf_Rect));
83 if (!rbuf) return NULL; 115 if (!rbuf)
116 {
117 region_free(region2);
118 return NULL;
119 }
84 120
85 rend = rbuf + n; 121 rend = rbuf + n;
86 rs = rects2; 122 rs = rects2;
@@ -98,6 +134,7 @@ evas_common_tilebuf_get_render_rects(Tilebuf *tb)
98 eina_inlist_append(EINA_INLIST_GET(rects), 134 eina_inlist_append(EINA_INLIST_GET(rects),
99 EINA_INLIST_GET(r)); 135 EINA_INLIST_GET(r));
100 } 136 }
137 region_free(region2);
101 return rects; 138 return rects;
102} 139}
103 140