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/fb/evas_outbuf.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 '')
-rw-r--r-- | libraries/evas/src/modules/engines/fb/evas_outbuf.c | 402 |
1 files changed, 0 insertions, 402 deletions
diff --git a/libraries/evas/src/modules/engines/fb/evas_outbuf.c b/libraries/evas/src/modules/engines/fb/evas_outbuf.c deleted file mode 100644 index 7ae24c5..0000000 --- a/libraries/evas/src/modules/engines/fb/evas_outbuf.c +++ /dev/null | |||
@@ -1,402 +0,0 @@ | |||
1 | #include "evas_common.h" | ||
2 | #include "evas_engine.h" | ||
3 | #include <sys/time.h> | ||
4 | #include <sys/utsname.h> | ||
5 | |||
6 | void | ||
7 | evas_fb_outbuf_fb_init(void) | ||
8 | { | ||
9 | } | ||
10 | |||
11 | void | ||
12 | evas_fb_outbuf_fb_free(Outbuf *buf) | ||
13 | { | ||
14 | /* FIXME: implement */ | ||
15 | WRN("destroying fb info.. not implemented!!!! WARNING. LEAK!"); | ||
16 | if (buf->priv.back_buf) | ||
17 | evas_cache_image_drop(&buf->priv.back_buf->cache_entry); | ||
18 | free(buf); | ||
19 | } | ||
20 | |||
21 | Outbuf * | ||
22 | evas_fb_outbuf_fb_setup_fb(int w, int h, int rot, Outbuf_Depth depth, int vt_no, int dev_no, int refresh) | ||
23 | { | ||
24 | /* create outbuf struct */ | ||
25 | /* setup window and/or fb */ | ||
26 | /* if (dithered) create backbuf */ | ||
27 | Outbuf *buf; | ||
28 | int fb_fd; | ||
29 | int fb_depth; | ||
30 | |||
31 | fb_depth = -1; | ||
32 | if (depth == OUTBUF_DEPTH_RGB_16BPP_565_565_DITHERED) fb_depth = 16; | ||
33 | else if (depth == OUTBUF_DEPTH_RGB_16BPP_555_555_DITHERED) fb_depth = 15; | ||
34 | else if (depth == OUTBUF_DEPTH_RGB_16BPP_565_444_DITHERED) fb_depth = 16; | ||
35 | else if (depth == OUTBUF_DEPTH_RGB_16BPP_444_444_DITHERED) fb_depth = 12; | ||
36 | else if (depth == OUTBUF_DEPTH_RGB_32BPP_888_8888) fb_depth = 32; | ||
37 | else if (depth == OUTBUF_DEPTH_INHERIT) fb_depth = 0; | ||
38 | buf = calloc(1, sizeof(Outbuf)); | ||
39 | if (!buf) | ||
40 | return NULL; | ||
41 | |||
42 | fb_init(vt_no, dev_no); | ||
43 | if (rot == 0 || rot == 180) | ||
44 | buf->priv.fb.fb = fb_setmode(w, h, fb_depth, refresh); | ||
45 | else if (rot == 90 || rot == 270) | ||
46 | buf->priv.fb.fb = fb_setmode(h, w, fb_depth, refresh); | ||
47 | if (!buf->priv.fb.fb) buf->priv.fb.fb = fb_getmode(); | ||
48 | if (!buf->priv.fb.fb) | ||
49 | { | ||
50 | free(buf); | ||
51 | return NULL; | ||
52 | } | ||
53 | fb_fd = fb_postinit(buf->priv.fb.fb); | ||
54 | if (fb_fd < 1) | ||
55 | { | ||
56 | free(buf); | ||
57 | return NULL; | ||
58 | } | ||
59 | |||
60 | if (rot == 0 || rot == 180) | ||
61 | { | ||
62 | buf->w = buf->priv.fb.fb->width; | ||
63 | buf->h = buf->priv.fb.fb->height; | ||
64 | } | ||
65 | else if (rot == 90 || rot == 270) | ||
66 | { | ||
67 | buf->w = buf->priv.fb.fb->height; | ||
68 | buf->h = buf->priv.fb.fb->width; | ||
69 | } | ||
70 | |||
71 | buf->depth = depth; | ||
72 | buf->rot = rot; | ||
73 | |||
74 | { | ||
75 | Gfx_Func_Convert conv_func; | ||
76 | int i; | ||
77 | |||
78 | buf->priv.mask.r = 0; | ||
79 | for (i = 0; i < (int)buf->priv.fb.fb->fb_var.red.length; i++) | ||
80 | buf->priv.mask.r |= (1 << (buf->priv.fb.fb->fb_var.red.offset + i)); | ||
81 | buf->priv.mask.g = 0; | ||
82 | for (i = 0; i < (int)buf->priv.fb.fb->fb_var.green.length; i++) | ||
83 | buf->priv.mask.g |= (1 << (buf->priv.fb.fb->fb_var.green.offset + i)); | ||
84 | buf->priv.mask.b = 0; | ||
85 | for (i = 0; i < (int)buf->priv.fb.fb->fb_var.blue.length; i++) | ||
86 | buf->priv.mask.b |= (1 << (buf->priv.fb.fb->fb_var.blue.offset + i)); | ||
87 | |||
88 | conv_func = NULL; | ||
89 | if (buf->rot == 0 || buf->rot == 180) | ||
90 | conv_func = evas_common_convert_func_get(0, buf->w, buf->h, | ||
91 | buf->priv.fb.fb->fb_var.bits_per_pixel, | ||
92 | buf->priv.mask.r, | ||
93 | buf->priv.mask.g, | ||
94 | buf->priv.mask.b, | ||
95 | PAL_MODE_NONE, | ||
96 | buf->rot); | ||
97 | else if (buf->rot == 90 || buf->rot == 270) | ||
98 | conv_func = evas_common_convert_func_get(0, buf->h, buf->w, | ||
99 | buf->priv.fb.fb->fb_var.bits_per_pixel, | ||
100 | buf->priv.mask.r, | ||
101 | buf->priv.mask.g, | ||
102 | buf->priv.mask.b, | ||
103 | PAL_MODE_NONE, | ||
104 | buf->rot); | ||
105 | if (!conv_func) | ||
106 | { | ||
107 | free(buf); | ||
108 | return NULL; | ||
109 | } | ||
110 | } | ||
111 | // if (buf->priv.fb.fb->fb_var.bits_per_pixel < 24) | ||
112 | // buf->priv.back_buf = evas_common_image_create(buf->w, buf->h); | ||
113 | |||
114 | return buf; | ||
115 | } | ||
116 | |||
117 | void | ||
118 | evas_fb_outbuf_fb_blit(Outbuf *buf, int src_x, int src_y, int w, int h, int dst_x, int dst_y) | ||
119 | { | ||
120 | if (buf->priv.back_buf) | ||
121 | { | ||
122 | evas_common_blit_rectangle(buf->priv.back_buf, buf->priv.back_buf, | ||
123 | src_x, src_y, w, h, dst_x, dst_y); | ||
124 | evas_fb_outbuf_fb_update(buf, dst_x, dst_y, w, h); | ||
125 | } | ||
126 | else | ||
127 | { | ||
128 | if (buf->priv.fb.fb) | ||
129 | { | ||
130 | /* FIXME: need to implement an fb call for "copy area" */ | ||
131 | } | ||
132 | } | ||
133 | } | ||
134 | |||
135 | void | ||
136 | evas_fb_outbuf_fb_update(Outbuf *buf, int x, int y, int w, int h) | ||
137 | { | ||
138 | if (!(buf->priv.back_buf)) return; | ||
139 | if (buf->priv.fb.fb) | ||
140 | { | ||
141 | Gfx_Func_Convert conv_func; | ||
142 | DATA8 *data; | ||
143 | |||
144 | data = NULL; | ||
145 | conv_func = NULL; | ||
146 | if (buf->rot == 0) | ||
147 | { | ||
148 | data = (DATA8 *)buf->priv.fb.fb->mem + buf->priv.fb.fb->mem_offset + | ||
149 | buf->priv.fb.fb->bpp * | ||
150 | (x + (y * buf->priv.fb.fb->width)); | ||
151 | conv_func = evas_common_convert_func_get(data, w, h, buf->priv.fb.fb->fb_var.bits_per_pixel, | ||
152 | buf->priv.mask.r, buf->priv.mask.g, | ||
153 | buf->priv.mask.b, PAL_MODE_NONE, | ||
154 | buf->rot); | ||
155 | } | ||
156 | else if (buf->rot == 180) | ||
157 | { | ||
158 | data = (DATA8 *)buf->priv.fb.fb->mem + buf->priv.fb.fb->mem_offset + | ||
159 | buf->priv.fb.fb->bpp * | ||
160 | (buf->w - x - w + ((buf->h - y - h) * buf->priv.fb.fb->width)); | ||
161 | conv_func = evas_common_convert_func_get(data, w, h, buf->priv.fb.fb->fb_var.bits_per_pixel, | ||
162 | buf->priv.mask.r, buf->priv.mask.g, | ||
163 | buf->priv.mask.b, PAL_MODE_NONE, | ||
164 | buf->rot); | ||
165 | } | ||
166 | else if (buf->rot == 270) | ||
167 | { | ||
168 | data = (DATA8 *)buf->priv.fb.fb->mem + buf->priv.fb.fb->mem_offset + | ||
169 | buf->priv.fb.fb->bpp * | ||
170 | (buf->h - y - h + (x * buf->priv.fb.fb->width)); | ||
171 | conv_func = evas_common_convert_func_get(data, h, w, buf->priv.fb.fb->fb_var.bits_per_pixel, | ||
172 | buf->priv.mask.r, buf->priv.mask.g, | ||
173 | buf->priv.mask.b, PAL_MODE_NONE, | ||
174 | buf->rot); | ||
175 | } | ||
176 | else if (buf->rot == 90) | ||
177 | { | ||
178 | data = (DATA8 *)buf->priv.fb.fb->mem + buf->priv.fb.fb->mem_offset + | ||
179 | buf->priv.fb.fb->bpp * | ||
180 | (y + ((buf->w - x - w) * buf->priv.fb.fb->width)); | ||
181 | conv_func = evas_common_convert_func_get(data, h, w, buf->priv.fb.fb->fb_var.bits_per_pixel, | ||
182 | buf->priv.mask.r, buf->priv.mask.g, | ||
183 | buf->priv.mask.b, PAL_MODE_NONE, | ||
184 | buf->rot); | ||
185 | } | ||
186 | if (conv_func) | ||
187 | { | ||
188 | DATA32 *src_data; | ||
189 | |||
190 | src_data = buf->priv.back_buf->image.data + (y * buf->w) + x; | ||
191 | if (buf->rot == 0 || buf->rot == 180) | ||
192 | { | ||
193 | conv_func(src_data, data, | ||
194 | buf->w - w, | ||
195 | buf->priv.fb.fb->width - w, | ||
196 | w, h, | ||
197 | x, y, NULL); | ||
198 | } | ||
199 | else if (buf->rot == 90 || buf->rot == 270) | ||
200 | { | ||
201 | conv_func(src_data, data, | ||
202 | buf->w - w, | ||
203 | buf->priv.fb.fb->width - h, | ||
204 | h, w, | ||
205 | x, y, NULL); | ||
206 | } | ||
207 | } | ||
208 | } | ||
209 | } | ||
210 | |||
211 | RGBA_Image * | ||
212 | evas_fb_outbuf_fb_new_region_for_update(Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch) | ||
213 | { | ||
214 | if (buf->priv.back_buf) | ||
215 | { | ||
216 | *cx = x; *cy = y; *cw = w; *ch = h; | ||
217 | return buf->priv.back_buf; | ||
218 | } | ||
219 | else | ||
220 | { | ||
221 | RGBA_Image *im; | ||
222 | |||
223 | *cx = 0; *cy = 0; *cw = w; *ch = h; | ||
224 | im = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get()); | ||
225 | im->cache_entry.flags.alpha = 1; | ||
226 | im = (RGBA_Image *) evas_cache_image_size_set(&im->cache_entry, w, h); | ||
227 | |||
228 | return im; | ||
229 | } | ||
230 | return NULL; | ||
231 | } | ||
232 | |||
233 | void | ||
234 | evas_fb_outbuf_fb_free_region_for_update(Outbuf *buf, RGBA_Image *update) | ||
235 | { | ||
236 | if (update != buf->priv.back_buf) evas_cache_image_drop(&update->cache_entry); | ||
237 | } | ||
238 | |||
239 | void | ||
240 | evas_fb_outbuf_fb_push_updated_region(Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h) | ||
241 | { | ||
242 | if (!buf->priv.fb.fb) return; | ||
243 | if (buf->priv.back_buf) | ||
244 | { | ||
245 | if (update != buf->priv.back_buf) | ||
246 | evas_common_blit_rectangle(update, buf->priv.back_buf, | ||
247 | 0, 0, w, h, x, y); | ||
248 | evas_fb_outbuf_fb_update(buf, x, y, w, h); | ||
249 | } | ||
250 | else | ||
251 | { | ||
252 | Gfx_Func_Convert conv_func; | ||
253 | DATA8 *data; | ||
254 | |||
255 | data = NULL; | ||
256 | conv_func = NULL; | ||
257 | if (buf->rot == 0) | ||
258 | { | ||
259 | data = (DATA8 *)buf->priv.fb.fb->mem + | ||
260 | buf->priv.fb.fb->mem_offset + | ||
261 | buf->priv.fb.fb->bpp * | ||
262 | (x + (y * buf->priv.fb.fb->width)); | ||
263 | conv_func = evas_common_convert_func_get(data, w, h, | ||
264 | buf->priv.fb.fb->fb_var.bits_per_pixel, | ||
265 | buf->priv.mask.r, buf->priv.mask.g, | ||
266 | buf->priv.mask.b, PAL_MODE_NONE, | ||
267 | buf->rot); | ||
268 | } | ||
269 | else if (buf->rot == 180) | ||
270 | { | ||
271 | data = (DATA8 *)buf->priv.fb.fb->mem + | ||
272 | buf->priv.fb.fb->mem_offset + | ||
273 | buf->priv.fb.fb->bpp * | ||
274 | (buf->w - x - w + ((buf->h - y - h) * buf->priv.fb.fb->width)); | ||
275 | conv_func = evas_common_convert_func_get(data, w, h, | ||
276 | buf->priv.fb.fb->fb_var.bits_per_pixel, | ||
277 | buf->priv.mask.r, buf->priv.mask.g, | ||
278 | buf->priv.mask.b, PAL_MODE_NONE, | ||
279 | buf->rot); | ||
280 | } | ||
281 | else if (buf->rot == 270) | ||
282 | { | ||
283 | data = (DATA8 *)buf->priv.fb.fb->mem + | ||
284 | buf->priv.fb.fb->mem_offset + | ||
285 | buf->priv.fb.fb->bpp * | ||
286 | (buf->h - y - h + (x * buf->priv.fb.fb->width)); | ||
287 | conv_func = evas_common_convert_func_get(data, h, w, | ||
288 | buf->priv.fb.fb->fb_var.bits_per_pixel, | ||
289 | buf->priv.mask.r, buf->priv.mask.g, | ||
290 | buf->priv.mask.b, PAL_MODE_NONE, | ||
291 | buf->rot); | ||
292 | } | ||
293 | else if (buf->rot == 90) | ||
294 | { | ||
295 | data = (DATA8 *)buf->priv.fb.fb->mem + | ||
296 | buf->priv.fb.fb->mem_offset + | ||
297 | buf->priv.fb.fb->bpp * | ||
298 | (y + ((buf->w - x - w) * buf->priv.fb.fb->width)); | ||
299 | conv_func = evas_common_convert_func_get(data, h, w, | ||
300 | buf->priv.fb.fb->fb_var.bits_per_pixel, | ||
301 | buf->priv.mask.r, buf->priv.mask.g, | ||
302 | buf->priv.mask.b, PAL_MODE_NONE, | ||
303 | buf->rot); | ||
304 | } | ||
305 | if (conv_func) | ||
306 | { | ||
307 | DATA32 *src_data; | ||
308 | |||
309 | src_data = update->image.data; | ||
310 | if (buf->rot == 0 || buf->rot == 180) | ||
311 | { | ||
312 | conv_func(src_data, data, | ||
313 | 0, | ||
314 | buf->priv.fb.fb->width - w, | ||
315 | w, h, | ||
316 | x, y, NULL); | ||
317 | } | ||
318 | else if (buf->rot == 90 || buf->rot == 270) | ||
319 | { | ||
320 | conv_func(src_data, data, | ||
321 | 0, | ||
322 | buf->priv.fb.fb->width - h, | ||
323 | h, w, | ||
324 | x, y, NULL); | ||
325 | } | ||
326 | } | ||
327 | } | ||
328 | } | ||
329 | |||
330 | void | ||
331 | evas_fb_outbuf_fb_reconfigure(Outbuf *buf, int w, int h, int rot, Outbuf_Depth depth) | ||
332 | { | ||
333 | if ((w == buf->w) && (h == buf->h) && | ||
334 | (rot == buf->rot) && (depth == buf->depth)) | ||
335 | return; | ||
336 | if (buf->priv.back_buf) | ||
337 | { | ||
338 | evas_cache_image_drop(&buf->priv.back_buf->cache_entry); | ||
339 | buf->priv.back_buf = NULL; | ||
340 | } | ||
341 | if (buf->priv.fb.fb) | ||
342 | { | ||
343 | /* FIXME: implement this */ | ||
344 | } | ||
345 | /* if backbuf delet it */ | ||
346 | /* resize window or reset fb mode */ | ||
347 | /* if (dithered) create new backbuf */ | ||
348 | } | ||
349 | |||
350 | int | ||
351 | evas_fb_outbuf_fb_get_width(Outbuf *buf) | ||
352 | { | ||
353 | return buf->w; | ||
354 | } | ||
355 | |||
356 | int | ||
357 | evas_fb_outbuf_fb_get_height(Outbuf *buf) | ||
358 | { | ||
359 | return buf->h; | ||
360 | } | ||
361 | |||
362 | Outbuf_Depth | ||
363 | evas_fb_outbuf_fb_get_depth(Outbuf *buf) | ||
364 | { | ||
365 | return buf->depth; | ||
366 | } | ||
367 | |||
368 | int | ||
369 | evas_fb_outbuf_fb_get_rot(Outbuf *buf) | ||
370 | { | ||
371 | return buf->rot; | ||
372 | } | ||
373 | |||
374 | int | ||
375 | evas_fb_outbuf_fb_get_have_backbuf(Outbuf *buf) | ||
376 | { | ||
377 | if (buf->priv.back_buf) return 1; | ||
378 | return 0; | ||
379 | } | ||
380 | |||
381 | void | ||
382 | evas_fb_outbuf_fb_set_have_backbuf(Outbuf *buf, int have_backbuf) | ||
383 | { | ||
384 | if (buf->priv.back_buf) | ||
385 | { | ||
386 | if (have_backbuf) return; | ||
387 | evas_cache_image_drop(&buf->priv.back_buf->cache_entry); | ||
388 | buf->priv.back_buf = NULL; | ||
389 | } | ||
390 | else | ||
391 | { | ||
392 | if (!have_backbuf) return; | ||
393 | if (buf->priv.fb.fb) | ||
394 | { | ||
395 | if (buf->priv.fb.fb->fb_var.bits_per_pixel < 24) | ||
396 | { | ||
397 | buf->priv.back_buf = (RGBA_Image *) evas_cache_image_empty(evas_common_image_cache_get()); | ||
398 | buf->priv.back_buf = (RGBA_Image *) evas_cache_image_size_set(&buf->priv.back_buf->cache_entry, buf->w, buf->h); | ||
399 | } | ||
400 | } | ||
401 | } | ||
402 | } | ||