forked from enlightenment/efl
* eina: improve quadtree to support more stuff needed by evas.
SVN revision: 49784
This commit is contained in:
parent
7f99f93744
commit
cf128ea0e4
|
@ -39,7 +39,9 @@ EAPI Eina_QuadTree *eina_quadtree_new(size_t w, size_t h,
|
|||
Eina_Quad_Callback horizontal);
|
||||
EAPI void eina_quadtree_free(Eina_QuadTree *q);
|
||||
EAPI void eina_quadtree_resize(Eina_QuadTree *q, size_t w, size_t h);
|
||||
|
||||
EAPI void eina_quadtree_cycle(Eina_QuadTree *q);
|
||||
EAPI void eina_quadtree_increase(Eina_QuadTree_Item *object);
|
||||
|
||||
EAPI Eina_QuadTree_Item *eina_quadtree_add(Eina_QuadTree *q, const void *object);
|
||||
EAPI Eina_Bool eina_quadtree_del(Eina_QuadTree_Item *object);
|
||||
|
|
|
@ -654,7 +654,8 @@ eina_quadtree_add(Eina_QuadTree *q, const void *object)
|
|||
result->root = NULL;
|
||||
result->object = object;
|
||||
|
||||
result->index = 0;
|
||||
result->index = q->index++;
|
||||
|
||||
result->change = EINA_TRUE;
|
||||
result->delete_me = EINA_FALSE;
|
||||
result->visible = EINA_TRUE;
|
||||
|
@ -741,18 +742,8 @@ eina_quadtree_hide(Eina_QuadTree_Item *object)
|
|||
EAPI Eina_Bool
|
||||
eina_quadtree_show(Eina_QuadTree_Item *object)
|
||||
{
|
||||
size_t tmp;
|
||||
|
||||
EINA_MAGIC_CHECK_QUADTREE_ITEM(object, EINA_FALSE);
|
||||
|
||||
tmp = object->quad->index++;
|
||||
if (object->index == tmp
|
||||
&& object->visible)
|
||||
return EINA_TRUE;
|
||||
|
||||
object->index = tmp;
|
||||
if (object->root)
|
||||
object->root->sorted = EINA_FALSE;
|
||||
object->quad->lost = EINA_TRUE;
|
||||
|
||||
if (object->visible) return EINA_TRUE;
|
||||
|
@ -851,6 +842,20 @@ eina_quadtree_cycle(Eina_QuadTree *q)
|
|||
q->index = 0;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
eina_quadtree_increase(Eina_QuadTree_Item *object)
|
||||
{
|
||||
size_t tmp;
|
||||
|
||||
tmp = object->quad->index++;
|
||||
if (object->index == tmp)
|
||||
return ;
|
||||
|
||||
object->index = tmp;
|
||||
if (object->root)
|
||||
object->root->sorted = EINA_FALSE;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
eina_quadtree_init(void)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "eina_suite.h"
|
||||
#include "Eina.h"
|
||||
|
||||
|
@ -150,9 +153,12 @@ START_TEST(eina_quadtree_collision)
|
|||
|
||||
eina_quadtree_cycle(q);
|
||||
eina_quadtree_show(objects[4].item);
|
||||
eina_quadtree_increase(objects[4].item);
|
||||
eina_quadtree_show(objects[5].item);
|
||||
eina_quadtree_increase(objects[5].item);
|
||||
eina_quadtree_del(objects[5].item);
|
||||
eina_quadtree_change(objects[10].item);
|
||||
eina_quadtree_increase(objects[10].item);
|
||||
|
||||
eina_quadtree_resize(q, 641, 480);
|
||||
|
||||
|
|
Loading…
Reference in New Issue