summaryrefslogtreecommitdiff
path: root/src/bin/evas/evas_cserve2_scale.c
diff options
context:
space:
mode:
authorPaulo Alcantara <pcacjr@profusion.mobi>2012-11-27 18:23:25 +0000
committerIván Briano <sachieru@gmail.com>2012-11-27 18:23:25 +0000
commitf8f79f8599da9166e29a31abaf9c5169bf3f6691 (patch)
tree683ad886b1a8141f367cea231de35f79fe95e249 /src/bin/evas/evas_cserve2_scale.c
parent8ac3152e898668a8354d9fd3afada89484ac575b (diff)
evas/cserve2: Add scalecache support
Signed-off-by: Paulo Alcantara <pcacjr@profusion.mobi> Patch by: Paulo Alcantara <pcacjr@profusion.mobi> SVN revision: 79754
Diffstat (limited to 'src/bin/evas/evas_cserve2_scale.c')
-rw-r--r--src/bin/evas/evas_cserve2_scale.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/bin/evas/evas_cserve2_scale.c b/src/bin/evas/evas_cserve2_scale.c
new file mode 100644
index 0000000000..c9863322a3
--- /dev/null
+++ b/src/bin/evas/evas_cserve2_scale.c
@@ -0,0 +1,61 @@
1#include "evas_common.h"
2#include "evas_private.h"
3
4void
5cserve2_scale_init(void)
6{
7 evas_common_cpu_init();
8 evas_common_blend_init();
9 evas_common_image_init();
10 evas_common_convert_init();
11 evas_common_scale_init();
12}
13
14void
15cserve2_scale_shutdown(void)
16{
17 evas_common_image_shutdown();
18}
19
20static inline void
21_cserve2_rgba_image_set(RGBA_Image *im, void *data, int w, int h, int alpha)
22{
23 memset(im, 0, sizeof *im);
24
25 im->ref = 1;
26 im->cache_entry.w = w;
27 im->cache_entry.h = h;
28 im->cache_entry.space = EVAS_COLORSPACE_ARGB8888;
29 im->cache_entry.flags.alpha = alpha;
30 im->image.data = data;
31 im->cache_entry.allocated.w = w;
32 im->cache_entry.allocated.h = h;
33}
34
35void
36cserve2_rgba_image_scale_do(void *src_data, void *dst_data,
37 int src_x, int src_y, int src_w, int src_h,
38 int dst_x, int dst_y, int dst_w, int dst_h,
39 int alpha, int smooth)
40{
41 RGBA_Image src, dst;
42 RGBA_Draw_Context ct;
43
44 _cserve2_rgba_image_set(&src, src_data, src_w, src_h, alpha);
45
46 _cserve2_rgba_image_set(&dst, dst_data, dst_w, dst_h, alpha);
47 dst.flags = RGBA_IMAGE_NOTHING;
48
49 memset(&ct, 0, sizeof(ct));
50 ct.sli.h = 1;
51 ct.render_op = _EVAS_RENDER_COPY;
52
53 if (smooth)
54 evas_common_scale_rgba_in_to_out_clip_smooth(&src, &dst, &ct,
55 src_x, src_y, src_w, src_h,
56 dst_x, dst_y, dst_w, dst_h);
57 else
58 evas_common_scale_rgba_in_to_out_clip_sample(&src, &dst, &ct,
59 src_x, src_y, src_w, src_h,
60 dst_x, dst_y, dst_w, dst_h);
61}