+2013-02-07 Cedric Bail
+
+ * eina: Eina_Tiler now take tile size into account.
+
2013-02-07 WooHyun Jung
* edje: Checking walking_callbacks for not removing patterns which are still used.
* Translations updates:
- french.
* edje entry : Support &, < and > in preedit string
+ * eina: Eina_Tiler now take tile size into account.
Fixes:
* Fix a memory leak in ecore_con_dns when using ecore_con_server_connect
Eina_Rectangle area;
EINA_MAGIC
splitter_t splitter;
+
+ Eina_Bool rounding : 1;
};
#define EINA_MAGIC_CHECK_TILER(d, ...) \
rect_node_t *rn;
//printf("ACCOUNTING[1]: add_redraw: %4d,%4d %3dx%3d\n", x, y, w, h);
- rect->x >>= 1;
- rect->y >>= 1;
- rect->w += 2;
- rect->w >>= 1;
- rect->h += 2;
- rect->h >>= 1;
+ if (t->rounding)
+ {
+ rect->x >>= 1;
+ rect->y >>= 1;
+ rect->w += 2;
+ rect->w >>= 1;
+ rect->h += 2;
+ rect->h >>= 1;
+ }
rn = (rect_node_t *)rect_list_node_pool_get();
rn->_lst = list_node_zeroed;
rect_init(&rn->rect, rect->x, rect->y, rect->w, rect->h);
//printf("ACCOUNTING[2]: add_redraw: %4d,%4d %3dx%3d\n", x, y, w, h);
//testing on my core2 duo desktop - fuzz of 32 or 48 is best.
-#define FUZZ 32
rect_list_add_split_fuzzy_and_merge(&t->splitter.rects,
(list_node_t *)rn,
- FUZZ * FUZZ,
- FUZZ * FUZZ);
+ t->tile.w * t->tile.h,
+ t->tile.w * t->tile.h);
return EINA_TRUE;
}
if (!t->splitter.rects.head)
return;
- rect->x += 1;
- rect->y += 1;
- rect->x >>= 1;
- rect->y >>= 1;
- rect->w -= 1;
- rect->w >>= 1;
- rect->h -= 1;
- rect->h >>= 1;
+ if (t->rounding)
+ {
+ rect->x += 1;
+ rect->y += 1;
+ rect->x >>= 1;
+ rect->y >>= 1;
+ rect->w -= 1;
+ rect->w >>= 1;
+ rect->h -= 1;
+ rect->h >>= 1;
+ }
if ((rect->w <= 0) || (rect->h <= 0))
return;
cur = ((rect_node_t *)n)->rect;
- it->r.x = cur.left << 1;
- it->r.y = cur.top << 1;
- it->r.w = cur.width << 1;
- it->r.h = cur.height << 1;
+ if (it->tiler->rounding)
+ {
+ it->r.x = cur.left << 1;
+ it->r.y = cur.top << 1;
+ it->r.w = cur.width << 1;
+ it->r.h = cur.height << 1;
+ }
+ else
+ {
+ it->r.x = cur.left;
+ it->r.y = cur.top;
+ it->r.w = cur.width;
+ it->r.h = cur.height;
+ }
if (eina_rectangle_intersection(&it->r, &it->tiler->area) == EINA_FALSE)
continue;
t = calloc(1, sizeof(Eina_Tiler));
t->area.w = w;
t->area.h = h;
- t->tile.w = w;
- t->tile.h = h;
+ t->tile.w = 32;
+ t->tile.h = 32;
+ t->rounding = EINA_TRUE;
EINA_MAGIC_SET(t, EINA_MAGIC_TILER);
_splitter_new(t);
return t;
if ((w <= 0) || (h <= 0))
return;
+ if (w == 1 || h == 1) t->rounding = EINA_FALSE;
t->tile.w = w;
t->tile.h = h;
_splitter_tile_size_set(t, w, h);
sp = (splitter_t *)&(t->splitter);
to_merge = t->splitter.rects;
sp->rects = list_zeroed;
- rect_list_merge_rects(&sp->rects, &to_merge, FUZZ * FUZZ);
+ rect_list_merge_rects(&sp->rects, &to_merge, t->tile.w * t->tile.h);
sp->need_merge = 0;
}
unsigned int i = 0;
struct Eina_Tile_Grid_Info *tile;
- EINA_ITERATOR_FOREACH(it, tile) {
+ EINA_ITERATOR_FOREACH(it, tile) {
fail_if(cur_test[i].col != tile->col ||
cur_test[i].row != tile->row ||
cur_test[i].x != tile->rect.x ||
i++;
}
- fail_if(i == 0);
+ fail_if(i == 0);
}
- START_TEST(eina_test_tile_grid_slicer_iterator)
+START_TEST(eina_test_tile_grid_slicer_iterator)
{
Eina_Iterator *it;
struct test_rect *cur_test;
++i;
}
- fail_if(eina_iterator_container_get(it) != tl);
+ fail_if(eina_iterator_container_get(it) != tl);
- eina_iterator_free(it);
+ eina_iterator_free(it);
fail_if(i == 0);
}
END_TEST
+START_TEST(eina_test_tiler_stable)
+{
+ Eina_Tiler *tl;
+ Eina_Rectangle *rp;
+ Eina_Iterator *it;
+ Eina_Rectangle r;
+ int i = 0;
+
+ eina_init();
+
+ tl = eina_tiler_new(640, 480);
+ fail_if(!tl);
+
+ eina_tiler_tile_size_set(tl, 1, 1);
+
+ EINA_RECTANGLE_SET(&r, 50, 50, 20, 20);
+ fail_if(!eina_tiler_rect_add(tl, &r));
+
+ EINA_RECTANGLE_SET(&r, 40, 40, 20, 20);
+ eina_tiler_rect_del(tl, &r);
+
+ it = eina_tiler_iterator_new(tl);
+ fail_if(!it);
+
+ EINA_ITERATOR_FOREACH(it, rp)
+ {
+ EINA_RECTANGLE_SET(&r, 40, 40, 20, 20);
+ fail_if(eina_rectangle_intersection(&r, rp));
+
+ EINA_RECTANGLE_SET(&r, 50, 50, 20, 20);
+ fail_if(!eina_rectangles_intersect(&r, rp));
+ ++i;
+ }
+
+ fail_if(i != 2);
+
+ eina_iterator_free(it);
+
+ eina_tiler_free(tl);
+
+ eina_shutdown();
+}
+END_TEST
+
void
eina_test_tiler(TCase *tc)
{
tcase_add_test(tc, eina_test_tile_grid_slicer_iterator);
tcase_add_test(tc, eina_test_tiler_all);
+ tcase_add_test(tc, eina_test_tiler_stable);
}