diff options
author | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
commit | 07274513e984f0b5544586c74508ccd16e7dcafa (patch) | |
tree | b32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/evas/src/modules/engines/software_ddraw/evas_engine.c | |
parent | Added Irrlicht 1.8, but without all the Windows binaries. (diff) | |
download | SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2 SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz |
Remove EFL, since it's been released now.
Diffstat (limited to 'libraries/evas/src/modules/engines/software_ddraw/evas_engine.c')
-rw-r--r-- | libraries/evas/src/modules/engines/software_ddraw/evas_engine.c | 379 |
1 files changed, 0 insertions, 379 deletions
diff --git a/libraries/evas/src/modules/engines/software_ddraw/evas_engine.c b/libraries/evas/src/modules/engines/software_ddraw/evas_engine.c deleted file mode 100644 index 5bfc87f..0000000 --- a/libraries/evas/src/modules/engines/software_ddraw/evas_engine.c +++ /dev/null | |||
@@ -1,379 +0,0 @@ | |||
1 | #include "evas_common.h" | ||
2 | #include "evas_private.h" | ||
3 | #include "evas_engine.h" | ||
4 | #include "Evas_Engine_Software_DDraw.h" | ||
5 | |||
6 | int _evas_engine_soft_ddraw_log_dom = -1; | ||
7 | /* function tables - filled in later (func and parent func) */ | ||
8 | static Evas_Func func, pfunc; | ||
9 | |||
10 | /* engine struct data */ | ||
11 | typedef struct _Render_Engine Render_Engine; | ||
12 | |||
13 | struct _Render_Engine | ||
14 | { | ||
15 | Tilebuf *tb; | ||
16 | Outbuf *ob; | ||
17 | Tilebuf_Rect *rects; | ||
18 | Eina_Inlist *cur_rect; | ||
19 | int end : 1; | ||
20 | }; | ||
21 | |||
22 | |||
23 | /* log domain variable */ | ||
24 | int _evas_log_dom_module = -1; | ||
25 | |||
26 | |||
27 | static void * | ||
28 | _output_setup(int width, | ||
29 | int height, | ||
30 | int rot, | ||
31 | HWND window, | ||
32 | int depth, | ||
33 | int fullscreen) | ||
34 | { | ||
35 | Render_Engine *re; | ||
36 | |||
37 | re = calloc(1, sizeof(Render_Engine)); | ||
38 | if (!re) | ||
39 | return NULL; | ||
40 | |||
41 | /* if we haven't initialized - init (automatic abort if already done) */ | ||
42 | evas_common_cpu_init(); | ||
43 | |||
44 | evas_common_blend_init(); | ||
45 | evas_common_image_init(); | ||
46 | evas_common_convert_init(); | ||
47 | evas_common_scale_init(); | ||
48 | evas_common_rectangle_init(); | ||
49 | evas_common_polygon_init(); | ||
50 | evas_common_line_init(); | ||
51 | evas_common_font_init(); | ||
52 | evas_common_draw_init(); | ||
53 | evas_common_tilebuf_init(); | ||
54 | |||
55 | evas_software_ddraw_outbuf_init(); | ||
56 | |||
57 | re->ob = evas_software_ddraw_outbuf_setup(width, height, rot, | ||
58 | OUTBUF_DEPTH_INHERIT, | ||
59 | window, depth, fullscreen); | ||
60 | if (!re->ob) | ||
61 | { | ||
62 | free(re); | ||
63 | return NULL; | ||
64 | } | ||
65 | |||
66 | /* for updates return 1 big buffer, but only use portions of it, also cache | ||
67 | it and keep it around until an idle_flush */ | ||
68 | /* disable for now - i am hunting down why some expedite tests are slower, | ||
69 | * as well as shaped stuff is broken and probable non-32bpp is broken as | ||
70 | * convert funcs dont do the right thing | ||
71 | * | ||
72 | re->ob->onebuf = 1; | ||
73 | */ | ||
74 | |||
75 | re->tb = evas_common_tilebuf_new(width, height); | ||
76 | if (!re->tb) | ||
77 | { | ||
78 | evas_software_ddraw_outbuf_free(re->ob); | ||
79 | free(re); | ||
80 | return NULL; | ||
81 | } | ||
82 | /* in preliminary tests 16x16 gave highest framerates */ | ||
83 | evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); | ||
84 | |||
85 | return re; | ||
86 | } | ||
87 | |||
88 | |||
89 | /* engine api this module provides */ | ||
90 | |||
91 | static void * | ||
92 | eng_info(Evas *e) | ||
93 | { | ||
94 | Evas_Engine_Info_Software_DDraw *info; | ||
95 | |||
96 | info = calloc(1, sizeof(Evas_Engine_Info_Software_DDraw)); | ||
97 | if (!info) return NULL; | ||
98 | info->magic.magic = rand(); | ||
99 | info->render_mode = EVAS_RENDER_MODE_BLOCKING; | ||
100 | return info; | ||
101 | e = NULL; | ||
102 | } | ||
103 | |||
104 | static void | ||
105 | eng_info_free(Evas *e, void *info) | ||
106 | { | ||
107 | Evas_Engine_Info_Software_DDraw *in; | ||
108 | in = (Evas_Engine_Info_Software_DDraw *)info; | ||
109 | free(in); | ||
110 | } | ||
111 | |||
112 | static int | ||
113 | eng_setup(Evas *e, void *in) | ||
114 | { | ||
115 | Render_Engine *re; | ||
116 | Evas_Engine_Info_Software_DDraw *info; | ||
117 | |||
118 | info = (Evas_Engine_Info_Software_DDraw *)in; | ||
119 | if (!e->engine.data.output) | ||
120 | e->engine.data.output = _output_setup(e->output.w, | ||
121 | e->output.h, | ||
122 | info->info.rotation, | ||
123 | info->info.window, | ||
124 | info->info.depth, | ||
125 | info->info.fullscreen); | ||
126 | else | ||
127 | { | ||
128 | int ponebuf = 0; | ||
129 | |||
130 | re = e->engine.data.output; | ||
131 | ponebuf = re->ob->onebuf; | ||
132 | evas_software_ddraw_outbuf_free(re->ob); | ||
133 | re->ob = evas_software_ddraw_outbuf_setup(e->output.w, | ||
134 | e->output.h, | ||
135 | info->info.rotation, | ||
136 | OUTBUF_DEPTH_INHERIT, | ||
137 | info->info.window, | ||
138 | info->info.depth, | ||
139 | info->info.fullscreen); | ||
140 | re->ob->onebuf = ponebuf; | ||
141 | } | ||
142 | if (!e->engine.data.output) return 0; | ||
143 | if (!e->engine.data.context) | ||
144 | e->engine.data.context = e->engine.func->context_new(e->engine.data.output); | ||
145 | |||
146 | re = e->engine.data.output; | ||
147 | |||
148 | return 1; | ||
149 | } | ||
150 | |||
151 | static void | ||
152 | eng_output_free(void *data) | ||
153 | { | ||
154 | Render_Engine *re; | ||
155 | |||
156 | if (!data) return; | ||
157 | |||
158 | re = (Render_Engine *)data; | ||
159 | evas_software_ddraw_outbuf_free(re->ob); | ||
160 | evas_common_tilebuf_free(re->tb); | ||
161 | if (re->rects) evas_common_tilebuf_free_render_rects(re->rects); | ||
162 | free(re); | ||
163 | |||
164 | evas_common_font_shutdown(); | ||
165 | evas_common_image_shutdown(); | ||
166 | } | ||
167 | |||
168 | static void | ||
169 | eng_output_resize(void *data, int width, int height) | ||
170 | { | ||
171 | Render_Engine *re; | ||
172 | |||
173 | re = (Render_Engine *)data; | ||
174 | evas_software_ddraw_outbuf_reconfigure(re->ob, | ||
175 | width, | ||
176 | height, | ||
177 | evas_software_ddraw_outbuf_rot_get(re->ob), | ||
178 | OUTBUF_DEPTH_INHERIT); | ||
179 | evas_common_tilebuf_free(re->tb); | ||
180 | re->tb = evas_common_tilebuf_new(width, height); | ||
181 | if (re->tb) | ||
182 | evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); | ||
183 | } | ||
184 | |||
185 | static void | ||
186 | eng_output_tile_size_set(void *data, int w, int h) | ||
187 | { | ||
188 | Render_Engine *re; | ||
189 | |||
190 | re = (Render_Engine *)data; | ||
191 | evas_common_tilebuf_set_tile_size(re->tb, w, h); | ||
192 | } | ||
193 | |||
194 | static void | ||
195 | eng_output_redraws_rect_add(void *data, int x, int y, int w, int h) | ||
196 | { | ||
197 | Render_Engine *re; | ||
198 | |||
199 | re = (Render_Engine *)data; | ||
200 | evas_common_tilebuf_add_redraw(re->tb, x, y, w, h); | ||
201 | } | ||
202 | |||
203 | static void | ||
204 | eng_output_redraws_rect_del(void *data, int x, int y, int w, int h) | ||
205 | { | ||
206 | Render_Engine *re; | ||
207 | |||
208 | re = (Render_Engine *)data; | ||
209 | evas_common_tilebuf_del_redraw(re->tb, x, y, w, h); | ||
210 | } | ||
211 | |||
212 | static void | ||
213 | eng_output_redraws_clear(void *data) | ||
214 | { | ||
215 | Render_Engine *re; | ||
216 | |||
217 | re = (Render_Engine *)data; | ||
218 | evas_common_tilebuf_clear(re->tb); | ||
219 | } | ||
220 | |||
221 | static void * | ||
222 | eng_output_redraws_next_update_get(void *data, | ||
223 | int *x, | ||
224 | int *y, | ||
225 | int *w, | ||
226 | int *h, | ||
227 | int *cx, | ||
228 | int *cy, | ||
229 | int *cw, | ||
230 | int *ch) | ||
231 | { | ||
232 | Render_Engine *re; | ||
233 | RGBA_Image *surface; | ||
234 | Tilebuf_Rect *rect; | ||
235 | int ux; | ||
236 | int uy; | ||
237 | int uw; | ||
238 | int uh; | ||
239 | |||
240 | re = (Render_Engine *)data; | ||
241 | if (re->end) | ||
242 | { | ||
243 | re->end = 0; | ||
244 | return NULL; | ||
245 | } | ||
246 | if (!re->rects) | ||
247 | { | ||
248 | re->rects = evas_common_tilebuf_get_render_rects(re->tb); | ||
249 | re->cur_rect = EINA_INLIST_GET(re->rects); | ||
250 | } | ||
251 | if (!re->cur_rect) return NULL; | ||
252 | rect = (Tilebuf_Rect *)re->cur_rect; | ||
253 | ux = rect->x; | ||
254 | uy = rect->y; | ||
255 | uw = rect->w; | ||
256 | uh = rect->h; | ||
257 | re->cur_rect = re->cur_rect->next; | ||
258 | if (!re->cur_rect) | ||
259 | { | ||
260 | evas_common_tilebuf_free_render_rects(re->rects); | ||
261 | re->rects = NULL; | ||
262 | re->end = 1; | ||
263 | } | ||
264 | |||
265 | surface = evas_software_ddraw_outbuf_new_region_for_update(re->ob, | ||
266 | ux, | ||
267 | uy, | ||
268 | uw, | ||
269 | uh, | ||
270 | cx, | ||
271 | cy, | ||
272 | cw, | ||
273 | ch); | ||
274 | |||
275 | *x = ux; | ||
276 | *y = uy; | ||
277 | *w = uw; | ||
278 | *h = uh; | ||
279 | |||
280 | return surface; | ||
281 | } | ||
282 | |||
283 | static void | ||
284 | eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int w, int h) | ||
285 | { | ||
286 | Render_Engine *re; | ||
287 | |||
288 | re = (Render_Engine *)data; | ||
289 | #ifdef BUILD_PIPE_RENDER | ||
290 | evas_common_pipe_map_begin(surface); | ||
291 | #endif | ||
292 | evas_software_ddraw_outbuf_push_updated_region(re->ob, surface, x, y, w, h); | ||
293 | evas_software_ddraw_outbuf_free_region_for_update(re->ob, surface); | ||
294 | evas_common_cpu_end_opt(); | ||
295 | } | ||
296 | |||
297 | static void | ||
298 | eng_output_flush(void *data) | ||
299 | { | ||
300 | Render_Engine *re; | ||
301 | |||
302 | re = (Render_Engine *)data; | ||
303 | evas_software_ddraw_outbuf_flush(re->ob); | ||
304 | } | ||
305 | |||
306 | static void | ||
307 | eng_output_idle_flush(void *data) | ||
308 | { | ||
309 | Render_Engine *re; | ||
310 | |||
311 | re = (Render_Engine *)data; | ||
312 | evas_software_ddraw_outbuf_idle_flush(re->ob); | ||
313 | } | ||
314 | |||
315 | static Eina_Bool | ||
316 | eng_canvas_alpha_get(void *data, void *context) | ||
317 | { | ||
318 | return EINA_FALSE; | ||
319 | } | ||
320 | |||
321 | /* module advertising code */ | ||
322 | static int | ||
323 | module_open(Evas_Module *em) | ||
324 | { | ||
325 | if (!em) return 0; | ||
326 | /* get whatever engine module we inherit from */ | ||
327 | if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0; | ||
328 | _evas_log_dom_module = eina_log_domain_register | ||
329 | ("evas-software_ddraw", EVAS_DEFAULT_LOG_COLOR); | ||
330 | if (_evas_log_dom_module < 0) | ||
331 | { | ||
332 | EINA_LOG_ERR("Can not create a module log domain."); | ||
333 | return 0; | ||
334 | } | ||
335 | /* store it for later use */ | ||
336 | func = pfunc; | ||
337 | /* now to override methods */ | ||
338 | #define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_) | ||
339 | ORD(info); | ||
340 | ORD(info_free); | ||
341 | ORD(setup); | ||
342 | ORD(canvas_alpha_get); | ||
343 | ORD(output_free); | ||
344 | ORD(output_resize); | ||
345 | ORD(output_tile_size_set); | ||
346 | ORD(output_redraws_rect_add); | ||
347 | ORD(output_redraws_rect_del); | ||
348 | ORD(output_redraws_clear); | ||
349 | ORD(output_redraws_next_update_get); | ||
350 | ORD(output_redraws_next_update_push); | ||
351 | ORD(output_flush); | ||
352 | ORD(output_idle_flush); | ||
353 | /* now advertise out own api */ | ||
354 | em->functions = (void *)(&func); | ||
355 | return 1; | ||
356 | } | ||
357 | |||
358 | static void | ||
359 | module_close(Evas_Module *em) | ||
360 | { | ||
361 | eina_log_domain_unregister(_evas_log_dom_module); | ||
362 | } | ||
363 | |||
364 | static Evas_Module_Api evas_modapi = | ||
365 | { | ||
366 | EVAS_MODULE_API_VERSION, | ||
367 | "software_ddraw", | ||
368 | "none", | ||
369 | { | ||
370 | module_open, | ||
371 | module_close | ||
372 | } | ||
373 | }; | ||
374 | |||
375 | EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, software_ddraw); | ||
376 | |||
377 | #ifndef EVAS_STATIC_BUILD_SOFTWARE_DDRAW | ||
378 | EVAS_EINA_MODULE_DEFINE(engine, software_ddraw); | ||
379 | #endif | ||