diff options
author | David Walter Seikel | 2012-01-23 23:30:42 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-23 23:30:42 +1000 |
commit | 825a3d837a33f226c879cd02ad15c3fba57e8b2c (patch) | |
tree | 75f57bd9c4253508d338dc79ba8e57a7abc42255 /libraries/evas/src/modules/engines/wayland_shm/evas_outbuf.c | |
parent | Add ability to disable the test harness, or the Lua compile test. (diff) | |
download | SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.zip SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.gz SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.bz2 SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.xz |
Update the EFL to what I'm actually using, coz I'm using some stuff not yet released.
Diffstat (limited to 'libraries/evas/src/modules/engines/wayland_shm/evas_outbuf.c')
-rw-r--r-- | libraries/evas/src/modules/engines/wayland_shm/evas_outbuf.c | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/libraries/evas/src/modules/engines/wayland_shm/evas_outbuf.c b/libraries/evas/src/modules/engines/wayland_shm/evas_outbuf.c new file mode 100644 index 0000000..490a978 --- /dev/null +++ b/libraries/evas/src/modules/engines/wayland_shm/evas_outbuf.c | |||
@@ -0,0 +1,100 @@ | |||
1 | #include "evas_common.h" | ||
2 | #include "evas_engine.h" | ||
3 | |||
4 | void | ||
5 | evas_outbuf_free(Outbuf *ob) | ||
6 | { | ||
7 | if (!ob) return; | ||
8 | if (ob->priv.buffer) evas_cache_image_drop(&ob->priv.buffer->cache_entry); | ||
9 | free(ob); | ||
10 | } | ||
11 | |||
12 | void | ||
13 | evas_outbuf_resize(Outbuf *ob, int w, int h) | ||
14 | { | ||
15 | if (!ob) return; | ||
16 | if ((ob->w == w) && (ob->h == h)) return; | ||
17 | ob->w = w; | ||
18 | ob->h = h; | ||
19 | if (ob->priv.buffer) evas_cache_image_drop(&ob->priv.buffer->cache_entry); | ||
20 | ob->priv.buffer = NULL; | ||
21 | } | ||
22 | |||
23 | Outbuf * | ||
24 | evas_outbuf_setup(int w, int h, int rot, void *dest) | ||
25 | { | ||
26 | Outbuf *ob = NULL; | ||
27 | |||
28 | if (!(ob = calloc(1, sizeof(Outbuf)))) return NULL; | ||
29 | |||
30 | ob->w = w; | ||
31 | ob->h = h; | ||
32 | ob->rotation = rot; | ||
33 | ob->priv.dest = dest; | ||
34 | |||
35 | ob->priv.buffer = | ||
36 | (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), | ||
37 | w, h, ob->priv.dest, | ||
38 | 1, EVAS_COLORSPACE_ARGB8888); | ||
39 | |||
40 | return ob; | ||
41 | } | ||
42 | |||
43 | RGBA_Image * | ||
44 | evas_outbuf_new_region_for_update(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch) | ||
45 | { | ||
46 | if (ob->priv.buffer) | ||
47 | { | ||
48 | *cx = x; *cy = y; *cw = w; *ch = h; | ||
49 | return ob->priv.buffer; | ||
50 | } | ||
51 | else | ||
52 | { | ||
53 | RGBA_Image *im; | ||
54 | |||
55 | *cx = 0; *cy = 0; *cw = w; *ch = h; | ||
56 | im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); | ||
57 | if (im) | ||
58 | { | ||
59 | im->cache_entry.flags.alpha = 1; | ||
60 | im = (RGBA_Image *)evas_cache_image_size_set(&im->cache_entry, w, h); | ||
61 | } | ||
62 | |||
63 | return im; | ||
64 | } | ||
65 | |||
66 | return NULL; | ||
67 | } | ||
68 | |||
69 | void | ||
70 | evas_outbuf_push_updated_region(Outbuf *ob, RGBA_Image *update, int x __UNUSED__, int y, int w, int h) | ||
71 | { | ||
72 | if (!ob->priv.dest) return; | ||
73 | if (!ob->priv.buffer) | ||
74 | { | ||
75 | Gfx_Func_Copy func; | ||
76 | |||
77 | func = evas_common_draw_func_copy_get(w, 0); | ||
78 | if (func) | ||
79 | { | ||
80 | DATA32 *dst, *src; | ||
81 | int yy = 0, bytes = 0; | ||
82 | |||
83 | bytes = ((w * sizeof(int)) * h); | ||
84 | for (yy = 0; yy < h; yy++) | ||
85 | { | ||
86 | src = update->image.data + (yy * update->cache_entry.w); | ||
87 | dst = (DATA32 *)((DATA8 *)(ob->priv.dest) + | ||
88 | ((y + yy) * bytes)); | ||
89 | func(src, dst, w); | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | |||
95 | void | ||
96 | evas_outbuf_free_region_for_update(Outbuf *ob, RGBA_Image *update) | ||
97 | { | ||
98 | if (!ob) return; | ||
99 | if (update != ob->priv.buffer) evas_cache_image_drop(&update->cache_entry); | ||
100 | } | ||