diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/evas/src/lib/include/evas_inline.x | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2 SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz |
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/evas/src/lib/include/evas_inline.x')
-rw-r--r-- | libraries/evas/src/lib/include/evas_inline.x | 259 |
1 files changed, 259 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/include/evas_inline.x b/libraries/evas/src/lib/include/evas_inline.x new file mode 100644 index 0000000..45f2b1f --- /dev/null +++ b/libraries/evas/src/lib/include/evas_inline.x | |||
@@ -0,0 +1,259 @@ | |||
1 | #ifndef EVAS_INLINE_H | ||
2 | #define EVAS_INLINE_H | ||
3 | |||
4 | static inline void | ||
5 | _evas_object_event_new(void) | ||
6 | { | ||
7 | _evas_event_counter++; | ||
8 | } | ||
9 | |||
10 | static inline int | ||
11 | evas_object_was_visible(Evas_Object *obj) | ||
12 | { | ||
13 | if ((obj->prev.visible) && | ||
14 | ((obj->prev.cache.clip.visible) || (obj->smart.smart)) && | ||
15 | ((obj->prev.cache.clip.a > 0 && obj->prev.render_op == EVAS_RENDER_BLEND) | ||
16 | || obj->prev.render_op != EVAS_RENDER_BLEND)) | ||
17 | { | ||
18 | if (obj->func->was_visible) | ||
19 | return obj->func->was_visible(obj); | ||
20 | return 1; | ||
21 | } | ||
22 | return 0; | ||
23 | } | ||
24 | |||
25 | static inline void | ||
26 | evas_add_rect(Eina_Array *rects, int x, int y, int w, int h) | ||
27 | { | ||
28 | Eina_Rectangle *r; | ||
29 | |||
30 | NEW_RECT(r, x, y, w, h); | ||
31 | if (r) eina_array_push(rects, r); | ||
32 | } | ||
33 | |||
34 | static inline Cutout_Rect* | ||
35 | evas_common_draw_context_cutouts_add(Cutout_Rects* rects, | ||
36 | int x, int y, int w, int h) | ||
37 | { | ||
38 | Cutout_Rect* rect; | ||
39 | |||
40 | if (rects->max < (rects->active + 1)) | ||
41 | { | ||
42 | rects->max += 128; | ||
43 | rects->rects = (Cutout_Rect *)realloc(rects->rects, sizeof(Cutout_Rect) * rects->max); | ||
44 | } | ||
45 | |||
46 | rect = rects->rects + rects->active; | ||
47 | rect->x = x; | ||
48 | rect->y = y; | ||
49 | rect->w = w; | ||
50 | rect->h = h; | ||
51 | rects->active++; | ||
52 | |||
53 | return rect; | ||
54 | } | ||
55 | |||
56 | static inline int | ||
57 | evas_object_is_opaque(Evas_Object *obj) | ||
58 | { | ||
59 | if (obj->smart.smart) return 0; | ||
60 | /* If a mask: Assume alpha */ | ||
61 | if (obj->cur.mask) return 0; | ||
62 | if (obj->cur.cache.clip.a == 255) | ||
63 | { | ||
64 | if (obj->func->is_opaque) | ||
65 | return obj->func->is_opaque(obj); | ||
66 | return 1; | ||
67 | } | ||
68 | if (obj->cur.render_op == EVAS_RENDER_COPY) | ||
69 | return 1; | ||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static inline int | ||
74 | evas_event_freezes_through(Evas_Object *obj) | ||
75 | { | ||
76 | if (obj->freeze_events) return 1; | ||
77 | if (obj->parent_cache.freeze_events_valid) | ||
78 | return obj->parent_cache.freeze_events; | ||
79 | if (!obj->smart.parent) return 0; | ||
80 | obj->parent_cache.freeze_events = | ||
81 | evas_event_freezes_through(obj->smart.parent); | ||
82 | obj->parent_cache.freeze_events_valid = EINA_TRUE; | ||
83 | return obj->parent_cache.freeze_events; | ||
84 | } | ||
85 | |||
86 | static inline int | ||
87 | evas_event_passes_through(Evas_Object *obj) | ||
88 | { | ||
89 | if (obj->pass_events) return 1; | ||
90 | if (obj->parent_cache.pass_events_valid) | ||
91 | return obj->parent_cache.pass_events; | ||
92 | if (!obj->smart.parent) return 0; | ||
93 | obj->parent_cache.pass_events = | ||
94 | evas_event_passes_through(obj->smart.parent); | ||
95 | obj->parent_cache.pass_events_valid = EINA_TRUE; | ||
96 | return obj->parent_cache.pass_events; | ||
97 | } | ||
98 | |||
99 | static inline int | ||
100 | evas_object_is_visible(Evas_Object *obj) | ||
101 | { /* post 1.0 -> enable? */ | ||
102 | if ((obj->cur.visible)/* && (obj->cur.color.a > 0)*/ && | ||
103 | ((obj->cur.cache.clip.visible) || (obj->smart.smart)) && | ||
104 | ((obj->cur.cache.clip.a > 0 && obj->cur.render_op == EVAS_RENDER_BLEND) | ||
105 | || obj->cur.render_op != EVAS_RENDER_BLEND)) | ||
106 | { | ||
107 | if (obj->func->is_visible) | ||
108 | return obj->func->is_visible(obj); | ||
109 | return 1; | ||
110 | } | ||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static inline int | ||
115 | evas_object_clippers_is_visible(Evas_Object *obj) | ||
116 | { | ||
117 | if (obj->cur.visible) | ||
118 | { | ||
119 | if (obj->cur.clipper) | ||
120 | return evas_object_clippers_is_visible(obj->cur.clipper); | ||
121 | return 1; | ||
122 | } | ||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | static inline int | ||
127 | evas_object_is_in_output_rect(Evas_Object *obj, int x, int y, int w, int h) | ||
128 | { | ||
129 | /* assumes coords have been recalced */ | ||
130 | if ((RECTS_INTERSECT(x, y, w, h, | ||
131 | obj->cur.cache.clip.x, | ||
132 | obj->cur.cache.clip.y, | ||
133 | obj->cur.cache.clip.w, | ||
134 | obj->cur.cache.clip.h))) | ||
135 | return 1; | ||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | static inline int | ||
140 | evas_object_is_active(Evas_Object *obj) | ||
141 | { | ||
142 | if (evas_object_is_visible(obj) || evas_object_was_visible(obj)) | ||
143 | { | ||
144 | if (obj->smart.smart) | ||
145 | { | ||
146 | int mapsmt = 0; | ||
147 | if (obj->smart.smart && (obj->cur.map && obj->cur.usemap)) mapsmt = 1; | ||
148 | if (!mapsmt) return 1; | ||
149 | if (evas_object_is_in_output_rect(obj, 0, 0, obj->layer->evas->output.w, | ||
150 | obj->layer->evas->output.h) || | ||
151 | evas_object_was_in_output_rect(obj, 0, 0, obj->layer->evas->output.w, | ||
152 | obj->layer->evas->output.h)) | ||
153 | return 1; | ||
154 | } | ||
155 | else | ||
156 | { | ||
157 | if (evas_object_is_in_output_rect(obj, 0, 0, obj->layer->evas->output.w, | ||
158 | obj->layer->evas->output.h) || | ||
159 | evas_object_was_in_output_rect(obj, 0, 0, obj->layer->evas->output.w, | ||
160 | obj->layer->evas->output.h)) | ||
161 | return 1; | ||
162 | } | ||
163 | } | ||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | static inline void | ||
168 | evas_object_coords_recalc(Evas_Object *obj) | ||
169 | { | ||
170 | //// if (obj->cur.cache.geometry.validity == obj->layer->evas->output_validity) | ||
171 | //// return; | ||
172 | //// obj->cur.cache.geometry.x = | ||
173 | //// evas_coord_world_x_to_screen(obj->layer->evas, obj->cur.geometry.x); | ||
174 | //// obj->cur.cache.geometry.y = | ||
175 | //// evas_coord_world_y_to_screen(obj->layer->evas, obj->cur.geometry.y); | ||
176 | //// obj->cur.cache.geometry.w = | ||
177 | //// evas_coord_world_x_to_screen(obj->layer->evas, obj->cur.geometry.w) - | ||
178 | //// evas_coord_world_x_to_screen(obj->layer->evas, 0); | ||
179 | //// obj->cur.cache.geometry.h = | ||
180 | //// evas_coord_world_y_to_screen(obj->layer->evas, obj->cur.geometry.h) - | ||
181 | //// evas_coord_world_y_to_screen(obj->layer->evas, 0); | ||
182 | if (obj->func->coords_recalc) obj->func->coords_recalc(obj); | ||
183 | //// obj->cur.cache.geometry.validity = obj->layer->evas->output_validity; | ||
184 | } | ||
185 | |||
186 | static inline void | ||
187 | evas_object_clip_recalc(Evas_Object *obj) | ||
188 | { | ||
189 | int cx, cy, cw, ch, cvis, cr, cg, cb, ca; | ||
190 | int nx, ny, nw, nh, nvis, nr, ng, nb, na; | ||
191 | |||
192 | if ((!obj->cur.cache.clip.dirty) && | ||
193 | !(!obj->cur.clipper || obj->cur.clipper->cur.cache.clip.dirty)) | ||
194 | return; | ||
195 | if (obj->layer->evas->events_frozen > 0) return; | ||
196 | evas_object_coords_recalc(obj); | ||
197 | if ((obj->cur.map) && (obj->cur.usemap)) | ||
198 | { | ||
199 | cx = obj->cur.map->normal_geometry.x; | ||
200 | cy = obj->cur.map->normal_geometry.y; | ||
201 | cw = obj->cur.map->normal_geometry.w; | ||
202 | ch = obj->cur.map->normal_geometry.h; | ||
203 | } | ||
204 | else | ||
205 | { | ||
206 | cx = obj->cur.geometry.x; | ||
207 | cy = obj->cur.geometry.y; | ||
208 | cw = obj->cur.geometry.w; | ||
209 | ch = obj->cur.geometry.h; | ||
210 | } | ||
211 | //// cx = obj->cur.cache.geometry.x; cy = obj->cur.cache.geometry.y; | ||
212 | //// cw = obj->cur.cache.geometry.w; ch = obj->cur.cache.geometry.h; | ||
213 | if (obj->cur.color.a == 0 && obj->cur.render_op == EVAS_RENDER_BLEND) cvis = 0; | ||
214 | else cvis = obj->cur.visible; | ||
215 | cr = obj->cur.color.r; cg = obj->cur.color.g; | ||
216 | cb = obj->cur.color.b; ca = obj->cur.color.a; | ||
217 | if (obj->cur.clipper) | ||
218 | { | ||
219 | // this causes problems... hmmm ????? | ||
220 | if (obj->cur.clipper->cur.cache.clip.dirty) | ||
221 | evas_object_clip_recalc(obj->cur.clipper); | ||
222 | |||
223 | // I don't know why this test was here in the first place. As I have | ||
224 | // no issue showing up due to this, I keep it and move color out of it. | ||
225 | // breaks cliping of mapped images!!! | ||
226 | if (obj->cur.clipper->cur.map_parent == obj->cur.map_parent) | ||
227 | { | ||
228 | nx = obj->cur.clipper->cur.cache.clip.x; | ||
229 | ny = obj->cur.clipper->cur.cache.clip.y; | ||
230 | nw = obj->cur.clipper->cur.cache.clip.w; | ||
231 | nh = obj->cur.clipper->cur.cache.clip.h; | ||
232 | RECTS_CLIP_TO_RECT(cx, cy, cw, ch, nx, ny, nw, nh); | ||
233 | } | ||
234 | |||
235 | nvis = obj->cur.clipper->cur.cache.clip.visible; | ||
236 | nr = obj->cur.clipper->cur.cache.clip.r; | ||
237 | ng = obj->cur.clipper->cur.cache.clip.g; | ||
238 | nb = obj->cur.clipper->cur.cache.clip.b; | ||
239 | na = obj->cur.clipper->cur.cache.clip.a; | ||
240 | cvis = cvis * nvis; | ||
241 | cr = (cr * (nr + 1)) >> 8; | ||
242 | cg = (cg * (ng + 1)) >> 8; | ||
243 | cb = (cb * (nb + 1)) >> 8; | ||
244 | ca = (ca * (na + 1)) >> 8; | ||
245 | } | ||
246 | if ((ca == 0 && obj->cur.render_op == EVAS_RENDER_BLEND) || (cw <= 0) || (ch <= 0)) cvis = 0; | ||
247 | obj->cur.cache.clip.x = cx; | ||
248 | obj->cur.cache.clip.y = cy; | ||
249 | obj->cur.cache.clip.w = cw; | ||
250 | obj->cur.cache.clip.h = ch; | ||
251 | obj->cur.cache.clip.visible = cvis; | ||
252 | obj->cur.cache.clip.r = cr; | ||
253 | obj->cur.cache.clip.g = cg; | ||
254 | obj->cur.cache.clip.b = cb; | ||
255 | obj->cur.cache.clip.a = ca; | ||
256 | obj->cur.cache.clip.dirty = 0; | ||
257 | } | ||
258 | |||
259 | #endif | ||