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