* eina: fix eina_tiler_iterator_new API to be consistent with the

rest of the iterator API and usage.

	WARNING !!! THIS IS REALLY BAD BUT FOR CONSISTENCY, I THINK THAT THIS
	API BREAK WAS NEEDED. IN FACT IT'S MORE AN ABI BREAK AS IT WILL NOT
	TRIGGER WARNING OR ERROR IN CURRENT PROGRAM USING
	eina_tiler_iterator_new SO YOU ARE WARNED !

	Reported by playya <frederik.sdun@googlemail.com>.


SVN revision: 54153
This commit is contained in:
Cedric BAIL 2010-11-04 14:53:00 +00:00
parent 3ede459046
commit 57997619c9
2 changed files with 14 additions and 12 deletions

View File

@ -96,6 +96,7 @@ typedef struct _Eina_Iterator_Tiler
Eina_Iterator iterator;
const Eina_Tiler *tiler;
list_node_t *curr;
Eina_Rectangle r;
EINA_MAGIC
} Eina_Iterator_Tiler;
@ -1064,7 +1065,6 @@ static inline void _splitter_clear(Eina_Tiler *t)
static Eina_Bool _iterator_next(Eina_Iterator_Tiler *it, void **data)
{
Eina_Rectangle *rect = (Eina_Rectangle *)data;
list_node_t *n;
for (n = it->curr; n; n = n->next)
@ -1073,18 +1073,19 @@ static Eina_Bool _iterator_next(Eina_Iterator_Tiler *it, void **data)
cur = ((rect_node_t *)n)->rect;
rect->x = cur.left << 1;
rect->y = cur.top << 1;
rect->w = cur.width << 1;
rect->h = cur.height << 1;
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 (eina_rectangle_intersection(rect, &it->tiler->area) == EINA_FALSE)
if (eina_rectangle_intersection(&it->r, &it->tiler->area) == EINA_FALSE)
continue;
if ((rect->w <= 0) || (rect->h <= 0))
if ((it->r.w <= 0) || (it->r.h <= 0))
continue;
it->curr = n->next;
*(Eina_Rectangle **)data = &it->r;
return EINA_TRUE;
}
return EINA_FALSE;

View File

@ -131,6 +131,7 @@ START_TEST(eina_test_tiler_all)
{
Eina_Tiler *tl;
Eina_Iterator *it;
Eina_Rectangle *rp;
Eina_Rectangle r;
int i = 0;
@ -152,12 +153,12 @@ START_TEST(eina_test_tiler_all)
it = eina_tiler_iterator_new(tl);
fail_if(!it);
EINA_ITERATOR_FOREACH(it, r)
EINA_ITERATOR_FOREACH(it, rp)
{
fail_if(r.w <= 0);
fail_if(r.h <= 0);
fail_if(r.x < 0 || r.x + r.w > 640);
fail_if(r.y < 0 || r.y + r.h > 480);
fail_if(rp->w <= 0);
fail_if(rp->h <= 0);
fail_if(rp->x < 0 || rp->x + rp->w > 640);
fail_if(rp->y < 0 || rp->y + rp->h > 480);
++i;
}