aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/canvas/evas_map.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/evas/src/lib/canvas/evas_map.c')
-rw-r--r--libraries/evas/src/lib/canvas/evas_map.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/libraries/evas/src/lib/canvas/evas_map.c b/libraries/evas/src/lib/canvas/evas_map.c
index 2359d5a..5dcb760 100644
--- a/libraries/evas/src/lib/canvas/evas_map.c
+++ b/libraries/evas/src/lib/canvas/evas_map.c
@@ -35,7 +35,7 @@ _evas_map_calc_geom_change(Evas_Object *obj)
35static void 35static void
36_evas_map_calc_map_geometry(Evas_Object *obj) 36_evas_map_calc_map_geometry(Evas_Object *obj)
37{ 37{
38 Evas_Coord x1, x2, y1, y2; 38 Evas_Coord x1, x2, yy1, yy2;
39 const Evas_Map_Point *p, *p_end; 39 const Evas_Map_Point *p, *p_end;
40 Eina_Bool ch = EINA_FALSE; 40 Eina_Bool ch = EINA_FALSE;
41 41
@@ -82,7 +82,7 @@ _evas_map_calc_map_geometry(Evas_Object *obj)
82 p = obj->cur.map->points; 82 p = obj->cur.map->points;
83 p_end = p + obj->cur.map->count; 83 p_end = p + obj->cur.map->count;
84 x1 = x2 = lround(p->x); 84 x1 = x2 = lround(p->x);
85 y1 = y2 = lround(p->y); 85 yy1 = yy2 = lround(p->y);
86 p++; 86 p++;
87 for (; p < p_end; p++) 87 for (; p < p_end; p++)
88 { 88 {
@@ -92,21 +92,21 @@ _evas_map_calc_map_geometry(Evas_Object *obj)
92 y = lround(p->y); 92 y = lround(p->y);
93 if (x < x1) x1 = x; 93 if (x < x1) x1 = x;
94 if (x > x2) x2 = x; 94 if (x > x2) x2 = x;
95 if (y < y1) y1 = y; 95 if (y < yy1) yy1 = y;
96 if (y > y2) y2 = y; 96 if (y > yy2) yy2 = y;
97 } 97 }
98// this causes clip-out bugs now mapped objs canbe opaque!!! 98// this causes clip-out bugs now mapped objs canbe opaque!!!
99// // add 1 pixel of fuzz around the map region to ensure updates are correct 99// // add 1 pixel of fuzz around the map region to ensure updates are correct
100// x1 -= 1; y1 -= 1; 100// x1 -= 1; yy1 -= 1;
101// x2 += 1; y2 += 1; 101// x2 += 1; yy2 += 1;
102 if (obj->cur.map->normal_geometry.x != x1) ch = 1; 102 if (obj->cur.map->normal_geometry.x != x1) ch = 1;
103 if (obj->cur.map->normal_geometry.y != y1) ch = 1; 103 if (obj->cur.map->normal_geometry.y != yy1) ch = 1;
104 if (obj->cur.map->normal_geometry.w != (x2 - x1)) ch = 1; 104 if (obj->cur.map->normal_geometry.w != (x2 - x1)) ch = 1;
105 if (obj->cur.map->normal_geometry.h != (y2 - y1)) ch = 1; 105 if (obj->cur.map->normal_geometry.h != (yy2 - yy1)) ch = 1;
106 obj->cur.map->normal_geometry.x = x1; 106 obj->cur.map->normal_geometry.x = x1;
107 obj->cur.map->normal_geometry.y = y1; 107 obj->cur.map->normal_geometry.y = yy1;
108 obj->cur.map->normal_geometry.w = (x2 - x1); 108 obj->cur.map->normal_geometry.w = (x2 - x1);
109 obj->cur.map->normal_geometry.h = (y2 - y1); 109 obj->cur.map->normal_geometry.h = (yy2 - yy1);
110 if (ch) _evas_map_calc_geom_change(obj); 110 if (ch) _evas_map_calc_geom_change(obj);
111} 111}
112 112
@@ -374,9 +374,11 @@ evas_object_map_enable_set(Evas_Object *obj, Eina_Bool enabled)
374 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); 374 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
375 return; 375 return;
376 MAGIC_CHECK_END(); 376 MAGIC_CHECK_END();
377 Eina_Bool pchange = EINA_FALSE;
377 378
378 enabled = !!enabled; 379 enabled = !!enabled;
379 if (obj->cur.usemap == enabled) return; 380 if (obj->cur.usemap == enabled) return;
381 pchange = obj->changed;
380 obj->cur.usemap = enabled; 382 obj->cur.usemap = enabled;
381 if (enabled) 383 if (enabled)
382 { 384 {
@@ -405,6 +407,8 @@ evas_object_map_enable_set(Evas_Object *obj, Eina_Bool enabled)
405 /* This is a bit heavy handed, but it fixes the case of same geometry, but 407 /* This is a bit heavy handed, but it fixes the case of same geometry, but
406 * changed colour or UV settings. */ 408 * changed colour or UV settings. */
407 evas_object_change(obj); 409 evas_object_change(obj);
410 if (!obj->changed_pchange) obj->changed_pchange = pchange;
411 obj->changed_map = EINA_TRUE;
408} 412}
409 413
410EAPI Eina_Bool 414EAPI Eina_Bool
@@ -896,7 +900,7 @@ evas_map_util_3d_lighting(Evas_Map *m,
896 for (i = 0; i < m->count; i++) 900 for (i = 0; i < m->count; i++)
897 { 901 {
898 double x, y, z; 902 double x, y, z;
899 double nx, ny, nz, x1, y1, z1, x2, y2, z2, ln, br; 903 double nx, ny, nz, x1, yy1, z1, x2, yy2, z2, ln, br;
900 int h, j, mr, mg, mb; 904 int h, j, mr, mg, mb;
901 905
902 x = m->points[i].x; 906 x = m->points[i].x;
@@ -907,15 +911,15 @@ evas_map_util_3d_lighting(Evas_Map *m,
907 j = (i + 1) % 4 + (i & ~0x3); // next point 911 j = (i + 1) % 4 + (i & ~0x3); // next point
908 912
909 x1 = m->points[h].x - x; 913 x1 = m->points[h].x - x;
910 y1 = m->points[h].y - y; 914 yy1 = m->points[h].y - y;
911 z1 = m->points[h].z - z; 915 z1 = m->points[h].z - z;
912 916
913 x2 = m->points[j].x - x; 917 x2 = m->points[j].x - x;
914 y2 = m->points[j].y - y; 918 yy2 = m->points[j].y - y;
915 z2 = m->points[j].z - z; 919 z2 = m->points[j].z - z;
916 nx = (y1 * z2) - (z1 * y2); 920 nx = (yy1 * z2) - (z1 * yy2);
917 ny = (z1 * x2) - (x1 * z2); 921 ny = (z1 * x2) - (x1 * z2);
918 nz = (x1 * y2) - (y1 * x2); 922 nz = (x1 * yy2) - (yy1 * x2);
919 923
920 ln = (nx * nx) + (ny * ny) + (nz * nz); 924 ln = (nx * nx) + (ny * ny) + (nz * nz);
921 ln = sqrt(ln); 925 ln = sqrt(ln);