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_16/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_16/evas_engine.c')
-rw-r--r-- | libraries/evas/src/modules/engines/software_16/evas_engine.c | 399 |
1 files changed, 0 insertions, 399 deletions
diff --git a/libraries/evas/src/modules/engines/software_16/evas_engine.c b/libraries/evas/src/modules/engines/software_16/evas_engine.c deleted file mode 100644 index 643e24f..0000000 --- a/libraries/evas/src/modules/engines/software_16/evas_engine.c +++ /dev/null | |||
@@ -1,399 +0,0 @@ | |||
1 | #include "evas_common.h"/* Also includes international specific stuff */ | ||
2 | #include "evas_common_soft16.h" | ||
3 | |||
4 | /* | ||
5 | ***** | ||
6 | ** | ||
7 | ** ENGINE ROUTINES | ||
8 | ** | ||
9 | ***** | ||
10 | */ | ||
11 | int _evas_soft16_log_dom = -1; | ||
12 | /* function tables - filled in later (func and parent func) */ | ||
13 | static Evas_Func func, pfunc; | ||
14 | #ifdef ERR | ||
15 | #undef ERR | ||
16 | #endif | ||
17 | #define ERR(...) EINA_LOG_DOM_ERR( _evas_soft16_log_dom, __VA_ARGS__) | ||
18 | |||
19 | #ifdef DBG | ||
20 | #undef DBG | ||
21 | #endif | ||
22 | #define DBG(...) EINA_LOG_DOM_DBG(_evas_soft16_log_dom, __VA_ARGS__) | ||
23 | |||
24 | #ifdef INF | ||
25 | #undef INF | ||
26 | #endif | ||
27 | #define INF(...) EINA_LOG_DOM_INFO(_evas_soft16_log_dom, __VA_ARGS__) | ||
28 | |||
29 | #ifdef WRN | ||
30 | #undef WRN | ||
31 | #endif | ||
32 | #define WRN(...) EINA_LOG_DOM_WARN(_evas_soft16_log_dom, __VA_ARGS__) | ||
33 | |||
34 | #ifdef CRIT | ||
35 | #undef CRIT | ||
36 | #endif | ||
37 | #define CRIT(...) EINA_LOG_DOM_CRIT(_evas_soft16_log_dom, __VA_ARGS__) | ||
38 | |||
39 | #define NOT_IMPLEMENTED() \ | ||
40 | WRN("NOT_IMPLEMENTED: %s() at %s:%d", \ | ||
41 | __FUNCTION__, __FILE__, __LINE__) | ||
42 | |||
43 | static void | ||
44 | eng_rectangle_draw(void *data __UNUSED__, void *context, void *surface, int x, int y, int w, int h) | ||
45 | { | ||
46 | evas_common_soft16_rectangle_draw(surface, context, x, y, w, h); | ||
47 | } | ||
48 | |||
49 | static void | ||
50 | eng_line_draw(void *data __UNUSED__, void *context, void *surface, int x1, int y1, int x2, int y2) | ||
51 | { | ||
52 | evas_common_soft16_line_draw(surface, context, x1, y1, x2, y2); | ||
53 | } | ||
54 | |||
55 | static void | ||
56 | eng_polygon_draw(void *data __UNUSED__, void *context, void *surface, void *polygon, int x, int y) | ||
57 | { | ||
58 | evas_common_soft16_polygon_draw(surface, context, polygon, x, y); | ||
59 | } | ||
60 | |||
61 | static int | ||
62 | eng_image_alpha_get(void *data __UNUSED__, void *image) | ||
63 | { | ||
64 | Soft16_Image *im; | ||
65 | |||
66 | if (!image) return 0; | ||
67 | im = image; | ||
68 | return im->cache_entry.flags.alpha; | ||
69 | } | ||
70 | |||
71 | static void * | ||
72 | eng_image_alpha_set(void *data __UNUSED__, void *image, int have_alpha) | ||
73 | { | ||
74 | if (!image) return NULL; | ||
75 | have_alpha = !!have_alpha; | ||
76 | image = evas_common_soft16_image_alpha_set(image, have_alpha); | ||
77 | return image; | ||
78 | } | ||
79 | |||
80 | static char * | ||
81 | eng_image_comment_get(void *data __UNUSED__, void *image __UNUSED__, char *key __UNUSED__) | ||
82 | { | ||
83 | return NULL; | ||
84 | } | ||
85 | |||
86 | static char * | ||
87 | eng_image_format_get(void *data __UNUSED__, void *image __UNUSED__) | ||
88 | { | ||
89 | NOT_IMPLEMENTED(); | ||
90 | return NULL; | ||
91 | } | ||
92 | |||
93 | static int | ||
94 | eng_image_colorspace_get(void *data __UNUSED__, void *image __UNUSED__) | ||
95 | { | ||
96 | return EVAS_COLORSPACE_RGB565_A5P; | ||
97 | } | ||
98 | |||
99 | |||
100 | static void | ||
101 | eng_image_colorspace_set(void *data __UNUSED__, void *image __UNUSED__, int cspace __UNUSED__) | ||
102 | { | ||
103 | NOT_IMPLEMENTED(); | ||
104 | } | ||
105 | |||
106 | static void * | ||
107 | eng_image_native_set(void *data __UNUSED__, void *image __UNUSED__, void *native __UNUSED__) | ||
108 | { | ||
109 | NOT_IMPLEMENTED(); | ||
110 | return NULL; | ||
111 | } | ||
112 | |||
113 | static void * | ||
114 | eng_image_native_get(void *data __UNUSED__, void *image __UNUSED__) | ||
115 | { | ||
116 | NOT_IMPLEMENTED(); | ||
117 | return NULL; | ||
118 | } | ||
119 | |||
120 | static void * | ||
121 | eng_image_load(void *data __UNUSED__, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo) | ||
122 | { | ||
123 | return evas_cache_image_request(evas_common_soft16_image_cache_get(), file, key, lo, error); | ||
124 | } | ||
125 | |||
126 | static void * | ||
127 | eng_image_new_from_data(void *data __UNUSED__, int w, int h, DATA32 *image_data, int alpha, int cspace) | ||
128 | { | ||
129 | if ((image_data) && (cspace != EVAS_COLORSPACE_RGB565_A5P)) | ||
130 | { | ||
131 | WRN("Unsupported colorspace %d in %s() (%s:%d)", | ||
132 | cspace, __FUNCTION__, __FILE__, __LINE__); | ||
133 | return NULL; | ||
134 | } | ||
135 | return evas_cache_image_data(evas_common_soft16_image_cache_get(), w, h, image_data, alpha, EVAS_COLORSPACE_RGB565_A5P); | ||
136 | } | ||
137 | |||
138 | static void * | ||
139 | eng_image_new_from_copied_data(void *data __UNUSED__, int w, int h, DATA32 *image_data, int alpha, int cspace) | ||
140 | { | ||
141 | if ((image_data) && (cspace != EVAS_COLORSPACE_RGB565_A5P)) | ||
142 | { | ||
143 | WRN("Unsupported colorspace %d in %s() (%s:%d)", | ||
144 | cspace, __FUNCTION__, __FILE__, __LINE__); | ||
145 | return NULL; | ||
146 | } | ||
147 | return evas_cache_image_copied_data(evas_common_soft16_image_cache_get(), w, h, image_data, alpha, EVAS_COLORSPACE_RGB565_A5P); | ||
148 | } | ||
149 | |||
150 | static void | ||
151 | eng_image_size_get(void *data __UNUSED__, void *image, int *w, int *h) | ||
152 | { | ||
153 | Soft16_Image *im; | ||
154 | |||
155 | if (w) *w = 0; | ||
156 | if (h) *h = 0; | ||
157 | if (!image) return; | ||
158 | im = image; | ||
159 | if (w) *w = im->cache_entry.w; | ||
160 | if (h) *h = im->cache_entry.h; | ||
161 | } | ||
162 | |||
163 | static void * | ||
164 | eng_image_size_set(void *data __UNUSED__, void *image, int w, int h) | ||
165 | { | ||
166 | if (!image) return NULL; | ||
167 | if ((w <= 0) || (h <= 0)) | ||
168 | { | ||
169 | evas_cache_image_drop((Image_Entry *) image); | ||
170 | return NULL; | ||
171 | } | ||
172 | return evas_cache_image_size_set((Image_Entry *) image, w, h); | ||
173 | } | ||
174 | |||
175 | static void | ||
176 | eng_image_stride_get(void *data __UNUSED__, void *image, int *stride) | ||
177 | { | ||
178 | Soft16_Image *im; | ||
179 | |||
180 | if (stride) *stride = 0; | ||
181 | if (!image) return; | ||
182 | im = image; | ||
183 | if (stride) *stride = im->stride; | ||
184 | } | ||
185 | |||
186 | static void * | ||
187 | eng_image_dirty_region(void *data __UNUSED__, void *image, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) | ||
188 | { | ||
189 | /* FIXME: is this required? */ | ||
190 | //NOT_IMPLEMENTED(); | ||
191 | return image; | ||
192 | } | ||
193 | |||
194 | static void * | ||
195 | eng_image_data_get(void *data __UNUSED__, void *image, int to_write, DATA32 **image_data, int *err) | ||
196 | { | ||
197 | Soft16_Image *im; | ||
198 | int error; | ||
199 | |||
200 | if (!image) | ||
201 | { | ||
202 | *image_data = NULL; | ||
203 | return NULL; | ||
204 | } | ||
205 | |||
206 | im = image; | ||
207 | error = evas_cache_image_load_data(&im->cache_entry); | ||
208 | |||
209 | if (to_write) | ||
210 | im = (Soft16_Image *) evas_cache_image_alone(&im->cache_entry); | ||
211 | |||
212 | if (image_data) *image_data = (DATA32 *) im->pixels; | ||
213 | |||
214 | if (err) *err = error; | ||
215 | return im; | ||
216 | } | ||
217 | |||
218 | static void * | ||
219 | eng_image_data_put(void *data __UNUSED__, void *image, DATA32 *image_data) | ||
220 | { | ||
221 | Soft16_Image *old_im, *new_im; | ||
222 | |||
223 | if (!image) return NULL; | ||
224 | |||
225 | old_im = image; | ||
226 | if ((DATA16 *)image_data == old_im->pixels) return old_im; | ||
227 | |||
228 | new_im = (Soft16_Image *) evas_cache_image_data(evas_common_soft16_image_cache_get(), old_im->cache_entry.w, old_im->cache_entry.h, image_data, old_im->cache_entry.flags.alpha, EVAS_COLORSPACE_RGB565_A5P); | ||
229 | evas_cache_image_drop(&old_im->cache_entry); | ||
230 | return new_im; | ||
231 | } | ||
232 | |||
233 | static void | ||
234 | eng_image_data_preload_request(void *data __UNUSED__, void *image, const void *target) | ||
235 | { | ||
236 | Soft16_Image *im = image; | ||
237 | |||
238 | if (!im) return ; | ||
239 | evas_cache_image_preload_data(&im->cache_entry, target); | ||
240 | } | ||
241 | |||
242 | static void | ||
243 | eng_image_data_preload_cancel(void *data __UNUSED__, void *image, const void *target) | ||
244 | { | ||
245 | Soft16_Image *im = image; | ||
246 | |||
247 | if (!im) return ; | ||
248 | evas_cache_image_preload_cancel(&im->cache_entry, target); | ||
249 | } | ||
250 | |||
251 | static void | ||
252 | eng_image_draw(void *data __UNUSED__, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth) | ||
253 | { | ||
254 | Soft16_Image *im; | ||
255 | |||
256 | im = (Soft16_Image *) image; | ||
257 | |||
258 | evas_cache_image_load_data(&im->cache_entry); | ||
259 | evas_common_soft16_image_draw(im, surface, context, | ||
260 | src_x, src_y, src_w, src_h, | ||
261 | dst_x, dst_y, dst_w, dst_h, | ||
262 | smooth); | ||
263 | } | ||
264 | |||
265 | static void | ||
266 | eng_image_scale_hint_set(void *data __UNUSED__, void *image __UNUSED__, int hint __UNUSED__) | ||
267 | { | ||
268 | } | ||
269 | |||
270 | static int | ||
271 | eng_image_scale_hint_get(void *data __UNUSED__, void *image __UNUSED__) | ||
272 | { | ||
273 | return EVAS_IMAGE_SCALE_HINT_NONE; | ||
274 | } | ||
275 | |||
276 | static void | ||
277 | eng_image_cache_flush(void *data __UNUSED__) | ||
278 | { | ||
279 | evas_cache_image_flush(evas_common_soft16_image_cache_get()); | ||
280 | } | ||
281 | |||
282 | static void | ||
283 | eng_image_cache_set(void *data __UNUSED__, int bytes) | ||
284 | { | ||
285 | evas_cache_image_set(evas_common_soft16_image_cache_get(), bytes); | ||
286 | } | ||
287 | |||
288 | static int | ||
289 | eng_image_cache_get(void *data __UNUSED__) | ||
290 | { | ||
291 | return evas_cache_image_get(evas_common_soft16_image_cache_get()); | ||
292 | } | ||
293 | |||
294 | static void | ||
295 | eng_font_draw(void *data __UNUSED__, void *context, void *surface, Evas_Font_Set *font, int x, int y, int w __UNUSED__, int h __UNUSED__, int ow __UNUSED__, int oh __UNUSED__, const Evas_Text_Props *text_props) | ||
296 | { | ||
297 | static RGBA_Image *im = NULL; | ||
298 | Soft16_Image *dst = surface; | ||
299 | |||
300 | if (!im) | ||
301 | im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get()); | ||
302 | evas_cache_image_surface_alloc(&im->cache_entry, dst->cache_entry.w, dst->cache_entry.h); | ||
303 | evas_common_draw_context_font_ext_set(context, | ||
304 | surface, | ||
305 | evas_common_soft16_font_glyph_new, | ||
306 | evas_common_soft16_font_glyph_free, | ||
307 | evas_common_soft16_font_glyph_draw); | ||
308 | evas_common_font_draw(im, context, (RGBA_Font *) font, x, y, text_props); | ||
309 | evas_common_draw_context_font_ext_set(context, | ||
310 | NULL, | ||
311 | NULL, | ||
312 | NULL, | ||
313 | NULL); | ||
314 | } | ||
315 | |||
316 | /* | ||
317 | ***** | ||
318 | ** | ||
319 | ** MODULE ACCESSIBLE API API | ||
320 | ** | ||
321 | ***** | ||
322 | */ | ||
323 | |||
324 | static int | ||
325 | module_open(Evas_Module *em) | ||
326 | { | ||
327 | if (!em) return 0; | ||
328 | if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0; | ||
329 | _evas_soft16_log_dom = eina_log_domain_register | ||
330 | ("evas-software_16", EVAS_DEFAULT_LOG_COLOR); | ||
331 | if (_evas_soft16_log_dom < 0) | ||
332 | { | ||
333 | EINA_LOG_ERR("Can not create a module log domain."); | ||
334 | return 0; | ||
335 | } | ||
336 | /* store it for later use */ | ||
337 | func = pfunc; | ||
338 | /* now to override methods */ | ||
339 | EVAS_API_RESET(info, &func); | ||
340 | EVAS_API_RESET(info_free, &func); | ||
341 | EVAS_API_RESET(setup, &func); | ||
342 | #define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_) | ||
343 | ORD(rectangle_draw); | ||
344 | ORD(line_draw); | ||
345 | ORD(polygon_draw); | ||
346 | ORD(image_load); | ||
347 | ORD(image_new_from_data); | ||
348 | ORD(image_new_from_copied_data); | ||
349 | ORD(image_size_get); | ||
350 | ORD(image_size_set); | ||
351 | ORD(image_stride_get); | ||
352 | ORD(image_dirty_region); | ||
353 | ORD(image_data_get); | ||
354 | ORD(image_data_put); | ||
355 | ORD(image_data_preload_request); | ||
356 | ORD(image_data_preload_cancel); | ||
357 | ORD(image_alpha_set); | ||
358 | ORD(image_alpha_get); | ||
359 | ORD(image_draw); | ||
360 | ORD(image_comment_get); | ||
361 | ORD(image_format_get); | ||
362 | ORD(image_colorspace_set); | ||
363 | ORD(image_colorspace_get); | ||
364 | ORD(image_native_set); | ||
365 | ORD(image_native_get); | ||
366 | ORD(image_cache_flush); | ||
367 | ORD(image_cache_set); | ||
368 | ORD(image_cache_get); | ||
369 | ORD(font_draw); | ||
370 | ORD(image_scale_hint_set); | ||
371 | ORD(image_scale_hint_get); | ||
372 | |||
373 | em->functions = (void *)(&func); | ||
374 | |||
375 | return 1; | ||
376 | } | ||
377 | |||
378 | static void | ||
379 | module_close(Evas_Module *em __UNUSED__) | ||
380 | { | ||
381 | eina_log_domain_unregister(_evas_soft16_log_dom); | ||
382 | } | ||
383 | |||
384 | static Evas_Module_Api evas_modapi = | ||
385 | { | ||
386 | EVAS_MODULE_API_VERSION, | ||
387 | "software_16", | ||
388 | "none", | ||
389 | { | ||
390 | module_open, | ||
391 | module_close | ||
392 | } | ||
393 | }; | ||
394 | |||
395 | EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, software_16); | ||
396 | |||
397 | #ifndef EVAS_STATIC_BUILD_SOFTWARE_16 | ||
398 | EVAS_EINA_MODULE_DEFINE(engine, software_16); | ||
399 | #endif | ||