diff options
author | JunsuChoi <jsuya.choi@samsung.com> | 2019-10-16 15:12:13 +0900 |
---|---|---|
committer | JunsuChoi <jsuya.choi@samsung.com> | 2019-10-16 15:12:13 +0900 |
commit | 59419006b89cd304fa697627c968d6ea03482f60 (patch) | |
tree | 14bea22cb24849aa33a7e733c91300339041f6d0 /src/lib/evas/canvas/evas_vg_private.h | |
parent | 244f41402f9541099089d1118502255d5ade8466 (diff) |
efl_canvas_vg : Propagates the alpha color of the parent
Summary:
The current color is affected by the parent's opacity.
If p_opacity is set, it will be applied to the current color.
Test Plan: N/A
Reviewers: Hermet, smohanty, kimcinoo
Reviewed By: Hermet
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D10399
Diffstat (limited to 'src/lib/evas/canvas/evas_vg_private.h')
-rw-r--r-- | src/lib/evas/canvas/evas_vg_private.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/lib/evas/canvas/evas_vg_private.h b/src/lib/evas/canvas/evas_vg_private.h index bbac468723..036604b6ad 100644 --- a/src/lib/evas/canvas/evas_vg_private.h +++ b/src/lib/evas/canvas/evas_vg_private.h | |||
@@ -70,7 +70,7 @@ struct _Efl_Canvas_Vg_Node_Data | |||
70 | void (*render_pre)(Evas_Object_Protected_Data *vg_pd, Efl_VG *node, | 70 | void (*render_pre)(Evas_Object_Protected_Data *vg_pd, Efl_VG *node, |
71 | Efl_Canvas_Vg_Node_Data *nd, | 71 | Efl_Canvas_Vg_Node_Data *nd, |
72 | void *engine, void *output, void *contenxt, Ector_Surface *surface, | 72 | void *engine, void *output, void *contenxt, Ector_Surface *surface, |
73 | Eina_Matrix3 *ptransform, Ector_Buffer *comp, Efl_Gfx_Vg_Composite_Method comp_method, void *data); | 73 | Eina_Matrix3 *ptransform, int opacity, Ector_Buffer *comp, Efl_Gfx_Vg_Composite_Method comp_method, void *data); |
74 | void *data; | 74 | void *data; |
75 | 75 | ||
76 | double x, y; | 76 | double x, y; |
@@ -171,13 +171,14 @@ _evas_vg_render_pre(Evas_Object_Protected_Data *vg_pd, Efl_VG *child, | |||
171 | void *engine, void *output, void *context, | 171 | void *engine, void *output, void *context, |
172 | Ector_Surface *surface, | 172 | Ector_Surface *surface, |
173 | Eina_Matrix3 *transform, | 173 | Eina_Matrix3 *transform, |
174 | int opacity, | ||
174 | Ector_Buffer *comp, Efl_Gfx_Vg_Composite_Method comp_method) | 175 | Ector_Buffer *comp, Efl_Gfx_Vg_Composite_Method comp_method) |
175 | { | 176 | { |
176 | if (!child) return NULL; | 177 | if (!child) return NULL; |
177 | Efl_Canvas_Vg_Node_Data *nd = efl_data_scope_get(child, EFL_CANVAS_VG_NODE_CLASS); | 178 | Efl_Canvas_Vg_Node_Data *nd = efl_data_scope_get(child, EFL_CANVAS_VG_NODE_CLASS); |
178 | if (nd) nd->render_pre(vg_pd, child, nd, | 179 | if (nd) nd->render_pre(vg_pd, child, nd, |
179 | engine, output, context, surface, | 180 | engine, output, context, surface, |
180 | transform, comp, comp_method, nd->data); | 181 | transform, opacity, comp, comp_method, nd->data); |
181 | return nd; | 182 | return nd; |
182 | } | 183 | } |
183 | 184 | ||
@@ -202,5 +203,19 @@ _evas_vg_render_pre(Evas_Object_Protected_Data *vg_pd, Efl_VG *child, | |||
202 | } \ | 203 | } \ |
203 | } | 204 | } |
204 | 205 | ||
206 | #define EFL_CANVAS_VG_COMPUTE_ALPHA(Current_r, Current_g, Current_b, Current_a, Parent_Opacity, Nd) \ | ||
207 | int Current_r = Nd->r; \ | ||
208 | int Current_g = Nd->g; \ | ||
209 | int Current_b = Nd->b; \ | ||
210 | int Current_a = Nd->a; \ | ||
211 | \ | ||
212 | if (Parent_Opacity < 255) \ | ||
213 | { \ | ||
214 | double pa = (double)Parent_Opacity / 255.0; \ | ||
215 | Current_r = (double)Current_r * pa; \ | ||
216 | Current_g = (double)Current_g * pa; \ | ||
217 | Current_b = (double)Current_b * pa; \ | ||
218 | Current_a = (double)Current_a * pa; \ | ||
219 | } | ||
205 | 220 | ||
206 | #endif | 221 | #endif |