2017-04-25 22:04:21 -07:00
|
|
|
#include "evas_map.h"
|
2009-10-22 08:47:30 -07:00
|
|
|
|
|
|
|
static void
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_map_calc_geom_change(Evas_Object *eo_obj)
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
2012-11-24 08:08:45 -08:00
|
|
|
if (!obj) return;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
|
|
|
evas_object_clip_dirty(eo_obj, obj);
|
|
|
|
if (!(obj->layer->evas->is_frozen))
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2013-04-06 22:00:10 -07:00
|
|
|
evas_object_recalc_clippees(obj);
|
2016-10-21 05:25:41 -07:00
|
|
|
if (!obj->is_smart && obj->cur->visible)
|
2011-05-23 03:37:17 -07:00
|
|
|
{
|
2016-10-21 05:25:41 -07:00
|
|
|
_evas_canvas_event_pointer_in_list_mouse_move_feed(obj->layer->evas, NULL, eo_obj, obj, 1, 1,
|
|
|
|
EINA_TRUE, NULL);
|
2011-05-23 03:37:17 -07:00
|
|
|
}
|
2009-10-22 08:47:30 -07:00
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_inform_call_move(eo_obj, obj);
|
2017-10-19 16:07:39 -07:00
|
|
|
evas_object_inform_call_resize(eo_obj, obj);
|
2009-10-22 08:47:30 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 22:04:21 -07:00
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_map_calc_map_geometry(Evas_Object *eo_obj)
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2012-01-19 08:49:47 -08:00
|
|
|
Evas_Coord x1, x2, yy1, yy2;
|
2009-10-28 01:59:01 -07:00
|
|
|
const Evas_Map_Point *p, *p_end;
|
2010-12-06 14:28:38 -08:00
|
|
|
Eina_Bool ch = EINA_FALSE;
|
2009-10-22 08:47:30 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
2012-11-24 08:08:45 -08:00
|
|
|
if (!obj) return;
|
2013-01-21 19:56:00 -08:00
|
|
|
if (!obj->map->cur.map) return;
|
|
|
|
if (obj->map->prev.map)
|
2010-12-06 14:28:38 -08:00
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
if (obj->map->prev.map != obj->map->cur.map)
|
2011-01-03 02:12:17 -08:00
|
|
|
{
|
2012-07-17 02:09:45 -07:00
|
|
|
// FIXME: this causes an infinite loop somewhere... hard to debug
|
2013-01-21 19:56:00 -08:00
|
|
|
if (obj->map->prev.map->count == obj->map->cur.map->count)
|
2012-07-17 02:09:45 -07:00
|
|
|
{
|
|
|
|
const Evas_Map_Point *p2;
|
finally found evas_map weirdness bug. CEDRIC code...! commit #74180.
now here's the rub. from the glibc manual page:
...
int memcmp(const void *s1, const void *s2, size_t n);
DESCRIPTION
The memcmp() function compares the first n bytes (each interpreted as
unsigned char) of the memory areas s1 and s2. It returns an integer
less than, equal to, or greater than zero if s1 is found, respectively,
to be less than, to match, or be greater than s2.
RETURN VALUE
The memcmp() function returns an integer less than, equal to, or
greater than zero if the first n bytes of s1 is found, respectively, to
be less than, to match, or be greater than the first n bytes of s2.
...
this explicitly says that s1 and s2 have their BYTES compared... and
then returns just some value < 0, 0 or > 0 based on the difference. what
that value is and means is not defined, as long as it is < 0, 0 or > 0.
so the C standard has this to say:
6.3.1.3 Signed and unsigned integers
2. Otherwise, if the new type is unsigned, the value is converted by
repeatedly adding or subtracting one more than the maximum value that
can be represented in the new type until the value is in the range of
the new type.
so a result of -255 (possible) is converted by REPEATEDLY adding the
max size of the new type (255) until within range... so ...
-255 + 255 = 0 ... within range.. BUT FALSE!
so why do we see this now? something changed in memcpy behavior.
before we ONLY saw values of -1, 0 or 1 - nothing else, NOW we see
thins like:
-12288
49152
4096
16384
61440
-53248
so memcpy changed behavior, though within specs of the manual page
anyway, but now the values can be ones that break the simple assignment.
SVN revision: 75159
2012-08-11 21:17:42 -07:00
|
|
|
|
2013-01-21 19:56:00 -08:00
|
|
|
p = obj->map->cur.map->points;
|
|
|
|
p2 = obj->map->prev.map->points;
|
2016-10-14 03:45:42 -07:00
|
|
|
if (memcmp(p, p2, sizeof(Evas_Map_Point) *
|
2013-01-21 19:56:00 -08:00
|
|
|
obj->map->prev.map->count) != 0)
|
finally found evas_map weirdness bug. CEDRIC code...! commit #74180.
now here's the rub. from the glibc manual page:
...
int memcmp(const void *s1, const void *s2, size_t n);
DESCRIPTION
The memcmp() function compares the first n bytes (each interpreted as
unsigned char) of the memory areas s1 and s2. It returns an integer
less than, equal to, or greater than zero if s1 is found, respectively,
to be less than, to match, or be greater than s2.
RETURN VALUE
The memcmp() function returns an integer less than, equal to, or
greater than zero if the first n bytes of s1 is found, respectively, to
be less than, to match, or be greater than the first n bytes of s2.
...
this explicitly says that s1 and s2 have their BYTES compared... and
then returns just some value < 0, 0 or > 0 based on the difference. what
that value is and means is not defined, as long as it is < 0, 0 or > 0.
so the C standard has this to say:
6.3.1.3 Signed and unsigned integers
2. Otherwise, if the new type is unsigned, the value is converted by
repeatedly adding or subtracting one more than the maximum value that
can be represented in the new type until the value is in the range of
the new type.
so a result of -255 (possible) is converted by REPEATEDLY adding the
max size of the new type (255) until within range... so ...
-255 + 255 = 0 ... within range.. BUT FALSE!
so why do we see this now? something changed in memcpy behavior.
before we ONLY saw values of -1, 0 or 1 - nothing else, NOW we see
thins like:
-12288
49152
4096
16384
61440
-53248
so memcpy changed behavior, though within specs of the manual page
anyway, but now the values can be ones that break the simple assignment.
SVN revision: 75159
2012-08-11 21:17:42 -07:00
|
|
|
ch = EINA_TRUE;
|
2012-07-17 02:09:45 -07:00
|
|
|
if (!ch)
|
2011-04-12 02:44:50 -07:00
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write)
|
|
|
|
{
|
|
|
|
if (map_write->cache_map) evas_map_free(map_write->cache_map);
|
|
|
|
map_write->cache_map = map_write->cur.map;
|
|
|
|
map_write->cur.map = map_write->prev.map;
|
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write);
|
2011-04-12 02:44:50 -07:00
|
|
|
}
|
2011-01-03 02:12:17 -08:00
|
|
|
}
|
2012-07-17 02:09:45 -07:00
|
|
|
else
|
2012-08-11 21:18:44 -07:00
|
|
|
ch = EINA_TRUE;
|
2011-01-03 02:12:17 -08:00
|
|
|
}
|
2010-12-06 14:28:38 -08:00
|
|
|
}
|
2011-04-12 02:44:50 -07:00
|
|
|
else
|
2012-08-11 21:18:44 -07:00
|
|
|
ch = EINA_TRUE;
|
|
|
|
|
2013-01-21 19:56:00 -08:00
|
|
|
p = obj->map->cur.map->points;
|
|
|
|
p_end = p + obj->map->cur.map->count;
|
2011-12-11 22:25:14 -08:00
|
|
|
x1 = x2 = lround(p->x);
|
2012-01-19 08:49:47 -08:00
|
|
|
yy1 = yy2 = lround(p->y);
|
2009-10-28 01:59:01 -07:00
|
|
|
p++;
|
|
|
|
for (; p < p_end; p++)
|
|
|
|
{
|
2011-12-12 00:23:24 -08:00
|
|
|
Evas_Coord x, y;
|
|
|
|
|
|
|
|
x = lround(p->x);
|
|
|
|
y = lround(p->y);
|
|
|
|
if (x < x1) x1 = x;
|
|
|
|
if (x > x2) x2 = x;
|
2012-01-19 08:49:47 -08:00
|
|
|
if (y < yy1) yy1 = y;
|
|
|
|
if (y > yy2) yy2 = y;
|
2009-10-28 01:59:01 -07:00
|
|
|
}
|
2011-10-26 06:33:25 -07:00
|
|
|
// this causes clip-out bugs now mapped objs canbe opaque!!!
|
|
|
|
// // add 1 pixel of fuzz around the map region to ensure updates are correct
|
2012-01-19 08:49:47 -08:00
|
|
|
// x1 -= 1; yy1 -= 1;
|
|
|
|
// x2 += 1; yy2 += 1;
|
2013-01-21 19:56:00 -08:00
|
|
|
if (obj->map->cur.map->normal_geometry.x != x1) ch = 1;
|
|
|
|
if (obj->map->cur.map->normal_geometry.y != yy1) ch = 1;
|
|
|
|
if (obj->map->cur.map->normal_geometry.w != (x2 - x1)) ch = 1;
|
|
|
|
if (obj->map->cur.map->normal_geometry.h != (yy2 - yy1)) ch = 1;
|
|
|
|
obj->map->cur.map->normal_geometry.x = x1;
|
|
|
|
obj->map->cur.map->normal_geometry.y = yy1;
|
|
|
|
obj->map->cur.map->normal_geometry.w = (x2 - x1);
|
|
|
|
obj->map->cur.map->normal_geometry.h = (yy2 - yy1);
|
evas_map: draw what map did not draw before.
Summary:
When a map property is changed, map draws it.
Before drawing, evas_object_map_update updates map->spans which is data for
actual drawing. But if changed_map is false, then evas_object_map_update does
not update map->spans.
Usually mapped object has following step.
(1) change map data (evas_map_point_coord_set)
(2) render_pre
(3) evas_object_map_update updates map->spans if changed_map is true.
(4) render
(5) render_post -> evas_object_cur_prev -> "map->prev = map->cur"
But if mapped object hides at step(1), then step(3),(4) does not happen. But
step(4) map->prev keeps changed map data. After this point, If same map data
comes, then map does not draw it. Because the new data is same with map->prev.
The issue occurs with following step.
(A) point_coord_set with point A.
(B) (2)(3)(4)(5) works.
(C) point_coord_set with point B. And hide.
(D) (2)(5) wokrs.
(E) point_coord_set with point A. still hide, so none of (2)(3)(4)(5) work.
(F) point_coord_set with point B. And show.
(G) (2)(3)(4)(5) works. BUT step(3) does not update map->spans because
changed_map is false. So you can see image of point A.
The changed_map is changed to false after updating map->spans at step(3).
So usually changed_map is false before deciding changed_map of next render.
In case of not rendering (but render_pre/post) after map data is changed, the
changed_map keeps true. So this patch was suppose to make changed_map
false if changed_map is already ture before _evas_map_calc_map_geometry
decides changed_map which occurs step(1). true changed_map indicates that
you need to draw even though new map data is same with previous map data.
Test Plan: {F3739770}
Reviewers: Hermet, jsuya
Reviewed By: Hermet
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9476
2019-08-13 20:39:36 -07:00
|
|
|
|
|
|
|
/* if change_map is true, it means that the prev map data
|
|
|
|
did not render before. even though both prev and cur
|
|
|
|
has same map points we need to draw it */
|
|
|
|
obj->changed_map |= ch;
|
|
|
|
|
2012-07-19 04:07:14 -07:00
|
|
|
// This shouldn't really be needed, but without it we do have case
|
|
|
|
// where the clip is wrong when a map doesn't change, so always forcing
|
|
|
|
// it, as long as someone doesn't find a better fix.
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_clip_dirty(eo_obj, obj);
|
|
|
|
if (ch) _evas_map_calc_geom_change(eo_obj);
|
2009-10-22 08:47:30 -07:00
|
|
|
}
|
|
|
|
|
2015-01-23 05:50:04 -08:00
|
|
|
static void
|
|
|
|
evas_object_map_move_sync(Evas_Object *eo_obj)
|
|
|
|
{
|
|
|
|
Evas_Object_Protected_Data *obj;
|
|
|
|
Evas_Map *m;
|
|
|
|
Evas_Map_Point *p;
|
|
|
|
Evas_Coord diff_x, diff_y;
|
|
|
|
int i, count;
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
2015-01-23 05:50:04 -08:00
|
|
|
if (!obj) return;
|
|
|
|
|
|
|
|
if ((!obj->map->cur.map->move_sync.enabled) ||
|
|
|
|
((obj->map->cur.map->move_sync.diff_x == 0) &&
|
|
|
|
(obj->map->cur.map->move_sync.diff_y == 0)))
|
|
|
|
return;
|
|
|
|
|
|
|
|
m = obj->map->cur.map;
|
|
|
|
p = m->points;
|
|
|
|
count = m->count;
|
|
|
|
diff_x = m->move_sync.diff_x;
|
|
|
|
diff_y = m->move_sync.diff_y;
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++, p++)
|
|
|
|
{
|
|
|
|
p->px += diff_x;
|
|
|
|
p->py += diff_y;
|
|
|
|
p->x += diff_x;
|
|
|
|
p->y += diff_y;
|
|
|
|
}
|
|
|
|
m->move_sync.diff_x = 0;
|
|
|
|
m->move_sync.diff_y = 0;
|
|
|
|
|
|
|
|
_evas_map_calc_map_geometry(eo_obj);
|
|
|
|
}
|
|
|
|
|
2017-05-11 00:59:54 -07:00
|
|
|
static void
|
|
|
|
_evas_map_init(Evas_Map *m, int count, Eina_Bool sync)
|
2009-10-22 13:11:33 -07:00
|
|
|
{
|
2016-06-27 23:40:41 -07:00
|
|
|
m->move_sync.enabled = sync;
|
2009-10-22 13:11:33 -07:00
|
|
|
m->count = count;
|
2009-10-31 02:08:01 -07:00
|
|
|
m->alpha = 1;
|
|
|
|
m->smooth = 1;
|
2011-06-16 05:08:46 -07:00
|
|
|
m->magic = MAGIC_MAP;
|
2017-04-25 23:11:51 -07:00
|
|
|
for (int i = 0; i < count; i++)
|
2009-10-31 18:32:23 -07:00
|
|
|
{
|
|
|
|
m->points[i].r = 255;
|
|
|
|
m->points[i].g = 255;
|
|
|
|
m->points[i].b = 255;
|
|
|
|
m->points[i].a = 255;
|
|
|
|
}
|
2017-05-11 00:59:54 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Map *
|
|
|
|
_evas_map_new(int count, Eina_Bool sync)
|
|
|
|
{
|
|
|
|
Evas_Map *m;
|
|
|
|
int alloc;
|
|
|
|
|
|
|
|
/* Adjust allocation such that: at least 4 points, and always an even
|
|
|
|
* number: this allows the software engine to work efficiently */
|
|
|
|
alloc = (count < 4) ? 4 : count;
|
|
|
|
if (alloc & 0x1) alloc ++;
|
|
|
|
|
2017-05-16 21:43:33 -07:00
|
|
|
m = calloc(1, sizeof(Evas_Map) + (alloc * sizeof(Evas_Map_Point)));
|
2017-05-11 00:59:54 -07:00
|
|
|
if (!m) return NULL;
|
|
|
|
_evas_map_init(m, count, sync);
|
2009-10-22 13:11:33 -07:00
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
2017-05-11 00:59:54 -07:00
|
|
|
void
|
|
|
|
_evas_map_reset(Evas_Map *m)
|
|
|
|
{
|
2017-06-08 21:46:33 -07:00
|
|
|
int alloc, count;
|
|
|
|
Eina_Bool sync;
|
2017-05-16 21:43:33 -07:00
|
|
|
|
2017-05-11 00:59:54 -07:00
|
|
|
if (!m) return;
|
2017-05-16 21:43:33 -07:00
|
|
|
|
|
|
|
/* Adjust allocation such that: at least 4 points, and always an even
|
|
|
|
* number: this allows the software engine to work efficiently */
|
|
|
|
alloc = (m->count < 4) ? 4 : m->count;
|
|
|
|
if (alloc & 0x1) alloc ++;
|
|
|
|
|
2017-06-08 21:46:33 -07:00
|
|
|
count = m->count;
|
|
|
|
sync = m->move_sync.enabled;
|
2017-05-16 21:43:33 -07:00
|
|
|
memset(m, 0, sizeof(Evas_Map) + (alloc * sizeof(Evas_Map_Point)));
|
2017-06-08 21:46:33 -07:00
|
|
|
_evas_map_init(m, count, sync);
|
2017-05-11 00:59:54 -07:00
|
|
|
}
|
|
|
|
|
2009-10-22 13:11:33 -07:00
|
|
|
static inline Eina_Bool
|
|
|
|
_evas_map_copy(Evas_Map *dst, const Evas_Map *src)
|
|
|
|
{
|
|
|
|
if (dst->count != src->count)
|
|
|
|
{
|
2011-05-23 03:37:17 -07:00
|
|
|
ERR("cannot copy map of different sizes: dst=%i, src=%i", dst->count, src->count);
|
|
|
|
return EINA_FALSE;
|
2009-10-22 13:11:33 -07:00
|
|
|
}
|
2012-07-04 02:39:23 -07:00
|
|
|
if (dst == src) return EINA_TRUE;
|
|
|
|
if (dst->points != src->points)
|
|
|
|
memcpy(dst->points, src->points, src->count * sizeof(Evas_Map_Point));
|
2009-10-31 02:08:01 -07:00
|
|
|
dst->smooth = src->smooth;
|
|
|
|
dst->alpha = src->alpha;
|
2014-11-27 20:18:16 -08:00
|
|
|
dst->move_sync = src->move_sync;
|
2010-09-21 23:52:28 -07:00
|
|
|
dst->persp = src->persp;
|
2009-10-22 13:11:33 -07:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2009-10-31 18:32:23 -07:00
|
|
|
static inline Evas_Map *
|
|
|
|
_evas_map_dup(const Evas_Map *orig)
|
|
|
|
{
|
2016-06-27 23:40:41 -07:00
|
|
|
Evas_Map *copy = _evas_map_new(orig->count, EINA_FALSE);
|
2009-10-31 18:32:23 -07:00
|
|
|
if (!copy) return NULL;
|
|
|
|
memcpy(copy->points, orig->points, orig->count * sizeof(Evas_Map_Point));
|
|
|
|
copy->smooth = orig->smooth;
|
|
|
|
copy->alpha = orig->alpha;
|
2014-11-27 20:18:16 -08:00
|
|
|
copy->move_sync = orig->move_sync;
|
2010-09-21 23:52:28 -07:00
|
|
|
copy->persp = orig->persp;
|
2009-10-31 18:32:23 -07:00
|
|
|
return copy;
|
|
|
|
}
|
|
|
|
|
2009-10-22 13:11:33 -07:00
|
|
|
static inline void
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_map_free(Evas_Object *eo_obj, Evas_Map *m)
|
2009-10-22 13:11:33 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
if (eo_obj)
|
2010-04-12 01:23:53 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
2013-01-21 19:56:00 -08:00
|
|
|
if ((obj) && (obj->map->spans))
|
2012-06-14 23:36:49 -07:00
|
|
|
{
|
2017-04-24 15:09:25 -07:00
|
|
|
obj->layer->evas->engine.func->image_map_clean(ENC, obj->map->spans);
|
2013-01-21 19:56:00 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write)
|
|
|
|
{
|
|
|
|
free(map_write->spans);
|
|
|
|
map_write->spans = NULL;
|
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write);
|
2012-06-14 23:36:49 -07:00
|
|
|
}
|
2010-04-12 01:23:53 -07:00
|
|
|
}
|
2011-06-16 18:16:16 -07:00
|
|
|
m->magic = 0;
|
2009-10-22 13:11:33 -07:00
|
|
|
free(m);
|
|
|
|
}
|
|
|
|
|
2017-06-28 14:42:28 -07:00
|
|
|
EAPI Eina_Bool
|
2016-08-10 19:58:42 -07:00
|
|
|
evas_map_coords_get(const Evas_Map *m, double x, double y,
|
|
|
|
double *mx, double *my, int grab)
|
2009-11-05 07:24:48 -08:00
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return EINA_FALSE;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2012-11-12 21:34:47 -08:00
|
|
|
if (m->count < 4) return EINA_FALSE;
|
2012-11-13 02:15:29 -08:00
|
|
|
|
|
|
|
Eina_Bool inside = evas_map_inside_get(m, x, y);
|
|
|
|
if ((!mx) && (!my)) return inside;
|
|
|
|
|
|
|
|
// FIXME: need to handle grab mode and extrapolate coords outside map
|
|
|
|
if (grab && !inside) return EINA_FALSE;
|
2012-11-12 20:08:16 -08:00
|
|
|
|
|
|
|
int i, j, edges, edge[m->count][2];
|
|
|
|
Eina_Bool douv = EINA_FALSE;
|
2016-08-10 19:58:42 -07:00
|
|
|
double xe[2];
|
2009-12-21 07:52:12 -08:00
|
|
|
double u[2] = { 0.0, 0.0 };
|
|
|
|
double v[2] = { 0.0, 0.0 };
|
2009-11-05 07:24:48 -08:00
|
|
|
|
2012-11-13 02:15:29 -08:00
|
|
|
/*
|
2009-11-05 07:24:48 -08:00
|
|
|
if (grab)
|
|
|
|
{
|
2016-08-10 19:58:42 -07:00
|
|
|
double ymin, ymax;
|
2011-02-06 15:52:17 -08:00
|
|
|
|
2009-11-05 07:24:48 -08:00
|
|
|
ymin = m->points[0].y;
|
|
|
|
ymax = m->points[0].y;
|
|
|
|
for (i = 1; i < m->count; i++)
|
|
|
|
{
|
2011-02-06 15:52:17 -08:00
|
|
|
if (m->points[i].y < ymin) ymin = m->points[i].y;
|
|
|
|
else if (m->points[i].y > ymax) ymax = m->points[i].y;
|
2009-11-05 07:24:48 -08:00
|
|
|
}
|
|
|
|
if (y <= ymin) y = ymin + 1;
|
|
|
|
if (y >= ymax) y = ymax - 1;
|
|
|
|
}
|
2012-11-13 02:15:29 -08:00
|
|
|
*/
|
2012-11-12 21:34:47 -08:00
|
|
|
edges = EINA_FALSE;
|
2009-11-05 07:24:48 -08:00
|
|
|
for (i = 0; i < m->count; i++)
|
|
|
|
{
|
|
|
|
j = (i + 1) % m->count;
|
|
|
|
if ((m->points[i].y <= y) && (m->points[j].y > y))
|
|
|
|
{
|
|
|
|
edge[edges][0] = i;
|
|
|
|
edge[edges][1] = j;
|
|
|
|
edges++;
|
|
|
|
}
|
|
|
|
else if ((m->points[j].y <= y) && (m->points[i].y > y))
|
|
|
|
{
|
|
|
|
edge[edges][0] = j;
|
|
|
|
edge[edges][1] = i;
|
|
|
|
edges++;
|
|
|
|
}
|
|
|
|
}
|
2012-11-12 20:08:16 -08:00
|
|
|
if ((mx) || (my)) douv = EINA_TRUE;
|
2009-11-05 07:24:48 -08:00
|
|
|
for (i = 0; i < (edges - 1); i+= 2)
|
|
|
|
{
|
2016-08-10 19:58:42 -07:00
|
|
|
double yp, yd;
|
2010-01-21 22:51:27 -08:00
|
|
|
|
2009-11-05 07:24:48 -08:00
|
|
|
j = i + 1;
|
|
|
|
yd = m->points[edge[i][1]].y - m->points[edge[i][0]].y;
|
|
|
|
if (yd > 0)
|
|
|
|
{
|
|
|
|
yp = y - m->points[edge[i][0]].y;
|
|
|
|
xe[0] = m->points[edge[i][1]].x - m->points[edge[i][0]].x;
|
|
|
|
xe[0] = m->points[edge[i][0]].x + ((xe[0] * yp) / yd);
|
|
|
|
if (douv)
|
|
|
|
{
|
|
|
|
u[0] = m->points[edge[i][1]].u - m->points[edge[i][0]].u;
|
|
|
|
u[0] = m->points[edge[i][0]].u + ((u[0] * yp) / yd);
|
|
|
|
v[0] = m->points[edge[i][1]].v - m->points[edge[i][0]].v;
|
|
|
|
v[0] = m->points[edge[i][0]].v + ((v[0] * yp) / yd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xe[0] = m->points[edge[i][0]].x;
|
|
|
|
if (douv)
|
|
|
|
{
|
|
|
|
u[0] = m->points[edge[i][0]].u;
|
|
|
|
v[0] = m->points[edge[i][0]].v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
yd = m->points[edge[j][1]].y - m->points[edge[j][0]].y;
|
|
|
|
if (yd > 0)
|
|
|
|
{
|
|
|
|
yp = y - m->points[edge[j][0]].y;
|
|
|
|
xe[1] = m->points[edge[j][1]].x - m->points[edge[j][0]].x;
|
|
|
|
xe[1] = m->points[edge[j][0]].x + ((xe[1] * yp) / yd);
|
|
|
|
if (douv)
|
|
|
|
{
|
|
|
|
u[1] = m->points[edge[j][1]].u - m->points[edge[j][0]].u;
|
|
|
|
u[1] = m->points[edge[j][0]].u + ((u[1] * yp) / yd);
|
|
|
|
v[1] = m->points[edge[j][1]].v - m->points[edge[j][0]].v;
|
|
|
|
v[1] = m->points[edge[j][0]].v + ((v[1] * yp) / yd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xe[1] = m->points[edge[j][0]].x;
|
|
|
|
if (douv)
|
|
|
|
{
|
|
|
|
u[1] = m->points[edge[j][0]].u;
|
|
|
|
v[1] = m->points[edge[j][0]].v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (xe[0] > xe[1])
|
|
|
|
{
|
|
|
|
int ti;
|
2011-02-06 15:52:17 -08:00
|
|
|
|
2009-11-05 07:24:48 -08:00
|
|
|
ti = xe[0]; xe[0] = xe[1]; xe[1] = ti;
|
|
|
|
if (douv)
|
|
|
|
{
|
|
|
|
double td;
|
2011-02-06 15:52:17 -08:00
|
|
|
|
2009-11-05 07:24:48 -08:00
|
|
|
td = u[0]; u[0] = u[1]; u[1] = td;
|
|
|
|
td = v[0]; v[0] = v[1]; v[1] = td;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((x >= xe[0]) && (x < xe[1]))
|
|
|
|
{
|
|
|
|
if (douv)
|
|
|
|
{
|
2011-02-06 15:52:17 -08:00
|
|
|
if (mx)
|
|
|
|
*mx = u[0] + (((x - xe[0]) * (u[1] - u[0])) /
|
2009-11-05 07:24:48 -08:00
|
|
|
(xe[1] - xe[0]));
|
2012-11-12 20:08:16 -08:00
|
|
|
if (my)
|
2011-02-06 15:52:17 -08:00
|
|
|
*my = v[0] + (((x - xe[0]) * (v[1] - v[0])) /
|
2009-11-05 07:24:48 -08:00
|
|
|
(xe[1] - xe[0]));
|
|
|
|
}
|
2011-06-16 05:18:19 -07:00
|
|
|
return EINA_TRUE;
|
2009-11-05 07:24:48 -08:00
|
|
|
}
|
2012-11-13 02:15:29 -08:00
|
|
|
/*
|
|
|
|
if (grab)
|
2009-11-05 07:24:48 -08:00
|
|
|
{
|
|
|
|
if (douv)
|
|
|
|
{
|
2011-02-06 15:52:17 -08:00
|
|
|
if (mx)
|
|
|
|
*mx = u[0] + (((x - xe[0]) * (u[1] - u[0])) /
|
2009-11-05 07:24:48 -08:00
|
|
|
(xe[1] - xe[0]));
|
|
|
|
if (my)
|
2011-02-06 15:52:17 -08:00
|
|
|
*my = v[0] + (((x - xe[0]) * (v[1] - v[0])) /
|
2009-11-05 07:24:48 -08:00
|
|
|
(xe[1] - xe[0]));
|
|
|
|
}
|
2011-06-16 05:18:19 -07:00
|
|
|
return EINA_TRUE;
|
2009-11-05 07:24:48 -08:00
|
|
|
}
|
2012-11-13 02:15:29 -08:00
|
|
|
*/
|
2009-11-05 07:24:48 -08:00
|
|
|
}
|
2011-06-16 05:18:19 -07:00
|
|
|
return EINA_FALSE;
|
2009-11-05 07:24:48 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Eina_Bool
|
|
|
|
evas_map_inside_get(const Evas_Map *m, Evas_Coord x, Evas_Coord y)
|
|
|
|
{
|
2012-11-12 21:34:47 -08:00
|
|
|
int i = 0, j = m->count - 1;
|
|
|
|
double pt1_x, pt1_y, pt2_x, pt2_y, tmp_x;
|
|
|
|
Eina_Bool inside = EINA_FALSE;
|
|
|
|
|
|
|
|
//Check the point inside the map coords by using Jordan curve theorem.
|
|
|
|
for (i = 0; i < m->count; i++)
|
|
|
|
{
|
|
|
|
pt1_x = m->points[i].x;
|
|
|
|
pt1_y = m->points[i].y;
|
|
|
|
pt2_x = m->points[j].x;
|
|
|
|
pt2_y = m->points[j].y;
|
|
|
|
|
|
|
|
//Is the point inside the map on y axis?
|
|
|
|
if (((y >= pt1_y) && (y < pt2_y)) || ((y >= pt2_y) && (y < pt1_y)))
|
|
|
|
{
|
|
|
|
//Check the point is left side of the line segment.
|
|
|
|
tmp_x = (pt1_x + ((pt2_x - pt1_x) / (pt2_y - pt1_y)) *
|
|
|
|
((double)y - pt1_y));
|
|
|
|
if ((double)x < tmp_x) inside = !inside;
|
|
|
|
}
|
|
|
|
j = i;
|
|
|
|
}
|
|
|
|
return inside;
|
2009-11-05 07:24:48 -08:00
|
|
|
}
|
|
|
|
|
2016-07-07 20:26:55 -07:00
|
|
|
#if 0
|
2012-05-01 00:31:42 -07:00
|
|
|
static Eina_Bool
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_object_map_parent_check(Evas_Object *eo_parent)
|
2012-05-01 00:31:42 -07:00
|
|
|
{
|
|
|
|
const Eina_Inlist *list;
|
2012-10-08 18:58:41 -07:00
|
|
|
const Evas_Object_Protected_Data *o;
|
2012-05-01 00:31:42 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
if (!eo_parent) return EINA_FALSE;
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Object_Protected_Data *parent = efl_data_scope_get(eo_parent, EFL_CANVAS_OBJECT_CLASS);
|
2012-11-24 08:08:45 -08:00
|
|
|
if (!parent) return EINA_FALSE;
|
2012-05-01 00:31:42 -07:00
|
|
|
list = evas_object_smart_members_get_direct(parent->smart.parent);
|
|
|
|
EINA_INLIST_FOREACH(list, o)
|
2013-09-12 23:12:58 -07:00
|
|
|
if (o->map->cur.usemap) break;
|
2012-05-01 00:31:42 -07:00
|
|
|
if (o) return EINA_FALSE; /* Still some child have a map enable */
|
|
|
|
parent->child_has_map = EINA_FALSE;
|
|
|
|
_evas_object_map_parent_check(parent->smart.parent);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2016-07-07 20:26:55 -07:00
|
|
|
#endif
|
2012-05-01 00:31:42 -07:00
|
|
|
|
2017-04-25 23:11:51 -07:00
|
|
|
void
|
|
|
|
_evas_object_map_enable_set(Eo *eo_obj, Evas_Object_Protected_Data *obj,
|
|
|
|
Eina_Bool enabled)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2012-03-20 21:04:03 -07:00
|
|
|
Eina_Bool pchange = EINA_FALSE;
|
2011-06-16 18:16:16 -07:00
|
|
|
|
2010-08-23 23:58:07 -07:00
|
|
|
enabled = !!enabled;
|
2013-01-21 19:56:00 -08:00
|
|
|
if (obj->map->cur.usemap == enabled) return;
|
2012-03-20 21:04:03 -07:00
|
|
|
pchange = obj->changed;
|
2013-01-21 19:56:00 -08:00
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2013-01-21 19:56:00 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write)
|
|
|
|
map_write->cur.usemap = enabled;
|
|
|
|
EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write);
|
|
|
|
|
2009-10-28 01:59:01 -07:00
|
|
|
if (enabled)
|
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
if (!obj->map->cur.map)
|
|
|
|
{
|
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write)
|
2017-04-25 23:11:51 -07:00
|
|
|
map_write->cur.map = _evas_map_new(4, EINA_FALSE);
|
2013-01-21 19:56:00 -08:00
|
|
|
EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write);
|
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_mapped_clip_across_mark(eo_obj, obj);
|
2013-03-12 05:58:19 -07:00
|
|
|
// obj->map->cur.map->normal_geometry = obj->cur->geometry;
|
2009-10-28 01:59:01 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
if (obj->map->surface)
|
2012-09-07 01:02:32 -07:00
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write)
|
|
|
|
{
|
2017-04-24 15:09:25 -07:00
|
|
|
obj->layer->evas->engine.func->image_free(ENC, map_write->surface);
|
2013-01-21 19:56:00 -08:00
|
|
|
map_write->surface = NULL;
|
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write);
|
2012-09-07 01:02:32 -07:00
|
|
|
}
|
2013-01-21 19:56:00 -08:00
|
|
|
if (obj->map->cur.map)
|
2009-10-28 01:59:01 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_map_calc_geom_change(eo_obj);
|
|
|
|
evas_object_mapped_clip_across_mark(eo_obj, obj);
|
2009-10-28 01:59:01 -07:00
|
|
|
}
|
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_map_calc_map_geometry(eo_obj);
|
2010-03-27 22:40:42 -07:00
|
|
|
/* This is a bit heavy handed, but it fixes the case of same geometry, but
|
|
|
|
* changed colour or UV settings. */
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2012-03-20 21:04:03 -07:00
|
|
|
if (!obj->changed_pchange) obj->changed_pchange = pchange;
|
|
|
|
obj->changed_map = EINA_TRUE;
|
2012-05-01 00:31:42 -07:00
|
|
|
|
|
|
|
if (enabled)
|
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object *eo_parents;
|
|
|
|
Evas_Object_Protected_Data *parents = NULL;
|
|
|
|
for (eo_parents = obj->smart.parent; eo_parents; eo_parents = parents->smart.parent)
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
parents = efl_data_scope_get(eo_parents, EFL_CANVAS_OBJECT_CLASS);
|
2014-03-12 18:36:43 -07:00
|
|
|
if (!parents) break;
|
|
|
|
parents->child_has_map = EINA_TRUE;
|
2012-10-08 18:58:41 -07:00
|
|
|
}
|
2016-07-07 17:54:33 -07:00
|
|
|
evas_object_update_bounding_box(eo_obj, obj, NULL);
|
2012-05-01 00:31:42 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-07-07 17:54:33 -07:00
|
|
|
evas_object_update_bounding_box(eo_obj, obj, NULL);
|
2012-05-01 00:31:42 -07:00
|
|
|
}
|
2009-10-28 01:59:01 -07:00
|
|
|
}
|
|
|
|
|
2016-06-27 23:40:41 -07:00
|
|
|
EAPI void
|
2017-04-25 23:11:51 -07:00
|
|
|
evas_object_map_enable_set(Eo *eo_obj, Eina_Bool enabled)
|
2016-06-27 23:40:41 -07:00
|
|
|
{
|
|
|
|
Evas_Object_Protected_Data *obj = EVAS_OBJ_GET_OR_RETURN(eo_obj);
|
|
|
|
|
2017-04-25 23:11:51 -07:00
|
|
|
_evas_object_map_enable_set(eo_obj, obj, enabled);
|
2016-06-27 23:40:41 -07:00
|
|
|
}
|
|
|
|
|
2017-04-25 23:11:51 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_object_map_enable_get(const Eo *eo_obj)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
2017-04-25 23:11:51 -07:00
|
|
|
Evas_Object_Protected_Data *obj = EVAS_OBJ_GET_OR_RETURN(eo_obj, EINA_FALSE);
|
|
|
|
|
2014-03-11 04:51:35 -07:00
|
|
|
return obj->map->cur.usemap;
|
2009-10-28 01:59:01 -07:00
|
|
|
}
|
|
|
|
|
2016-06-27 22:12:17 -07:00
|
|
|
EAPI void
|
|
|
|
evas_object_map_set(Evas_Object *eo_obj, const Evas_Map *map)
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2016-06-27 22:12:17 -07:00
|
|
|
Evas_Object_Protected_Data *obj = EVAS_OBJ_GET_OR_RETURN(eo_obj);
|
|
|
|
|
2017-04-10 03:38:56 -07:00
|
|
|
evas_object_async_block(obj);
|
|
|
|
|
2016-10-14 03:45:42 -07:00
|
|
|
// check if the new map and current map attributes are same
|
|
|
|
if (map && obj->map->cur.map &&
|
|
|
|
(obj->map->cur.map->alpha == map->alpha) &&
|
|
|
|
(obj->map->cur.map->smooth == map->smooth) &&
|
|
|
|
(obj->map->cur.map->move_sync.enabled == map->move_sync.enabled) &&
|
2017-04-10 03:38:56 -07:00
|
|
|
(obj->map->cur.map->move_sync.diff_x == map->move_sync.diff_x) &&
|
|
|
|
(obj->map->cur.map->move_sync.diff_y == map->move_sync.diff_y) &&
|
2016-10-14 03:45:42 -07:00
|
|
|
(obj->map->cur.map->count == map->count))
|
|
|
|
{
|
|
|
|
const Evas_Map_Point *p1, *p2;
|
|
|
|
p1 = obj->map->cur.map->points;
|
|
|
|
p2 = map->points;
|
2017-04-10 03:38:56 -07:00
|
|
|
if (!memcmp(p1, p2, sizeof(Evas_Map_Point) * map->count) &&
|
|
|
|
!memcmp(&map->persp, &obj->map->cur.map->persp, sizeof(map->persp)))
|
2016-10-14 03:45:42 -07:00
|
|
|
return;
|
|
|
|
}
|
2017-05-30 03:25:37 -07:00
|
|
|
/* changed_pchange means map's change.
|
|
|
|
* This flag will be used to decide whether to redraw the map surface.
|
|
|
|
* And value of flag would be EINA_FALSE after rendering. */
|
|
|
|
obj->changed_pchange = EINA_TRUE;
|
2016-10-14 03:45:42 -07:00
|
|
|
|
2012-09-07 01:02:32 -07:00
|
|
|
if ((!map) || (map->count < 4))
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
if (obj->map->surface)
|
2012-09-07 01:02:32 -07:00
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write)
|
|
|
|
{
|
2017-04-24 15:09:25 -07:00
|
|
|
obj->layer->evas->engine.func->image_free(ENC, map_write->surface);
|
2013-01-21 19:56:00 -08:00
|
|
|
map_write->surface = NULL;
|
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write);
|
2012-09-07 01:02:32 -07:00
|
|
|
}
|
2013-01-21 19:56:00 -08:00
|
|
|
if (obj->map->cur.map)
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2012-05-30 03:12:10 -07:00
|
|
|
obj->changed_map = EINA_TRUE;
|
2013-03-12 05:58:19 -07:00
|
|
|
|
|
|
|
EINA_COW_STATE_WRITE_BEGIN(obj, state_write, prev)
|
|
|
|
{
|
|
|
|
state_write->geometry = obj->map->cur.map->normal_geometry;
|
|
|
|
}
|
|
|
|
EINA_COW_STATE_WRITE_END(obj, state_write, prev);
|
2012-07-17 02:09:45 -07:00
|
|
|
|
2013-01-21 19:56:00 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write)
|
2012-07-17 02:09:45 -07:00
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
if (map_write->prev.map == map_write->cur.map)
|
|
|
|
map_write->cur.map = NULL;
|
|
|
|
else if (!map_write->cache_map)
|
|
|
|
{
|
|
|
|
map_write->cache_map = map_write->cur.map;
|
|
|
|
map_write->cur.map = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_evas_map_free(eo_obj, map_write->cur.map);
|
|
|
|
map_write->cur.map = NULL;
|
|
|
|
}
|
2012-07-17 02:09:45 -07:00
|
|
|
}
|
2013-01-21 19:56:00 -08:00
|
|
|
EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write);
|
2012-05-30 01:40:21 -07:00
|
|
|
|
2013-01-21 19:56:00 -08:00
|
|
|
if (!obj->map->prev.map)
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2016-07-07 17:54:33 -07:00
|
|
|
evas_object_update_bounding_box(eo_obj, obj, NULL);
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_mapped_clip_across_mark(eo_obj, obj);
|
2009-10-22 08:47:30 -07:00
|
|
|
return;
|
|
|
|
}
|
2012-05-30 01:40:21 -07:00
|
|
|
|
2013-01-21 19:56:00 -08:00
|
|
|
if (!obj->map->cur.usemap) _evas_map_calc_geom_change(eo_obj);
|
2012-10-08 18:58:41 -07:00
|
|
|
else _evas_map_calc_map_geometry(eo_obj);
|
2013-01-21 19:56:00 -08:00
|
|
|
if (obj->map->cur.usemap)
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_mapped_clip_across_mark(eo_obj, obj);
|
2009-10-22 08:47:30 -07:00
|
|
|
}
|
2016-07-07 17:54:33 -07:00
|
|
|
evas_object_update_bounding_box(eo_obj, obj, NULL);
|
2009-10-22 08:47:30 -07:00
|
|
|
return;
|
|
|
|
}
|
2011-02-06 15:52:17 -08:00
|
|
|
|
2013-01-23 17:43:03 -08:00
|
|
|
if (obj->map->prev.map != NULL &&
|
|
|
|
obj->map->prev.map == obj->map->cur.map)
|
2013-01-21 19:56:00 -08:00
|
|
|
{
|
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write)
|
|
|
|
map_write->cur.map = NULL;
|
|
|
|
EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write);
|
|
|
|
}
|
2012-07-17 02:09:45 -07:00
|
|
|
|
2013-01-23 17:43:03 -08:00
|
|
|
if (!obj->map->cur.map && obj->map->cache_map)
|
2012-07-17 02:09:45 -07:00
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write)
|
|
|
|
{
|
|
|
|
map_write->cur.map = map_write->cache_map;
|
|
|
|
map_write->cache_map = NULL;
|
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write);
|
2012-07-17 02:09:45 -07:00
|
|
|
}
|
|
|
|
|
2012-05-30 03:12:10 -07:00
|
|
|
// We do have the same exact count of point in this map, so just copy it
|
2013-01-21 19:56:00 -08:00
|
|
|
if ((obj->map->cur.map) && (obj->map->cur.map->count == map->count))
|
2013-04-26 15:26:28 -07:00
|
|
|
_evas_map_copy(obj->map->cur.map, map);
|
2011-02-06 15:52:17 -08:00
|
|
|
else
|
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
if (obj->map->cur.map) _evas_map_free(eo_obj, obj->map->cur.map);
|
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write)
|
2013-04-26 15:26:28 -07:00
|
|
|
map_write->cur.map = _evas_map_dup(map);
|
2013-01-21 19:56:00 -08:00
|
|
|
EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write);
|
|
|
|
if (obj->map->cur.usemap)
|
2013-09-12 23:14:26 -07:00
|
|
|
evas_object_mapped_clip_across_mark(eo_obj, obj);
|
2011-02-06 15:52:17 -08:00
|
|
|
}
|
2012-05-30 03:12:10 -07:00
|
|
|
|
2016-07-07 17:54:33 -07:00
|
|
|
evas_object_update_bounding_box(eo_obj, obj, NULL);
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_map_calc_map_geometry(eo_obj);
|
2009-10-22 08:47:30 -07:00
|
|
|
}
|
|
|
|
|
2016-06-27 22:12:17 -07:00
|
|
|
EAPI const Evas_Map *
|
|
|
|
evas_object_map_get(const Evas_Object *eo_obj)
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2016-06-27 22:12:17 -07:00
|
|
|
Evas_Object_Protected_Data *obj = EVAS_OBJ_GET_OR_RETURN((Eo *) eo_obj, NULL);
|
|
|
|
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2014-03-11 04:51:35 -07:00
|
|
|
return obj->map->cur.map;
|
2009-10-22 13:11:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Map *
|
2009-10-28 01:59:01 -07:00
|
|
|
evas_map_new(int count)
|
2009-10-22 13:11:33 -07:00
|
|
|
{
|
2017-06-08 03:22:46 -07:00
|
|
|
if ((count <= 0) || (count % 4 != 0))
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2017-06-07 23:11:21 -07:00
|
|
|
ERR("map point count (%i) should be multiples of 4!", count);
|
2011-05-23 03:37:17 -07:00
|
|
|
return NULL;
|
2009-10-22 08:47:30 -07:00
|
|
|
}
|
2011-06-16 18:16:16 -07:00
|
|
|
|
2016-06-27 23:40:41 -07:00
|
|
|
return _evas_map_new(count, EINA_FALSE);
|
2009-10-22 08:47:30 -07:00
|
|
|
}
|
|
|
|
|
2009-10-31 02:08:01 -07:00
|
|
|
EAPI void
|
|
|
|
evas_map_smooth_set(Evas_Map *m, Eina_Bool enabled)
|
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2009-10-31 02:08:01 -07:00
|
|
|
m->smooth = enabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_map_smooth_get(const Evas_Map *m)
|
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return EINA_FALSE;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2009-10-31 02:08:01 -07:00
|
|
|
return m->smooth;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_map_alpha_set(Evas_Map *m, Eina_Bool enabled)
|
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2009-10-31 02:08:01 -07:00
|
|
|
m->alpha = enabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_map_alpha_get(const Evas_Map *m)
|
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return EINA_FALSE;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2009-10-31 02:08:01 -07:00
|
|
|
return m->alpha;
|
|
|
|
}
|
|
|
|
|
2014-11-27 20:18:16 -08:00
|
|
|
EAPI void
|
|
|
|
evas_map_util_object_move_sync_set(Evas_Map *m, Eina_Bool enabled)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
|
|
|
if (!enabled)
|
|
|
|
{
|
|
|
|
m->move_sync.diff_x = 0;
|
|
|
|
m->move_sync.diff_y = 0;
|
|
|
|
}
|
|
|
|
m->move_sync.enabled = !!enabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_map_util_object_move_sync_get(const Evas_Map *m)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return EINA_FALSE;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
|
|
|
return m->move_sync.enabled;
|
|
|
|
}
|
|
|
|
|
2009-10-22 13:11:33 -07:00
|
|
|
EAPI Evas_Map *
|
|
|
|
evas_map_dup(const Evas_Map *m)
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
2011-06-16 05:18:19 -07:00
|
|
|
return NULL;
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2009-10-22 13:11:33 -07:00
|
|
|
return _evas_map_dup(m);
|
2009-10-22 08:47:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2009-10-22 13:11:33 -07:00
|
|
|
evas_map_free(Evas_Map *m)
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2019-07-19 12:44:08 -07:00
|
|
|
if (!m) return;
|
2010-04-12 01:23:53 -07:00
|
|
|
_evas_map_free(NULL, m);
|
2009-10-22 08:47:30 -07:00
|
|
|
}
|
|
|
|
|
2011-02-06 15:52:17 -08:00
|
|
|
EAPI int
|
|
|
|
evas_map_count_get(const Evas_Map *m)
|
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return -1;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2011-02-06 15:52:17 -08:00
|
|
|
return m->count;
|
|
|
|
}
|
|
|
|
|
2016-06-27 23:40:41 -07:00
|
|
|
/* FIXME: coordinates should be float/double for accuracy.
|
|
|
|
Rotation center position will be flickered by rounding problem.
|
|
|
|
Now fixed in EO APIs.
|
|
|
|
*/
|
2009-10-22 08:47:30 -07:00
|
|
|
EAPI void
|
2016-06-27 23:40:41 -07:00
|
|
|
evas_map_point_coord_set(Evas_Map *m, int idx, Evas_Coord x, Evas_Coord y, Evas_Coord z)
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
2016-06-27 23:40:41 -07:00
|
|
|
return;
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2016-06-27 23:40:41 -07:00
|
|
|
_map_point_coord_set(m, idx, x, y, z);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_map_point_coord_get(const Evas_Map *m, int idx, Evas_Coord *x, Evas_Coord *y, Evas_Coord *z)
|
|
|
|
{
|
|
|
|
double dx, dy, dz;
|
|
|
|
|
|
|
|
_map_point_coord_get(m, idx, &dx, &dy, &dz);
|
|
|
|
if (x) *x = lround(dx);
|
|
|
|
if (y) *y = lround(dy);
|
|
|
|
if (z) *z = lround(dz);
|
|
|
|
}
|
|
|
|
|
2009-10-22 08:47:30 -07:00
|
|
|
EAPI void
|
2009-10-28 01:59:01 -07:00
|
|
|
evas_map_point_image_uv_set(Evas_Map *m, int idx, double u, double v)
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2009-10-22 13:11:33 -07:00
|
|
|
Evas_Map_Point *p;
|
2011-06-16 05:08:46 -07:00
|
|
|
|
2016-06-27 23:40:41 -07:00
|
|
|
if ((idx < 0) || (idx >= m->count)) return;
|
2009-10-22 13:11:33 -07:00
|
|
|
p = m->points + idx;
|
|
|
|
p->u = u;
|
|
|
|
p->v = v;
|
2009-10-22 08:47:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2009-10-28 01:59:01 -07:00
|
|
|
evas_map_point_image_uv_get(const Evas_Map *m, int idx, double *u, double *v)
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
goto error;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2009-10-22 13:11:33 -07:00
|
|
|
const Evas_Map_Point *p;
|
2011-06-16 05:08:46 -07:00
|
|
|
|
2016-06-27 23:40:41 -07:00
|
|
|
if ((idx < 0) || (idx >= m->count)) goto error;
|
2009-10-22 13:11:33 -07:00
|
|
|
p = m->points + idx;
|
|
|
|
if (u) *u = p->u;
|
|
|
|
if (v) *v = p->v;
|
|
|
|
return;
|
|
|
|
|
|
|
|
error:
|
|
|
|
if (u) *u = 0.0;
|
|
|
|
if (v) *v = 0.0;
|
2009-10-22 08:47:30 -07:00
|
|
|
}
|
|
|
|
|
2009-10-31 18:32:23 -07:00
|
|
|
EAPI void
|
|
|
|
evas_map_point_color_set(Evas_Map *m, int idx, int r, int g, int b, int a)
|
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2009-10-31 18:32:23 -07:00
|
|
|
Evas_Map_Point *p;
|
2011-06-16 05:08:46 -07:00
|
|
|
|
2016-06-27 23:40:41 -07:00
|
|
|
if ((idx < 0) || (idx >= m->count)) return;
|
2009-10-31 18:32:23 -07:00
|
|
|
p = m->points + idx;
|
|
|
|
p->r = r;
|
|
|
|
p->g = g;
|
|
|
|
p->b = b;
|
|
|
|
p->a = a;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_map_point_color_get(const Evas_Map *m, int idx, int *r, int *g, int *b, int *a)
|
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2009-11-02 00:52:23 -08:00
|
|
|
const Evas_Map_Point *p;
|
2011-06-16 05:08:46 -07:00
|
|
|
|
2016-06-27 23:40:41 -07:00
|
|
|
if ((idx < 0) || (idx >= m->count)) goto error;
|
2009-10-31 18:32:23 -07:00
|
|
|
p = m->points + idx;
|
|
|
|
if (r) *r = p->r;
|
|
|
|
if (g) *g = p->g;
|
|
|
|
if (b) *b = p->b;
|
|
|
|
if (a) *a = p->a;
|
2018-04-24 00:25:24 -07:00
|
|
|
return;
|
2016-06-27 23:40:41 -07:00
|
|
|
|
|
|
|
error:
|
|
|
|
if (r) *r = 255;
|
|
|
|
if (g) *g = 255;
|
|
|
|
if (b) *b = 255;
|
|
|
|
if (a) *a = 255;
|
2009-10-31 18:32:23 -07:00
|
|
|
}
|
|
|
|
|
2009-11-11 04:33:52 -08:00
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_map_util_points_populate_from_object_full(Evas_Map *m, const Evas_Object *eo_obj, Evas_Coord z)
|
2009-11-11 04:33:52 -08:00
|
|
|
{
|
2014-06-22 02:08:56 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2009-11-11 04:33:52 -08:00
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
2011-06-16 05:08:46 -07:00
|
|
|
|
2012-11-24 08:08:45 -08:00
|
|
|
if (!obj) return;
|
2009-11-11 04:33:52 -08:00
|
|
|
if (m->count != 4)
|
|
|
|
{
|
2011-05-23 03:37:17 -07:00
|
|
|
ERR("map has count=%d where 4 was expected.", m->count);
|
|
|
|
return;
|
2009-11-11 04:33:52 -08:00
|
|
|
}
|
2013-03-12 05:58:19 -07:00
|
|
|
_evas_map_util_points_populate(m, obj->cur->geometry.x, obj->cur->geometry.y,
|
|
|
|
obj->cur->geometry.w, obj->cur->geometry.h, z);
|
2009-11-11 04:33:52 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_map_util_points_populate_from_object(Evas_Map *m, const Evas_Object *eo_obj)
|
2009-11-11 04:33:52 -08:00
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
|
2009-11-11 04:33:52 -08:00
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
2014-06-22 02:08:56 -07:00
|
|
|
|
2012-11-24 08:08:45 -08:00
|
|
|
if (!obj) return;
|
2009-11-11 04:33:52 -08:00
|
|
|
if (m->count != 4)
|
|
|
|
{
|
2011-05-23 03:37:17 -07:00
|
|
|
ERR("map has count=%d where 4 was expected.", m->count);
|
|
|
|
return;
|
2009-11-11 04:33:52 -08:00
|
|
|
}
|
2013-04-26 15:26:28 -07:00
|
|
|
_evas_map_util_points_populate(m, obj->cur->geometry.x, obj->cur->geometry.y,
|
|
|
|
obj->cur->geometry.w, obj->cur->geometry.h, 0);
|
2009-11-11 04:33:52 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_map_util_points_populate_from_geometry(Evas_Map *m, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, Evas_Coord z)
|
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2009-11-11 04:33:52 -08:00
|
|
|
if (m->count != 4)
|
|
|
|
{
|
2011-05-23 03:37:17 -07:00
|
|
|
ERR("map has count=%d where 4 was expected.", m->count);
|
|
|
|
return;
|
2009-11-11 04:33:52 -08:00
|
|
|
}
|
|
|
|
_evas_map_util_points_populate(m, x, y, w, h, z);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
evas_map_util_points_color_set(Evas_Map *m, int r, int g, int b, int a)
|
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2009-11-11 04:33:52 -08:00
|
|
|
Evas_Map_Point *p, *p_end;
|
2011-06-16 05:08:46 -07:00
|
|
|
|
2009-11-11 04:33:52 -08:00
|
|
|
p = m->points;
|
|
|
|
p_end = p + m->count;
|
|
|
|
for (; p < p_end; p++)
|
|
|
|
{
|
2011-05-23 03:37:17 -07:00
|
|
|
p->r = r;
|
|
|
|
p->g = g;
|
|
|
|
p->b = b;
|
|
|
|
p->a = a;
|
2009-11-11 04:33:52 -08:00
|
|
|
}
|
|
|
|
}
|
2009-10-28 01:59:01 -07:00
|
|
|
|
2017-04-25 22:04:21 -07:00
|
|
|
void
|
2016-06-27 23:40:41 -07:00
|
|
|
_map_util_rotate(Evas_Map *m, double degrees, double cx, double cy)
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
|
|
|
double r = (degrees * M_PI) / 180.0;
|
2009-10-22 13:11:33 -07:00
|
|
|
Evas_Map_Point *p, *p_end;
|
|
|
|
|
|
|
|
p = m->points;
|
2009-11-02 00:52:23 -08:00
|
|
|
p_end = p + m->count;
|
2009-10-22 13:11:33 -07:00
|
|
|
|
|
|
|
for (; p < p_end; p++)
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2011-01-15 23:49:49 -08:00
|
|
|
double x, y, xx, yy;
|
2009-10-22 13:11:33 -07:00
|
|
|
|
2011-01-15 22:58:38 -08:00
|
|
|
x = p->x - cx;
|
|
|
|
y = p->y - cy;
|
2009-10-22 13:11:33 -07:00
|
|
|
|
2011-06-16 01:46:16 -07:00
|
|
|
xx = x * cos(r);
|
|
|
|
yy = x * sin(r);
|
2011-06-16 03:03:37 -07:00
|
|
|
x = xx - (y * sin(r));
|
|
|
|
y = yy + (y * cos(r));
|
2009-10-22 13:11:33 -07:00
|
|
|
|
2011-01-15 23:49:49 -08:00
|
|
|
p->px = p->x = x + cx;
|
|
|
|
p->py = p->y = y + cy;
|
2009-10-22 08:47:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2016-06-27 23:40:41 -07:00
|
|
|
evas_map_util_rotate(Evas_Map *m, double degrees, Evas_Coord cx, Evas_Coord cy)
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2016-06-27 23:40:41 -07:00
|
|
|
_map_util_rotate(m, degrees, (double) cx, (double) cy);
|
|
|
|
}
|
|
|
|
|
2017-04-25 22:04:21 -07:00
|
|
|
void
|
2016-06-27 23:40:41 -07:00
|
|
|
_map_util_zoom(Evas_Map *m, double zoomx, double zoomy, double cx, double cy)
|
|
|
|
{
|
2009-10-22 13:11:33 -07:00
|
|
|
Evas_Map_Point *p, *p_end;
|
|
|
|
|
|
|
|
p = m->points;
|
2009-11-02 00:52:23 -08:00
|
|
|
p_end = p + m->count;
|
2009-10-22 13:11:33 -07:00
|
|
|
|
|
|
|
for (; p < p_end; p++)
|
2009-10-22 08:47:30 -07:00
|
|
|
{
|
2011-01-15 23:49:49 -08:00
|
|
|
double x, y;
|
2009-10-22 13:11:33 -07:00
|
|
|
|
|
|
|
x = p->x - cx;
|
|
|
|
y = p->y - cy;
|
|
|
|
|
2016-06-27 23:40:41 -07:00
|
|
|
x *= zoomx;
|
|
|
|
y *= zoomy;
|
2009-10-22 13:11:33 -07:00
|
|
|
|
2011-01-15 23:49:49 -08:00
|
|
|
p->px = p->x = x + cx;
|
|
|
|
p->py = p->y = y + cy;
|
2009-10-22 08:47:30 -07:00
|
|
|
}
|
|
|
|
}
|
2009-11-02 00:52:23 -08:00
|
|
|
|
|
|
|
EAPI void
|
2016-06-27 23:40:41 -07:00
|
|
|
evas_map_util_zoom(Evas_Map *m, double zoomx, double zoomy, Evas_Coord cx, Evas_Coord cy)
|
2009-11-02 00:52:23 -08:00
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2016-06-27 23:40:41 -07:00
|
|
|
_map_util_zoom(m, zoomx, zoomy, (double) cx, (double) cy);
|
|
|
|
}
|
|
|
|
|
2017-04-25 23:11:51 -07:00
|
|
|
void
|
|
|
|
_map_util_translate(Evas_Map *m, double dx, double dy, double dz)
|
|
|
|
{
|
|
|
|
Evas_Map_Point *p, *p_end;
|
|
|
|
|
|
|
|
p = m->points;
|
|
|
|
p_end = p + m->count;
|
|
|
|
|
|
|
|
for (; p < p_end; p++)
|
|
|
|
{
|
|
|
|
p->px = (p->x += dx);
|
|
|
|
p->py = (p->y += dy);
|
|
|
|
p->z += dz;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-25 22:04:21 -07:00
|
|
|
void
|
2016-06-27 23:40:41 -07:00
|
|
|
_map_util_3d_rotate(Evas_Map *m, double dx, double dy, double dz,
|
|
|
|
double cx, double cy, double cz)
|
|
|
|
{
|
2009-11-02 00:52:23 -08:00
|
|
|
double rz = (dz * M_PI) / 180.0;
|
|
|
|
double rx = (dx * M_PI) / 180.0;
|
|
|
|
double ry = (dy * M_PI) / 180.0;
|
|
|
|
Evas_Map_Point *p, *p_end;
|
|
|
|
|
|
|
|
p = m->points;
|
|
|
|
p_end = p + m->count;
|
|
|
|
|
|
|
|
for (; p < p_end; p++)
|
|
|
|
{
|
|
|
|
double x, y, z, xx, yy, zz;
|
|
|
|
|
|
|
|
x = p->x - cx;
|
|
|
|
y = p->y - cy;
|
|
|
|
z = p->z - cz;
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2017-01-06 09:57:46 -08:00
|
|
|
if (!EINA_DBL_EQ(rz, 0.0))
|
2009-11-02 00:52:23 -08:00
|
|
|
{
|
|
|
|
xx = x * cos(rz);
|
|
|
|
yy = x * sin(rz);
|
2011-06-16 03:03:37 -07:00
|
|
|
x = xx - (y * sin(rz));
|
|
|
|
y = yy + (y * cos(rz));
|
2009-11-02 00:52:23 -08:00
|
|
|
}
|
|
|
|
|
2017-01-06 09:57:46 -08:00
|
|
|
if (!EINA_DBL_EQ(ry, 0.0))
|
2009-11-02 00:52:23 -08:00
|
|
|
{
|
|
|
|
xx = x * cos(ry);
|
|
|
|
zz = x * sin(ry);
|
2011-06-16 03:03:37 -07:00
|
|
|
x = xx - (z * sin(ry));
|
|
|
|
z = zz + (z * cos(ry));
|
2009-11-02 00:52:23 -08:00
|
|
|
}
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2017-01-06 09:57:46 -08:00
|
|
|
if (!EINA_DBL_EQ(rx, 0.0))
|
2009-11-02 00:52:23 -08:00
|
|
|
{
|
|
|
|
zz = z * cos(rx);
|
|
|
|
yy = z * sin(rx);
|
2011-06-16 03:03:37 -07:00
|
|
|
z = zz - (y * sin(rx));
|
|
|
|
y = yy + (y * cos(rx));
|
2009-11-02 00:52:23 -08:00
|
|
|
}
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2011-01-15 23:49:49 -08:00
|
|
|
p->px = p->x = x + cx;
|
|
|
|
p->py = p->y = y + cy;
|
2009-11-02 04:20:50 -08:00
|
|
|
p->z = z + cz;
|
|
|
|
}
|
|
|
|
}
|
2009-11-02 00:52:23 -08:00
|
|
|
|
2016-06-27 23:40:41 -07:00
|
|
|
EAPI void
|
|
|
|
evas_map_util_3d_rotate(Evas_Map *m, double dx, double dy, double dz,
|
|
|
|
Evas_Coord cx, Evas_Coord cy, Evas_Coord cz)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
|
|
|
_map_util_3d_rotate(m, dx, dy, dz, (double) cx, (double) cy, (double) cz);
|
|
|
|
}
|
|
|
|
|
2017-04-25 23:11:51 -07:00
|
|
|
void
|
|
|
|
_map_util_quat_rotate(Evas_Map *m, double qx, double qy, double qz,
|
|
|
|
double qw, double cx, double cy, double cz)
|
2012-08-31 00:05:48 -07:00
|
|
|
{
|
2015-05-29 08:18:23 -07:00
|
|
|
Eina_Quaternion q;
|
|
|
|
Eina_Point_3D c;
|
|
|
|
|
2012-08-31 00:05:48 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
|
|
|
Evas_Map_Point *p, *p_end;
|
|
|
|
|
|
|
|
p = m->points;
|
|
|
|
p_end = p + m->count;
|
|
|
|
|
2015-05-29 08:18:23 -07:00
|
|
|
q.x = qx;
|
|
|
|
q.y = qy;
|
|
|
|
q.z = qz;
|
|
|
|
q.w = qw;
|
2012-08-31 00:05:48 -07:00
|
|
|
|
2015-05-29 08:18:23 -07:00
|
|
|
c.x = cx;
|
|
|
|
c.y = cy;
|
|
|
|
c.z = cz;
|
2012-08-31 00:05:48 -07:00
|
|
|
|
2015-05-29 08:18:23 -07:00
|
|
|
for (; p < p_end; p++)
|
|
|
|
{
|
|
|
|
Eina_Point_3D current;
|
2012-08-31 00:05:48 -07:00
|
|
|
|
2015-05-29 08:18:23 -07:00
|
|
|
current.x = p->x;
|
|
|
|
current.y = p->y;
|
|
|
|
current.z = p->z;
|
2012-08-31 00:05:48 -07:00
|
|
|
|
2015-05-29 08:18:23 -07:00
|
|
|
eina_quaternion_rotate(¤t, &c, &q);
|
2012-08-31 00:05:48 -07:00
|
|
|
|
2015-05-29 08:18:23 -07:00
|
|
|
p->px = p->x = current.x;
|
|
|
|
p->py = p->y = current.y;
|
|
|
|
p->z = current.z;
|
2012-08-31 00:05:48 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-25 23:11:51 -07:00
|
|
|
EAPI void
|
|
|
|
evas_map_util_quat_rotate(Evas_Map *m, double qx, double qy, double qz,
|
|
|
|
double qw, double cx, double cy, double cz)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
|
|
|
_map_util_quat_rotate(m, qx, qy, qz, qw, cx, cy, cz);
|
|
|
|
}
|
|
|
|
|
2017-04-25 22:04:21 -07:00
|
|
|
void
|
2016-06-27 23:40:41 -07:00
|
|
|
_map_util_3d_lighting(Evas_Map *m,
|
|
|
|
double lx, double ly, double lz,
|
|
|
|
int lr, int lg, int lb, int ar, int ag, int ab)
|
2009-11-02 04:20:50 -08:00
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
int i;
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2009-11-02 04:20:50 -08:00
|
|
|
for (i = 0; i < m->count; i++)
|
|
|
|
{
|
|
|
|
double x, y, z;
|
2012-01-19 08:49:47 -08:00
|
|
|
double nx, ny, nz, x1, yy1, z1, x2, yy2, z2, ln, br;
|
2009-11-02 04:20:50 -08:00
|
|
|
int h, j, mr, mg, mb;
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2009-11-02 04:20:50 -08:00
|
|
|
x = m->points[i].x;
|
|
|
|
y = m->points[i].y;
|
|
|
|
z = m->points[i].z;
|
|
|
|
// calc normal
|
2011-02-06 15:52:17 -08:00
|
|
|
h = (i - 1 + 4) % 4 + (i & ~0x3); // prev point
|
|
|
|
j = (i + 1) % 4 + (i & ~0x3); // next point
|
2009-11-02 04:20:50 -08:00
|
|
|
|
|
|
|
x1 = m->points[h].x - x;
|
2012-01-19 08:49:47 -08:00
|
|
|
yy1 = m->points[h].y - y;
|
2009-11-02 04:20:50 -08:00
|
|
|
z1 = m->points[h].z - z;
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2009-11-02 04:20:50 -08:00
|
|
|
x2 = m->points[j].x - x;
|
2012-01-19 08:49:47 -08:00
|
|
|
yy2 = m->points[j].y - y;
|
2009-11-02 04:20:50 -08:00
|
|
|
z2 = m->points[j].z - z;
|
2012-01-19 08:49:47 -08:00
|
|
|
nx = (yy1 * z2) - (z1 * yy2);
|
2009-11-02 04:20:50 -08:00
|
|
|
ny = (z1 * x2) - (x1 * z2);
|
2012-01-19 08:49:47 -08:00
|
|
|
nz = (x1 * yy2) - (yy1 * x2);
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2009-11-02 04:20:50 -08:00
|
|
|
ln = (nx * nx) + (ny * ny) + (nz * nz);
|
|
|
|
ln = sqrt(ln);
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2017-01-06 09:57:46 -08:00
|
|
|
if (!EINA_DBL_EQ(ln, 0.0))
|
2009-11-02 00:52:23 -08:00
|
|
|
{
|
2009-11-02 04:20:50 -08:00
|
|
|
nx /= ln;
|
|
|
|
ny /= ln;
|
|
|
|
nz /= ln;
|
|
|
|
}
|
2011-02-06 15:52:17 -08:00
|
|
|
|
2009-11-02 04:20:50 -08:00
|
|
|
// calc point -> light vector
|
|
|
|
x = lx - x;
|
|
|
|
y = ly - y;
|
|
|
|
z = lz - z;
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2009-11-02 04:20:50 -08:00
|
|
|
ln = (x * x) + (y * y) + (z * z);
|
|
|
|
ln = sqrt(ln);
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2017-01-06 09:57:46 -08:00
|
|
|
if (!EINA_DBL_EQ(ln, 0.0))
|
2009-11-02 04:20:50 -08:00
|
|
|
{
|
|
|
|
x /= ln;
|
|
|
|
y /= ln;
|
|
|
|
z /= ln;
|
2009-11-02 00:52:23 -08:00
|
|
|
}
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2009-11-02 04:20:50 -08:00
|
|
|
// brightness - tan (0.0 -> 1.0 brightness really)
|
|
|
|
br = (nx * x) + (ny * y) + (nz * z);
|
|
|
|
if (br < 0.0) br = 0.0;
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2009-11-02 04:20:50 -08:00
|
|
|
mr = ar + ((lr - ar) * br);
|
|
|
|
mg = ag + ((lg - ag) * br);
|
|
|
|
mb = ab + ((lb - ab) * br);
|
2011-05-23 03:37:17 -07:00
|
|
|
if (m->points[i].a != 255)
|
2011-04-12 02:23:52 -07:00
|
|
|
{
|
|
|
|
mr = (mr * m->points[i].a) / 255;
|
|
|
|
mg = (mg * m->points[i].a) / 255;
|
|
|
|
mb = (mb * m->points[i].a) / 255;
|
|
|
|
}
|
2009-11-02 04:20:50 -08:00
|
|
|
m->points[i].r = (m->points[i].r * mr) / 255;
|
|
|
|
m->points[i].g = (m->points[i].g * mg) / 255;
|
|
|
|
m->points[i].b = (m->points[i].b * mb) / 255;
|
2009-11-02 00:52:23 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2016-06-27 23:40:41 -07:00
|
|
|
evas_map_util_3d_lighting(Evas_Map *m,
|
|
|
|
Evas_Coord lx, Evas_Coord ly, Evas_Coord lz,
|
|
|
|
int lr, int lg, int lb, int ar, int ag, int ab)
|
2009-11-02 00:52:23 -08:00
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
2016-06-27 23:40:41 -07:00
|
|
|
_map_util_3d_lighting(m, (double) lx, (double) ly, (double)
|
|
|
|
lz, lr, lg, lb, ar, ag, ab);
|
|
|
|
}
|
|
|
|
|
2017-04-25 22:04:21 -07:00
|
|
|
void
|
2016-06-27 23:40:41 -07:00
|
|
|
_map_util_3d_perspective(Evas_Map *m, double px, double py, double z0, double foc)
|
|
|
|
{
|
2009-11-02 00:52:23 -08:00
|
|
|
Evas_Map_Point *p, *p_end;
|
|
|
|
|
|
|
|
p = m->points;
|
|
|
|
p_end = p + m->count;
|
|
|
|
|
2010-09-21 23:52:28 -07:00
|
|
|
m->persp.px = px;
|
|
|
|
m->persp.py = py;
|
|
|
|
m->persp.z0 = z0;
|
|
|
|
m->persp.foc = foc;
|
2011-06-17 00:12:20 -07:00
|
|
|
|
|
|
|
if (foc <= 0) return;
|
|
|
|
|
2009-11-02 00:52:23 -08:00
|
|
|
for (; p < p_end; p++)
|
|
|
|
{
|
2011-01-15 23:49:49 -08:00
|
|
|
double x, y, zz;
|
2009-11-02 00:52:23 -08:00
|
|
|
|
2011-06-17 00:12:20 -07:00
|
|
|
x = p->x - px;
|
|
|
|
y = p->y - py;
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2011-06-17 00:12:20 -07:00
|
|
|
zz = ((p->z - z0) + foc);
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2011-06-17 00:12:20 -07:00
|
|
|
if (zz > 0)
|
|
|
|
{
|
|
|
|
x = (x * foc) / zz;
|
|
|
|
y = (y * foc) / zz;
|
2009-11-02 00:52:23 -08:00
|
|
|
}
|
2011-06-17 00:12:20 -07:00
|
|
|
|
|
|
|
p->x = px + x;
|
|
|
|
p->y = py + y;
|
2009-11-02 00:52:23 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-27 23:40:41 -07:00
|
|
|
EAPI void
|
|
|
|
evas_map_util_3d_perspective(Evas_Map *m,
|
|
|
|
Evas_Coord px, Evas_Coord py,
|
|
|
|
Evas_Coord z0, Evas_Coord foc)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
|
|
|
_map_util_3d_perspective(m, (double) px, (double) py, (double) z0, (double) foc);
|
|
|
|
}
|
|
|
|
|
2009-11-02 00:52:23 -08:00
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_map_util_clockwise_get(Evas_Map *m)
|
|
|
|
{
|
2011-06-16 05:08:46 -07:00
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return EINA_FALSE;
|
|
|
|
MAGIC_CHECK_END();
|
2011-06-17 00:12:20 -07:00
|
|
|
|
2009-11-02 00:52:23 -08:00
|
|
|
int i, j, k, count;
|
|
|
|
long long c;
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2011-06-16 05:18:19 -07:00
|
|
|
if (m->count < 3) return EINA_FALSE;
|
2011-05-23 03:37:17 -07:00
|
|
|
|
2009-11-02 00:52:23 -08:00
|
|
|
count = 0;
|
|
|
|
for (i = 0; i < m->count; i++)
|
|
|
|
{
|
2011-05-23 03:37:17 -07:00
|
|
|
j = (i + 1) % m->count;
|
2009-11-02 00:52:23 -08:00
|
|
|
k = (i + 2) % m->count;
|
2011-05-23 03:37:17 -07:00
|
|
|
c =
|
2009-11-02 00:52:23 -08:00
|
|
|
((m->points[j].x - m->points[i].x) *
|
|
|
|
(m->points[k].y - m->points[j].y))
|
|
|
|
-
|
|
|
|
((m->points[j].y - m->points[i].y) *
|
|
|
|
(m->points[k].x - m->points[j].x));
|
|
|
|
if (c < 0) count--;
|
|
|
|
else if (c > 0) count++;
|
|
|
|
}
|
2011-06-16 05:18:19 -07:00
|
|
|
if (count > 0) return EINA_TRUE;
|
|
|
|
return EINA_FALSE;
|
2009-11-02 00:52:23 -08:00
|
|
|
}
|
2012-06-14 02:58:16 -07:00
|
|
|
|
2014-01-05 20:54:58 -08:00
|
|
|
/****************************************************************************/
|
|
|
|
/* If the return value is true, the map surface should be redrawn. */
|
|
|
|
/****************************************************************************/
|
|
|
|
Eina_Bool
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_map_update(Evas_Object *eo_obj,
|
2012-06-14 02:58:16 -07:00
|
|
|
int x, int y,
|
|
|
|
int imagew, int imageh,
|
|
|
|
int uvw, int uvh)
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
2012-06-14 02:58:16 -07:00
|
|
|
const Evas_Map_Point *p, *p_end;
|
|
|
|
RGBA_Map_Point *pts, *pt;
|
|
|
|
|
2014-01-05 20:54:58 -08:00
|
|
|
if (!obj) return EINA_FALSE;
|
2013-01-21 19:56:00 -08:00
|
|
|
if (obj->map->spans)
|
2012-06-14 02:58:16 -07:00
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
if (obj->map->spans->x != x || obj->map->spans->y != y ||
|
|
|
|
obj->map->spans->image.w != imagew || obj->map->spans->image.h != imageh ||
|
|
|
|
obj->map->spans->uv.w != uvw || obj->map->spans->uv.h != uvh)
|
2012-06-14 02:58:16 -07:00
|
|
|
obj->changed_map = EINA_TRUE;
|
|
|
|
}
|
2012-07-06 07:56:42 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
obj->changed_map = EINA_TRUE;
|
|
|
|
}
|
2012-06-14 02:58:16 -07:00
|
|
|
|
2014-11-27 20:18:16 -08:00
|
|
|
evas_object_map_move_sync(eo_obj);
|
|
|
|
|
2014-01-05 20:54:58 -08:00
|
|
|
if (!obj->changed_map) return EINA_FALSE;
|
2013-12-18 21:33:02 -08:00
|
|
|
|
2014-11-27 20:24:24 -08:00
|
|
|
if (obj->map->spans && obj->map->cur.map->count != obj->map->spans->count)
|
2012-06-14 02:58:16 -07:00
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write)
|
2012-06-14 02:58:16 -07:00
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
if (map_write->spans)
|
|
|
|
{
|
|
|
|
// Destroy engine side spans
|
|
|
|
free(map_write->spans);
|
|
|
|
}
|
|
|
|
map_write->spans = NULL;
|
2012-06-14 02:58:16 -07:00
|
|
|
}
|
2013-01-21 19:56:00 -08:00
|
|
|
EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write);
|
2012-06-14 02:58:16 -07:00
|
|
|
}
|
|
|
|
|
2013-01-21 19:56:00 -08:00
|
|
|
if (!obj->map->spans)
|
|
|
|
{
|
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write)
|
|
|
|
map_write->spans = calloc(1, sizeof (RGBA_Map) +
|
|
|
|
sizeof (RGBA_Map_Point) * (map_write->cur.map->count - 1));
|
|
|
|
EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write);
|
|
|
|
}
|
2012-06-14 02:58:16 -07:00
|
|
|
|
2014-01-05 20:54:58 -08:00
|
|
|
if (!obj->map->spans) return EINA_FALSE;
|
2012-06-14 02:58:16 -07:00
|
|
|
|
2013-01-21 19:56:00 -08:00
|
|
|
EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write)
|
|
|
|
{
|
|
|
|
map_write->spans->count = obj->map->cur.map->count;
|
|
|
|
map_write->spans->x = x;
|
|
|
|
map_write->spans->y = y;
|
|
|
|
map_write->spans->uv.w = uvw;
|
|
|
|
map_write->spans->uv.h = uvh;
|
|
|
|
map_write->spans->image.w = imagew;
|
|
|
|
map_write->spans->image.h = imageh;
|
|
|
|
|
|
|
|
pts = obj->map->spans->pts;
|
|
|
|
|
|
|
|
p = obj->map->cur.map->points;
|
|
|
|
p_end = p + obj->map->cur.map->count;
|
|
|
|
pt = pts;
|
|
|
|
}
|
|
|
|
EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write);
|
2013-01-14 21:11:11 -08:00
|
|
|
|
2013-01-21 19:56:00 -08:00
|
|
|
pts[0].px = obj->map->cur.map->persp.px << FP;
|
|
|
|
pts[0].py = obj->map->cur.map->persp.py << FP;
|
|
|
|
pts[0].foc = obj->map->cur.map->persp.foc << FP;
|
|
|
|
pts[0].z0 = obj->map->cur.map->persp.z0 << FP;
|
2012-06-14 02:58:16 -07:00
|
|
|
// draw geom +x +y
|
|
|
|
for (; p < p_end; p++, pt++)
|
|
|
|
{
|
|
|
|
pt->x = (lround(p->x) + x) * FP1;
|
|
|
|
pt->y = (lround(p->y) + y) * FP1;
|
|
|
|
pt->z = (lround(p->z) ) * FP1;
|
2019-04-18 03:21:18 -07:00
|
|
|
pt->fx = p->x + (float) x;
|
|
|
|
pt->fy = p->y + (float) y;
|
2012-06-14 02:58:16 -07:00
|
|
|
pt->fz = p->z;
|
2013-04-13 02:58:08 -07:00
|
|
|
if ((uvw == 0) || (imagew == 0)) pt->u = 0;
|
2013-01-14 21:11:11 -08:00
|
|
|
else pt->u = ((lround(p->u) * imagew) / uvw) * FP1;
|
2013-04-13 02:58:08 -07:00
|
|
|
if ((uvh == 0) || (imageh == 0)) pt->v = 0;
|
2013-01-14 21:11:11 -08:00
|
|
|
else pt->v = ((lround(p->v) * imageh) / uvh) * FP1;
|
2012-06-14 02:58:16 -07:00
|
|
|
if (pt->u < 0) pt->u = 0;
|
|
|
|
else if (pt->u > (imagew * FP1)) pt->u = (imagew * FP1);
|
|
|
|
if (pt->v < 0) pt->v = 0;
|
|
|
|
else if (pt->v > (imageh * FP1)) pt->v = (imageh * FP1);
|
|
|
|
pt->col = ARGB_JOIN(p->a, p->r, p->g, p->b);
|
|
|
|
}
|
2013-01-21 19:56:00 -08:00
|
|
|
if (obj->map->cur.map->count & 0x1)
|
2012-06-14 02:58:16 -07:00
|
|
|
{
|
2013-01-21 19:56:00 -08:00
|
|
|
pts[obj->map->cur.map->count] = pts[obj->map->cur.map->count -1];
|
2012-06-14 02:58:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// Request engine to update it's point
|
2013-12-18 22:34:15 -08:00
|
|
|
|
|
|
|
obj->changed_map = EINA_FALSE;
|
2014-01-05 20:54:58 -08:00
|
|
|
|
|
|
|
return obj->changed_pchange;
|
2012-06-14 02:58:16 -07:00
|
|
|
}
|
2014-03-11 04:51:35 -07:00
|
|
|
|
2014-11-27 20:18:16 -08:00
|
|
|
void
|
|
|
|
evas_map_object_move_diff_set(Evas_Map *m,
|
|
|
|
Evas_Coord diff_x,
|
|
|
|
Evas_Coord diff_y)
|
|
|
|
{
|
|
|
|
MAGIC_CHECK(m, Evas_Map, MAGIC_MAP);
|
|
|
|
return;
|
|
|
|
MAGIC_CHECK_END();
|
|
|
|
|
|
|
|
m->move_sync.diff_x += diff_x;
|
|
|
|
m->move_sync.diff_y += diff_y;
|
|
|
|
}
|