summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_map.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2013-01-21 09:36:19 +0000
committerCedric BAIL <cedric.bail@free.fr>2013-01-21 09:36:19 +0000
commit3e7e37630f13c57e24d96f4af00cf5e1f52a64a4 (patch)
treef609669651ea6c97f9c1cfb5e116734cbb8c4b25 /src/lib/evas/canvas/evas_map.c
parent56c020fbbaa08b2aadf14eab63d64b46dd648618 (diff)
efl: group more map stuff in the same sub structure.
SVN revision: 83034
Diffstat (limited to 'src/lib/evas/canvas/evas_map.c')
-rw-r--r--src/lib/evas/canvas/evas_map.c118
1 files changed, 59 insertions, 59 deletions
diff --git a/src/lib/evas/canvas/evas_map.c b/src/lib/evas/canvas/evas_map.c
index b921907..71a59ab 100644
--- a/src/lib/evas/canvas/evas_map.c
+++ b/src/lib/evas/canvas/evas_map.c
@@ -39,28 +39,28 @@ _evas_map_calc_map_geometry(Evas_Object *eo_obj)
39 39
40 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS); 40 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
41 if (!obj) return; 41 if (!obj) return;
42 if (!obj->cur.map) return; 42 if (!obj->map.cur.map) return;
43 // WARN: Do not merge below code to SLP until it is fixed. 43 // WARN: Do not merge below code to SLP until it is fixed.
44 // It has an infinite loop bug. 44 // It has an infinite loop bug.
45 if (obj->prev.map) 45 if (obj->map.prev.map)
46 { 46 {
47 if (obj->prev.map != obj->cur.map) 47 if (obj->map.prev.map != obj->map.cur.map)
48 { 48 {
49 // FIXME: this causes an infinite loop somewhere... hard to debug 49 // FIXME: this causes an infinite loop somewhere... hard to debug
50 if (obj->prev.map->count == obj->cur.map->count) 50 if (obj->map.prev.map->count == obj->map.cur.map->count)
51 { 51 {
52 const Evas_Map_Point *p2; 52 const Evas_Map_Point *p2;
53 53
54 p = obj->cur.map->points; 54 p = obj->map.cur.map->points;
55 p2 = obj->prev.map->points; 55 p2 = obj->map.prev.map->points;
56 if (memcmp(p, p2, sizeof(Evas_Map_Point) * 56 if (memcmp(p, p2, sizeof(Evas_Map_Point) *
57 obj->prev.map->count) != 0) 57 obj->map.prev.map->count) != 0)
58 ch = EINA_TRUE; 58 ch = EINA_TRUE;
59 if (!ch) 59 if (!ch)
60 { 60 {
61 if (obj->map.cache_map) evas_map_free(obj->map.cache_map); 61 if (obj->map.cache_map) evas_map_free(obj->map.cache_map);
62 obj->map.cache_map = obj->cur.map; 62 obj->map.cache_map = obj->map.cur.map;
63 obj->cur.map = obj->prev.map; 63 obj->map.cur.map = obj->map.prev.map;
64 } 64 }
65 } 65 }
66 else 66 else
@@ -70,8 +70,8 @@ _evas_map_calc_map_geometry(Evas_Object *eo_obj)
70 else 70 else
71 ch = EINA_TRUE; 71 ch = EINA_TRUE;
72 72
73 p = obj->cur.map->points; 73 p = obj->map.cur.map->points;
74 p_end = p + obj->cur.map->count; 74 p_end = p + obj->map.cur.map->count;
75 x1 = x2 = lround(p->x); 75 x1 = x2 = lround(p->x);
76 yy1 = yy2 = lround(p->y); 76 yy1 = yy2 = lround(p->y);
77 p++; 77 p++;
@@ -90,14 +90,14 @@ _evas_map_calc_map_geometry(Evas_Object *eo_obj)
90// // add 1 pixel of fuzz around the map region to ensure updates are correct 90// // add 1 pixel of fuzz around the map region to ensure updates are correct
91// x1 -= 1; yy1 -= 1; 91// x1 -= 1; yy1 -= 1;
92// x2 += 1; yy2 += 1; 92// x2 += 1; yy2 += 1;
93 if (obj->cur.map->normal_geometry.x != x1) ch = 1; 93 if (obj->map.cur.map->normal_geometry.x != x1) ch = 1;
94 if (obj->cur.map->normal_geometry.y != yy1) ch = 1; 94 if (obj->map.cur.map->normal_geometry.y != yy1) ch = 1;
95 if (obj->cur.map->normal_geometry.w != (x2 - x1)) ch = 1; 95 if (obj->map.cur.map->normal_geometry.w != (x2 - x1)) ch = 1;
96 if (obj->cur.map->normal_geometry.h != (yy2 - yy1)) ch = 1; 96 if (obj->map.cur.map->normal_geometry.h != (yy2 - yy1)) ch = 1;
97 obj->cur.map->normal_geometry.x = x1; 97 obj->map.cur.map->normal_geometry.x = x1;
98 obj->cur.map->normal_geometry.y = yy1; 98 obj->map.cur.map->normal_geometry.y = yy1;
99 obj->cur.map->normal_geometry.w = (x2 - x1); 99 obj->map.cur.map->normal_geometry.w = (x2 - x1);
100 obj->cur.map->normal_geometry.h = (yy2 - yy1); 100 obj->map.cur.map->normal_geometry.h = (yy2 - yy1);
101 obj->changed_map = ch; 101 obj->changed_map = ch;
102 // This shouldn't really be needed, but without it we do have case 102 // This shouldn't really be needed, but without it we do have case
103 // where the clip is wrong when a map doesn't change, so always forcing 103 // where the clip is wrong when a map doesn't change, so always forcing
@@ -412,7 +412,7 @@ _evas_object_map_parent_check(Evas_Object *eo_parent)
412 if (!parent) return EINA_FALSE; 412 if (!parent) return EINA_FALSE;
413 list = evas_object_smart_members_get_direct(parent->smart.parent); 413 list = evas_object_smart_members_get_direct(parent->smart.parent);
414 EINA_INLIST_FOREACH(list, o) 414 EINA_INLIST_FOREACH(list, o)
415 if (o->cur.usemap) break ; 415 if (o->map.cur.usemap) break ;
416 if (o) return EINA_FALSE; /* Still some child have a map enable */ 416 if (o) return EINA_FALSE; /* Still some child have a map enable */
417 parent->child_has_map = EINA_FALSE; 417 parent->child_has_map = EINA_FALSE;
418 _evas_object_map_parent_check(parent->smart.parent); 418 _evas_object_map_parent_check(parent->smart.parent);
@@ -437,15 +437,15 @@ _map_enable_set(Eo *eo_obj, void *_pd, va_list *list)
437 Eina_Bool pchange = EINA_FALSE; 437 Eina_Bool pchange = EINA_FALSE;
438 438
439 enabled = !!enabled; 439 enabled = !!enabled;
440 if (obj->cur.usemap == enabled) return; 440 if (obj->map.cur.usemap == enabled) return;
441 pchange = obj->changed; 441 pchange = obj->changed;
442 obj->cur.usemap = enabled; 442 obj->map.cur.usemap = enabled;
443 if (enabled) 443 if (enabled)
444 { 444 {
445 if (!obj->cur.map) 445 if (!obj->map.cur.map)
446 obj->cur.map = _evas_map_new(4); 446 obj->map.cur.map = _evas_map_new(4);
447 evas_object_mapped_clip_across_mark(eo_obj, obj); 447 evas_object_mapped_clip_across_mark(eo_obj, obj);
448// obj->cur.map->normal_geometry = obj->cur.geometry; 448// obj->map.cur.map->normal_geometry = obj->cur.geometry;
449 } 449 }
450 else 450 else
451 { 451 {
@@ -456,7 +456,7 @@ _map_enable_set(Eo *eo_obj, void *_pd, va_list *list)
456 obj->map.surface); 456 obj->map.surface);
457 obj->map.surface = NULL; 457 obj->map.surface = NULL;
458 } 458 }
459 if (obj->cur.map) 459 if (obj->map.cur.map)
460 { 460 {
461 _evas_map_calc_geom_change(eo_obj); 461 _evas_map_calc_geom_change(eo_obj);
462 evas_object_mapped_clip_across_mark(eo_obj, obj); 462 evas_object_mapped_clip_across_mark(eo_obj, obj);
@@ -503,7 +503,7 @@ _map_enable_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
503{ 503{
504 Eina_Bool *enabled = va_arg(*list, Eina_Bool *); 504 Eina_Bool *enabled = va_arg(*list, Eina_Bool *);
505 const Evas_Object_Protected_Data *obj = _pd; 505 const Evas_Object_Protected_Data *obj = _pd;
506 *enabled = obj->cur.usemap; 506 *enabled = obj->map.cur.usemap;
507} 507}
508 508
509EAPI void 509EAPI void
@@ -530,55 +530,55 @@ _map_set(Eo *eo_obj, void *_pd, va_list *list)
530 obj->map.surface); 530 obj->map.surface);
531 obj->map.surface = NULL; 531 obj->map.surface = NULL;
532 } 532 }
533 if (obj->cur.map) 533 if (obj->map.cur.map)
534 { 534 {
535 obj->changed_map = EINA_TRUE; 535 obj->changed_map = EINA_TRUE;
536 obj->prev.geometry = obj->cur.map->normal_geometry; 536 obj->prev.geometry = obj->map.cur.map->normal_geometry;
537 537
538 if (obj->prev.map == obj->cur.map) 538 if (obj->map.prev.map == obj->map.cur.map)
539 obj->cur.map = NULL; 539 obj->map.cur.map = NULL;
540 else if (!obj->map.cache_map) 540 else if (!obj->map.cache_map)
541 { 541 {
542 obj->map.cache_map = obj->cur.map; 542 obj->map.cache_map = obj->map.cur.map;
543 obj->cur.map = NULL; 543 obj->map.cur.map = NULL;
544 } 544 }
545 else 545 else
546 { 546 {
547 _evas_map_free(eo_obj, obj->cur.map); 547 _evas_map_free(eo_obj, obj->map.cur.map);
548 obj->cur.map = NULL; 548 obj->map.cur.map = NULL;
549 } 549 }
550 550
551 if (!obj->prev.map) 551 if (!obj->map.prev.map)
552 { 552 {
553 evas_object_mapped_clip_across_mark(eo_obj, obj); 553 evas_object_mapped_clip_across_mark(eo_obj, obj);
554 return; 554 return;
555 } 555 }
556 556
557 if (!obj->cur.usemap) _evas_map_calc_geom_change(eo_obj); 557 if (!obj->map.cur.usemap) _evas_map_calc_geom_change(eo_obj);
558 else _evas_map_calc_map_geometry(eo_obj); 558 else _evas_map_calc_map_geometry(eo_obj);
559 if (obj->cur.usemap) 559 if (obj->map.cur.usemap)
560 evas_object_mapped_clip_across_mark(eo_obj, obj); 560 evas_object_mapped_clip_across_mark(eo_obj, obj);
561 } 561 }
562 return; 562 return;
563 } 563 }
564 564
565 if (obj->prev.map == obj->cur.map) 565 if (obj->map.prev.map == obj->map.cur.map)
566 obj->cur.map = NULL; 566 obj->map.cur.map = NULL;
567 567
568 if (!obj->cur.map) 568 if (!obj->map.cur.map)
569 { 569 {
570 obj->cur.map = obj->map.cache_map; 570 obj->map.cur.map = obj->map.cache_map;
571 obj->map.cache_map = NULL; 571 obj->map.cache_map = NULL;
572 } 572 }
573 573
574 // We do have the same exact count of point in this map, so just copy it 574 // We do have the same exact count of point in this map, so just copy it
575 if ((obj->cur.map) && (obj->cur.map->count == map->count)) 575 if ((obj->map.cur.map) && (obj->map.cur.map->count == map->count))
576 _evas_map_copy(obj->cur.map, map); 576 _evas_map_copy(obj->map.cur.map, map);
577 else 577 else
578 { 578 {
579 if (obj->cur.map) _evas_map_free(eo_obj, obj->cur.map); 579 if (obj->map.cur.map) _evas_map_free(eo_obj, obj->map.cur.map);
580 obj->cur.map = _evas_map_dup(map); 580 obj->map.cur.map = _evas_map_dup(map);
581 if (obj->cur.usemap) 581 if (obj->map.cur.usemap)
582 evas_object_mapped_clip_across_mark(eo_obj, obj); 582 evas_object_mapped_clip_across_mark(eo_obj, obj);
583 } 583 }
584 584
@@ -602,7 +602,7 @@ _map_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
602 const Evas_Map **map = va_arg(*list, const Evas_Map **); 602 const Evas_Map **map = va_arg(*list, const Evas_Map **);
603 const Evas_Object_Protected_Data *obj = _pd; 603 const Evas_Object_Protected_Data *obj = _pd;
604 604
605 *map = obj->cur.map; 605 *map = obj->map.cur.map;
606} 606}
607 607
608EAPI Evas_Map * 608EAPI Evas_Map *
@@ -1198,7 +1198,7 @@ evas_object_map_update(Evas_Object *eo_obj,
1198 1198
1199 if (!obj->changed_map) return ; 1199 if (!obj->changed_map) return ;
1200 1200
1201 if (obj->cur.map && obj->map.spans && obj->cur.map->count != obj->map.spans->count) 1201 if (obj->map.cur.map && obj->map.spans && obj->map.cur.map->count != obj->map.spans->count)
1202 { 1202 {
1203 if (obj->map.spans) 1203 if (obj->map.spans)
1204 { 1204 {
@@ -1210,11 +1210,11 @@ evas_object_map_update(Evas_Object *eo_obj,
1210 1210
1211 if (!obj->map.spans) 1211 if (!obj->map.spans)
1212 obj->map.spans = calloc(1, sizeof (RGBA_Map) + 1212 obj->map.spans = calloc(1, sizeof (RGBA_Map) +
1213 sizeof (RGBA_Map_Point) * (obj->cur.map->count - 1)); 1213 sizeof (RGBA_Map_Point) * (obj->map.cur.map->count - 1));
1214 1214
1215 if (!obj->map.spans) return ; 1215 if (!obj->map.spans) return ;
1216 1216
1217 obj->map.spans->count = obj->cur.map->count; 1217 obj->map.spans->count = obj->map.cur.map->count;
1218 obj->map.spans->x = x; 1218 obj->map.spans->x = x;
1219 obj->map.spans->y = y; 1219 obj->map.spans->y = y;
1220 obj->map.spans->uv.w = uvw; 1220 obj->map.spans->uv.w = uvw;
@@ -1224,14 +1224,14 @@ evas_object_map_update(Evas_Object *eo_obj,
1224 1224
1225 pts = obj->map.spans->pts; 1225 pts = obj->map.spans->pts;
1226 1226
1227 p = obj->cur.map->points; 1227 p = obj->map.cur.map->points;
1228 p_end = p + obj->cur.map->count; 1228 p_end = p + obj->map.cur.map->count;
1229 pt = pts; 1229 pt = pts;
1230 1230
1231 pts[0].px = obj->cur.map->persp.px << FP; 1231 pts[0].px = obj->map.cur.map->persp.px << FP;
1232 pts[0].py = obj->cur.map->persp.py << FP; 1232 pts[0].py = obj->map.cur.map->persp.py << FP;
1233 pts[0].foc = obj->cur.map->persp.foc << FP; 1233 pts[0].foc = obj->map.cur.map->persp.foc << FP;
1234 pts[0].z0 = obj->cur.map->persp.z0 << FP; 1234 pts[0].z0 = obj->map.cur.map->persp.z0 << FP;
1235 // draw geom +x +y 1235 // draw geom +x +y
1236 for (; p < p_end; p++, pt++) 1236 for (; p < p_end; p++, pt++)
1237 { 1237 {
@@ -1251,9 +1251,9 @@ evas_object_map_update(Evas_Object *eo_obj,
1251 else if (pt->v > (imageh * FP1)) pt->v = (imageh * FP1); 1251 else if (pt->v > (imageh * FP1)) pt->v = (imageh * FP1);
1252 pt->col = ARGB_JOIN(p->a, p->r, p->g, p->b); 1252 pt->col = ARGB_JOIN(p->a, p->r, p->g, p->b);
1253 } 1253 }
1254 if (obj->cur.map->count & 0x1) 1254 if (obj->map.cur.map->count & 0x1)
1255 { 1255 {
1256 pts[obj->cur.map->count] = pts[obj->cur.map->count -1]; 1256 pts[obj->map.cur.map->count] = pts[obj->map.cur.map->count -1];
1257 } 1257 }
1258 1258
1259 // Request engine to update it's point 1259 // Request engine to update it's point