From 825a3d837a33f226c879cd02ad15c3fba57e8b2c Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 23 Jan 2012 23:30:42 +1000 Subject: Update the EFL to what I'm actually using, coz I'm using some stuff not yet released. --- .../src/modules/engines/wayland_shm/evas_outbuf.c | 100 +++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 libraries/evas/src/modules/engines/wayland_shm/evas_outbuf.c (limited to 'libraries/evas/src/modules/engines/wayland_shm/evas_outbuf.c') 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 @@ +#include "evas_common.h" +#include "evas_engine.h" + +void +evas_outbuf_free(Outbuf *ob) +{ + if (!ob) return; + if (ob->priv.buffer) evas_cache_image_drop(&ob->priv.buffer->cache_entry); + free(ob); +} + +void +evas_outbuf_resize(Outbuf *ob, int w, int h) +{ + if (!ob) return; + if ((ob->w == w) && (ob->h == h)) return; + ob->w = w; + ob->h = h; + if (ob->priv.buffer) evas_cache_image_drop(&ob->priv.buffer->cache_entry); + ob->priv.buffer = NULL; +} + +Outbuf * +evas_outbuf_setup(int w, int h, int rot, void *dest) +{ + Outbuf *ob = NULL; + + if (!(ob = calloc(1, sizeof(Outbuf)))) return NULL; + + ob->w = w; + ob->h = h; + ob->rotation = rot; + ob->priv.dest = dest; + + ob->priv.buffer = + (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), + w, h, ob->priv.dest, + 1, EVAS_COLORSPACE_ARGB8888); + + return ob; +} + +RGBA_Image * +evas_outbuf_new_region_for_update(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch) +{ + if (ob->priv.buffer) + { + *cx = x; *cy = y; *cw = w; *ch = h; + return ob->priv.buffer; + } + else + { + RGBA_Image *im; + + *cx = 0; *cy = 0; *cw = w; *ch = h; + im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); + if (im) + { + im->cache_entry.flags.alpha = 1; + im = (RGBA_Image *)evas_cache_image_size_set(&im->cache_entry, w, h); + } + + return im; + } + + return NULL; +} + +void +evas_outbuf_push_updated_region(Outbuf *ob, RGBA_Image *update, int x __UNUSED__, int y, int w, int h) +{ + if (!ob->priv.dest) return; + if (!ob->priv.buffer) + { + Gfx_Func_Copy func; + + func = evas_common_draw_func_copy_get(w, 0); + if (func) + { + DATA32 *dst, *src; + int yy = 0, bytes = 0; + + bytes = ((w * sizeof(int)) * h); + for (yy = 0; yy < h; yy++) + { + src = update->image.data + (yy * update->cache_entry.w); + dst = (DATA32 *)((DATA8 *)(ob->priv.dest) + + ((y + yy) * bytes)); + func(src, dst, w); + } + } + } +} + +void +evas_outbuf_free_region_for_update(Outbuf *ob, RGBA_Image *update) +{ + if (!ob) return; + if (update != ob->priv.buffer) evas_cache_image_drop(&update->cache_entry); +} -- cgit v1.1