summaryrefslogtreecommitdiff
path: root/src/lib/evas/common
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-12-03 15:29:32 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-12-03 18:42:50 +0900
commitb5500a864434f53240cb774c92731341b21ff3ad (patch)
tree4135624f595ef8133280335ab1e28432444a380f /src/lib/evas/common
parent4bcea3eada67332b61e175adabbcbe6dd07563f8 (diff)
Evas: Move alpha functions to static_libs/draw
This is a pretty simple code refactor, moving pixel handling to the new draw lib.
Diffstat (limited to 'src/lib/evas/common')
-rw-r--r--src/lib/evas/common/evas_alpha_main.c81
-rw-r--r--src/lib/evas/common/evas_blend_private.h4
-rw-r--r--src/lib/evas/common/evas_font_compress.c3
3 files changed, 2 insertions, 86 deletions
diff --git a/src/lib/evas/common/evas_alpha_main.c b/src/lib/evas/common/evas_alpha_main.c
deleted file mode 100644
index 74bc75b..0000000
--- a/src/lib/evas/common/evas_alpha_main.c
+++ /dev/null
@@ -1,81 +0,0 @@
1#include "evas_common_private.h"
2#include "evas_blend_private.h"
3
4/** default op: d = d*(1-sa) + s */
5static void
6_alpha_func_blend(DATA8 *src, DATA8 *dst, int len)
7{
8 int k;
9
10 EINA_SAFETY_ON_NULL_RETURN(src);
11 EINA_SAFETY_ON_NULL_RETURN(dst);
12
13 for (k = len; k; k--)
14 {
15 int val = (*dst * (255 - *src)) / 255 + *src;
16 *dst++ = val;
17 src++;
18 }
19}
20
21/** d = s */
22static void
23_alpha_func_copy(DATA8 *src, DATA8 *dst, int len)
24{
25 EINA_SAFETY_ON_NULL_RETURN(src);
26 EINA_SAFETY_ON_NULL_RETURN(dst);
27
28 memcpy(dst, src, len);
29}
30
31/** d = d*s */
32static void
33_alpha_func_mul(DATA8 *src, DATA8 *dst, int len)
34{
35 int k;
36
37 EINA_SAFETY_ON_NULL_RETURN(src);
38 EINA_SAFETY_ON_NULL_RETURN(dst);
39
40 for (k = len; k; k--)
41 {
42 int val = (*dst * *src) / 255;
43 *dst++ = val;
44 src++;
45 }
46}
47
48
49#if 0
50// Reference ops. In case of alpha, s == sa.
51EVAS_RENDER_BLEND = 0, /**< default op: d = d*(1-sa) + s */
52EVAS_RENDER_BLEND_REL = 1, /**< d = d*(1 - sa) + s*da */
53EVAS_RENDER_COPY = 2, /**< d = s */
54EVAS_RENDER_COPY_REL = 3, /**< d = s*da */
55EVAS_RENDER_ADD = 4, /* d = d + s */
56EVAS_RENDER_ADD_REL = 5, /**< d = d + s*da */
57EVAS_RENDER_SUB = 6, /**< d = d - s */
58EVAS_RENDER_SUB_REL = 7, /* d = d - s*da */
59EVAS_RENDER_TINT = 8, /**< d = d*s + d*(1 - sa) + s*(1 - da) */
60EVAS_RENDER_TINT_REL = 9, /**< d = d*(1 - sa + s) */
61EVAS_RENDER_MASK = 10, /**< d = d*sa */
62EVAS_RENDER_MUL = 11, /**< d = d*s */
63#endif
64
65Alpha_Gfx_Func
66evas_common_alpha_func_get(int op)
67{
68 switch (op)
69 {
70 case EVAS_RENDER_BLEND:
71 return _alpha_func_blend;
72 case EVAS_RENDER_COPY:
73 return _alpha_func_copy;
74 case EVAS_RENDER_MASK:
75 case EVAS_RENDER_MUL:
76 return _alpha_func_mul;
77 default:
78 ERR("Not implemented yet.");
79 return NULL;
80 }
81}
diff --git a/src/lib/evas/common/evas_blend_private.h b/src/lib/evas/common/evas_blend_private.h
index f96e004..5b17993 100644
--- a/src/lib/evas/common/evas_blend_private.h
+++ b/src/lib/evas/common/evas_blend_private.h
@@ -27,8 +27,4 @@ RGBA_Gfx_Pt_Func evas_common_gfx_func_composite_pixel_color_pt_get (Eina_B
27RGBA_Gfx_Pt_Func evas_common_gfx_func_composite_mask_color_pt_get (DATA32 col, Eina_Bool dst_alpha, int op); 27RGBA_Gfx_Pt_Func evas_common_gfx_func_composite_mask_color_pt_get (DATA32 col, Eina_Bool dst_alpha, int op);
28RGBA_Gfx_Pt_Func evas_common_gfx_func_composite_pixel_mask_pt_get (Eina_Bool src_alpha, Eina_Bool dst_alpha, int op); 28RGBA_Gfx_Pt_Func evas_common_gfx_func_composite_pixel_mask_pt_get (Eina_Bool src_alpha, Eina_Bool dst_alpha, int op);
29 29
30/* Alpha/mask functions */
31Alpha_Gfx_Func evas_common_alpha_func_get (int op);
32
33
34#endif /* _EVAS_BLEND_PRIVATE_H */ 30#endif /* _EVAS_BLEND_PRIVATE_H */
diff --git a/src/lib/evas/common/evas_font_compress.c b/src/lib/evas/common/evas_font_compress.c
index 1e13e53..7788ba5 100644
--- a/src/lib/evas/common/evas_font_compress.c
+++ b/src/lib/evas/common/evas_font_compress.c
@@ -9,6 +9,7 @@
9 9
10#include "evas_font_private.h" 10#include "evas_font_private.h"
11#include "evas_blend_private.h" 11#include "evas_blend_private.h"
12#include "draw.h"
12 13
13#ifdef EVAS_CSERVE2 14#ifdef EVAS_CSERVE2
14# include "../cserve2/evas_cs2_private.h" 15# include "../cserve2/evas_cs2_private.h"
@@ -512,7 +513,7 @@ evas_common_font_glyph_draw(RGBA_Font_Glyph *fg,
512 DATA8 *src8; 513 DATA8 *src8;
513 int row; 514 int row;
514 515
515 func = evas_common_alpha_func_get(dc->render_op); 516 func = efl_draw_alpha_func_get(dc->render_op, EINA_FALSE);
516 src8 = evas_common_font_glyph_uncompress(fg, NULL, NULL); 517 src8 = evas_common_font_glyph_uncompress(fg, NULL, NULL);
517 if (!src8) return; 518 if (!src8) return;
518 519