summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-12-22 19:41:04 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-01-17 14:35:27 +0900
commitb2a4039bda21989ab9f9316579750f48a83e052a (patch)
tree5ab858644f9868a7deea92fac95496ccf1aa89c2 /src
parentffbc0645e57d7cad01e5c11044bcb8c7688c6e27 (diff)
evas: Refactor evas filters a bit
This is a preparation step for (experimental) textblock support. Textblock objects won't have a single filter, and the buffer's geometry wouldn't be that of of the object itself. Thus a few internal APIs need to be reworked first.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Evas.am1
-rw-r--r--src/lib/evas/canvas/efl_canvas_filter_internal.eo57
-rw-r--r--src/lib/evas/canvas/efl_canvas_image_internal.eo3
-rw-r--r--src/lib/evas/canvas/evas_filter_mixin.c45
-rw-r--r--src/lib/evas/canvas/evas_object_image.c27
-rw-r--r--src/lib/evas/canvas/evas_object_text.c26
-rw-r--r--src/lib/evas/canvas/evas_text.eo5
-rw-r--r--src/lib/evas/filters/evas_filter.c15
-rw-r--r--src/lib/evas/filters/evas_filter_parser.c66
-rw-r--r--src/lib/evas/include/evas_filter.h7
10 files changed, 146 insertions, 106 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 8b8186b4fd..c78a3982dd 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -2353,6 +2353,7 @@ tests/evas/evas_suite.h
2353 2353
2354tests_evas_evas_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ 2354tests_evas_evas_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
2355-I$(top_srcdir)/src/lib/ecore_evas \ 2355-I$(top_srcdir)/src/lib/ecore_evas \
2356-I$(top_builddir)/src/lib/evas/canvas \
2356-DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/evas\" \ 2357-DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/evas\" \
2357-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/evas\" \ 2358-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/evas\" \
2358@CHECK_CFLAGS@ \ 2359@CHECK_CFLAGS@ \
diff --git a/src/lib/evas/canvas/efl_canvas_filter_internal.eo b/src/lib/evas/canvas/efl_canvas_filter_internal.eo
index 48bfd2685d..1f612701c5 100644
--- a/src/lib/evas/canvas/efl_canvas_filter_internal.eo
+++ b/src/lib/evas/canvas/efl_canvas_filter_internal.eo
@@ -1,3 +1,43 @@
1// import efl_gfx_types -> need to add Efl.Gfx.Color
2
3/* Everything in this file is internal to Evas. It is not meant to be used
4 from outside EFL itself! */
5
6struct Efl.Gfx.Color32
7{
8 r: uint8;
9 g: uint8;
10 b: uint8;
11 a: uint8;
12}
13
14struct Efl.Canvas.Filter.State_Name
15{
16 name: string;
17 value: double;
18}
19
20struct Efl.Canvas.Filter.State_Text
21{
22 outline: Efl.Gfx.Color32;
23 shadow: Efl.Gfx.Color32;
24 glow: Efl.Gfx.Color32;
25 glow2: Efl.Gfx.Color32;
26}
27
28struct Efl.Canvas.Filter.State
29{
30 [[Internal structure representing the state of a Gfx Filter]]
31 text: Efl.Canvas.Filter.State_Text;
32 color: Efl.Gfx.Color32;
33 cur: Efl.Canvas.Filter.State_Name;
34 next: Efl.Canvas.Filter.State_Name;
35 w: int;
36 h: int;
37 scale: double;
38 pos: double;
39}
40
1mixin Efl.Canvas.Filter.Internal (Efl.Gfx.Filter, Efl.Object) 41mixin Efl.Canvas.Filter.Internal (Efl.Gfx.Filter, Efl.Object)
2{ 42{
3 [[Evas internal implementation of filters.]] 43 [[Evas internal implementation of filters.]]
@@ -26,14 +66,21 @@ mixin Efl.Canvas.Filter.Internal (Efl.Gfx.Filter, Efl.Object)
26 [[Called by Efl.Canvas.Filter.Internal to determine whether the input is alpha or rgba.]] 66 [[Called by Efl.Canvas.Filter.Internal to determine whether the input is alpha or rgba.]]
27 return: bool; [[$true on success, $false otherwise]] 67 return: bool; [[$true on success, $false otherwise]]
28 } 68 }
69 filter_state_prepare @protected @pure_virtual {
70 [[Called by Efl.Canvas.Filter.Internal to request the parent class
71 for state information (color, etc...).]]
72 params {
73 @out state: Efl.Canvas.Filter.State; [[State info to fill in]]
74 @in data: void_ptr; [[Private data for the class]]
75 }
76 }
29 filter_input_render @protected @pure_virtual { 77 filter_input_render @protected @pure_virtual {
30 [[Called by Efl.Canvas.Filter.Internal when the parent class must render the input. 78 [[Called by Efl.Canvas.Filter.Internal when the parent class must render the input.]]
31 ;
32 ]]
33 return: bool; [[Indicates success from the object render function.]] 79 return: bool; [[Indicates success from the object render function.]]
34 params { 80 params {
35 filter: void_ptr; [[Evas_Filter_Context]] 81 filter: void_ptr; [[Current filter context]]
36 drawctx: void_ptr; [[Draw context]] 82 drawctx: void_ptr; [[Draw context (for evas engine)]]
83 data: void_ptr; [[Arbitrary private data]]
37 l: int; [[Left]] 84 l: int; [[Left]]
38 r: int; [[Right]] 85 r: int; [[Right]]
39 t: int; [[Top]] 86 t: int; [[Top]]
diff --git a/src/lib/evas/canvas/efl_canvas_image_internal.eo b/src/lib/evas/canvas/efl_canvas_image_internal.eo
index 2101a564f0..420743ecd8 100644
--- a/src/lib/evas/canvas/efl_canvas_image_internal.eo
+++ b/src/lib/evas/canvas/efl_canvas_image_internal.eo
@@ -28,8 +28,9 @@ abstract Efl.Canvas.Image.Internal (Efl.Canvas.Object, Efl.Canvas.Filter.Interna
28 Efl.Gfx.Fill.fill_auto { get; set; } 28 Efl.Gfx.Fill.fill_auto { get; set; }
29 Efl.Gfx.Filter.filter_program { set; } 29 Efl.Gfx.Filter.filter_program { set; }
30 Efl.Gfx.View.view_size { get; } 30 Efl.Gfx.View.view_size { get; }
31 Efl.Canvas.Filter.Internal.filter_dirty;
31 Efl.Canvas.Filter.Internal.filter_input_alpha; 32 Efl.Canvas.Filter.Internal.filter_input_alpha;
32 Efl.Canvas.Filter.Internal.filter_input_render; 33 Efl.Canvas.Filter.Internal.filter_input_render;
33 Efl.Canvas.Filter.Internal.filter_dirty; 34 Efl.Canvas.Filter.Internal.filter_state_prepare;
34 } 35 }
35} 36}
diff --git a/src/lib/evas/canvas/evas_filter_mixin.c b/src/lib/evas/canvas/evas_filter_mixin.c
index 94070ca331..3f211a4fab 100644
--- a/src/lib/evas/canvas/evas_filter_mixin.c
+++ b/src/lib/evas/canvas/evas_filter_mixin.c
@@ -150,6 +150,21 @@ _filter_source_hash_free_cb(void *data)
150 free(pb); 150 free(pb);
151} 151}
152 152
153static inline Eina_Bool
154_evas_filter_state_set_internal(Evas_Filter_Program *pgm, Evas_Filter_Data *pd)
155{
156 Efl_Canvas_Filter_State state = EFL_CANVAS_FILTER_STATE_DEFAULT;
157
158 evas_filter_state_prepare(pd->obj->object, &state, NULL);
159 state.cur.name = pd->data->state.cur.name;
160 state.cur.value = pd->data->state.cur.value;
161 state.next.name = pd->data->state.next.name;
162 state.next.value = pd->data->state.next.value;
163 state.pos = pd->data->state.pos;
164
165 return evas_filter_program_state_set(pgm, &state);
166}
167
153Eina_Bool 168Eina_Bool
154evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj, 169evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
155 void *output, void *context, void *surface, 170 void *output, void *context, void *surface,
@@ -196,13 +211,11 @@ evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
196 if (!pd->data->chain) 211 if (!pd->data->chain)
197 { 212 {
198 Evas_Filter_Program *pgm; 213 Evas_Filter_Program *pgm;
214
199 pgm = evas_filter_program_new(pd->data->name, alpha); 215 pgm = evas_filter_program_new(pd->data->name, alpha);
200 evas_filter_program_source_set_all(pgm, pd->data->sources); 216 evas_filter_program_source_set_all(pgm, pd->data->sources);
201 evas_filter_program_data_set_all(pgm, pd->data->data); 217 evas_filter_program_data_set_all(pgm, pd->data->data);
202 evas_filter_program_state_set(pgm, eo_obj, obj, 218 _evas_filter_state_set_internal(pgm, pd);
203 pd->data->state.cur.name, pd->data->state.cur.value,
204 pd->data->state.next.name, pd->data->state.next.value,
205 pd->data->state.pos);
206 if (!evas_filter_program_parse(pgm, pd->data->code)) 219 if (!evas_filter_program_parse(pgm, pd->data->code))
207 { 220 {
208 ERR("Filter program parsing failed"); 221 ERR("Filter program parsing failed");
@@ -226,10 +239,7 @@ evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
226 { 239 {
227 Eina_Bool redraw; 240 Eina_Bool redraw;
228 241
229 redraw = evas_filter_program_state_set(pd->data->chain, eo_obj, obj, 242 redraw = _evas_filter_state_set_internal(pd->data->chain, pd);
230 pd->data->state.cur.name, pd->data->state.cur.value,
231 pd->data->state.next.name, pd->data->state.next.value,
232 pd->data->state.pos);
233 if (redraw) 243 if (redraw)
234 DBG("Filter redraw by state change!"); 244 DBG("Filter redraw by state change!");
235 else if (obj->changed) 245 else if (obj->changed)
@@ -280,10 +290,9 @@ evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
280 } 290 }
281 } 291 }
282 else 292 else
283 evas_filter_program_state_set(pd->data->chain, eo_obj, obj, 293 {
284 pd->data->state.cur.name, pd->data->state.cur.value, 294 _evas_filter_state_set_internal(pd->data->chain, pd);
285 pd->data->state.next.name, pd->data->state.next.value, 295 }
286 pd->data->state.pos);
287 296
288 filter = evas_filter_context_new(obj->layer->evas, do_async); 297 filter = evas_filter_context_new(obj->layer->evas, do_async);
289 298
@@ -316,7 +325,7 @@ evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
316 325
317 // Request rendering from the object itself (child class) 326 // Request rendering from the object itself (child class)
318 evas_filter_program_padding_get(pd->data->chain, &l, &r, &t, &b); 327 evas_filter_program_padding_get(pd->data->chain, &l, &r, &t, &b);
319 ok = evas_filter_input_render(eo_obj, filter, drawctx, l, r, t, b, do_async); 328 ok = evas_filter_input_render(eo_obj, filter, drawctx, NULL, l, r, t, b, do_async);
320 if (!ok) ERR("Filter input render failed."); 329 if (!ok) ERR("Filter input render failed.");
321 330
322 ENFN->context_free(ENDT, drawctx); 331 ENFN->context_free(ENDT, drawctx);
@@ -377,10 +386,7 @@ _efl_canvas_filter_internal_efl_gfx_filter_filter_program_set(Eo *eo_obj, Evas_F
377 pgm = evas_filter_program_new(fcow->name, alpha); 386 pgm = evas_filter_program_new(fcow->name, alpha);
378 evas_filter_program_source_set_all(pgm, fcow->sources); 387 evas_filter_program_source_set_all(pgm, fcow->sources);
379 evas_filter_program_data_set_all(pgm, fcow->data); 388 evas_filter_program_data_set_all(pgm, fcow->data);
380 evas_filter_program_state_set(pgm, eo_obj, obj, 389 _evas_filter_state_set_internal(pgm, pd);
381 fcow->state.cur.name, fcow->state.cur.value,
382 fcow->state.next.name, fcow->state.next.value,
383 fcow->state.pos);
384 if (!evas_filter_program_parse(pgm, code)) 390 if (!evas_filter_program_parse(pgm, code))
385 { 391 {
386 ERR("Parsing failed!"); 392 ERR("Parsing failed!");
@@ -523,10 +529,7 @@ _efl_canvas_filter_internal_efl_gfx_filter_filter_state_set(Eo *eo_obj, Evas_Fil
523 529
524 if (pd->data->chain) 530 if (pd->data->chain)
525 { 531 {
526 evas_filter_program_state_set(pd->data->chain, eo_obj, obj, 532 _evas_filter_state_set_internal(pd->data->chain, pd);
527 pd->data->state.cur.name, pd->data->state.cur.value,
528 pd->data->state.next.name, pd->data->state.next.value,
529 pd->data->state.pos);
530 } 533 }
531 534
532 evas_filter_dirty(eo_obj); 535 evas_filter_dirty(eo_obj);
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 427359e2f9..1a93fafb5b 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -1717,7 +1717,8 @@ _efl_canvas_image_internal_efl_canvas_filter_internal_filter_dirty(Eo *eo_obj, E
1717} 1717}
1718 1718
1719EOLIAN static Eina_Bool 1719EOLIAN static Eina_Bool
1720_efl_canvas_image_internal_efl_canvas_filter_internal_filter_input_alpha(Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o EINA_UNUSED) 1720_efl_canvas_image_internal_efl_canvas_filter_internal_filter_input_alpha(
1721 Eo *eo_obj EINA_UNUSED, Evas_Image_Data *o EINA_UNUSED)
1721{ 1722{
1722 return EINA_FALSE; 1723 return EINA_FALSE;
1723} 1724}
@@ -1730,11 +1731,27 @@ _efl_canvas_image_internal_efl_gfx_filter_filter_program_set(Eo *obj, Evas_Image
1730 efl_gfx_filter_program_set(efl_super(obj, MY_CLASS), code, name); 1731 efl_gfx_filter_program_set(efl_super(obj, MY_CLASS), code, name);
1731} 1732}
1732 1733
1734EOLIAN static void
1735_efl_canvas_image_internal_efl_canvas_filter_internal_filter_state_prepare(
1736 Eo *eo_obj, Evas_Image_Data *o EINA_UNUSED, Efl_Canvas_Filter_State *state, void *data EINA_UNUSED)
1737{
1738 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
1739
1740 memset(&state->text, 0, sizeof(state->text));
1741#define STATE_COLOR(dst, src) dst.r = src.r; dst.g = src.g; dst.b = src.b; dst.a = src.a
1742 STATE_COLOR(state->color, obj->cur->color);
1743#undef STATE_COLOR
1744
1745 state->w = obj->cur->geometry.w;
1746 state->h = obj->cur->geometry.h;
1747 state->scale = obj->cur->scale;
1748}
1749
1733EOLIAN static Eina_Bool 1750EOLIAN static Eina_Bool
1734_efl_canvas_image_internal_efl_canvas_filter_internal_filter_input_render(Eo *eo_obj, Evas_Image_Data *o, 1751_efl_canvas_image_internal_efl_canvas_filter_internal_filter_input_render(
1735 void *_filter, void *context, 1752 Eo *eo_obj, Evas_Image_Data *o, void *_filter, void *context,
1736 int l, int r EINA_UNUSED, int t, int b EINA_UNUSED, 1753 void *data EINA_UNUSED, int l, int r EINA_UNUSED, int t, int b EINA_UNUSED,
1737 Eina_Bool do_async) 1754 Eina_Bool do_async)
1738{ 1755{
1739 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 1756 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
1740 Evas_Filter_Context *filter = _filter; 1757 Evas_Filter_Context *filter = _filter;
diff --git a/src/lib/evas/canvas/evas_object_text.c b/src/lib/evas/canvas/evas_object_text.c
index ce383dac52..7329e78d82 100644
--- a/src/lib/evas/canvas/evas_object_text.c
+++ b/src/lib/evas/canvas/evas_object_text.c
@@ -1698,11 +1698,31 @@ _evas_text_efl_canvas_filter_internal_filter_input_alpha(Eo *eo_obj EINA_UNUSED,
1698 return EINA_TRUE; 1698 return EINA_TRUE;
1699} 1699}
1700 1700
1701EOLIAN static void
1702_evas_text_efl_canvas_filter_internal_filter_state_prepare(Eo *eo_obj, Evas_Text_Data *o,
1703 Efl_Canvas_Filter_State *state, void *data EINA_UNUSED)
1704{
1705 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
1706
1707#define STATE_COLOR(dst, src) dst.r = src.r; dst.g = src.g; dst.b = src.b; dst.a = src.a
1708 STATE_COLOR(state->color, obj->cur->color);
1709 STATE_COLOR(state->text.glow, o->cur.glow);
1710 STATE_COLOR(state->text.glow2, o->cur.glow2);
1711 STATE_COLOR(state->text.shadow, o->cur.shadow);
1712 STATE_COLOR(state->text.outline, o->cur.outline);
1713#undef STATE_COLOR
1714
1715 state->w = obj->cur->geometry.w;
1716 state->h = obj->cur->geometry.h;
1717 state->scale = obj->cur->scale;
1718}
1719
1701EOLIAN static Eina_Bool 1720EOLIAN static Eina_Bool
1702_evas_text_efl_canvas_filter_internal_filter_input_render(Eo *eo_obj EINA_UNUSED, Evas_Text_Data *o, 1721_evas_text_efl_canvas_filter_internal_filter_input_render(Eo *eo_obj EINA_UNUSED, Evas_Text_Data *o,
1703 void *_filter, void *drawctx, 1722 void *_filter, void *drawctx,
1704 int l, int r EINA_UNUSED, int t, int b EINA_UNUSED, 1723 void *data EINA_UNUSED,
1705 Eina_Bool do_async) 1724 int l, int r EINA_UNUSED, int t, int b EINA_UNUSED,
1725 Eina_Bool do_async)
1706{ 1726{
1707 Evas_Filter_Context *filter = _filter; 1727 Evas_Filter_Context *filter = _filter;
1708 Evas_Object_Text_Item *it; 1728 Evas_Object_Text_Item *it;
diff --git a/src/lib/evas/canvas/evas_text.eo b/src/lib/evas/canvas/evas_text.eo
index f2e2b46612..8cce0edd66 100644
--- a/src/lib/evas/canvas/evas_text.eo
+++ b/src/lib/evas/canvas/evas_text.eo
@@ -267,9 +267,10 @@ class Evas.Text (Efl.Canvas.Object, Efl.Text, Efl.Text.Properties, Efl.Canvas.Fi
267 Efl.Text.Properties.font { get; set; } 267 Efl.Text.Properties.font { get; set; }
268 Efl.Text.Properties.font_source { get; set; } 268 Efl.Text.Properties.font_source { get; set; }
269 Efl.Gfx.Filter.filter_program { set; } 269 Efl.Gfx.Filter.filter_program { set; }
270 Efl.Canvas.Filter.Internal.filter_dirty;
270 Efl.Canvas.Filter.Internal.filter_input_alpha; 271 Efl.Canvas.Filter.Internal.filter_input_alpha;
271 Efl.Canvas.Filter.Internal.filter_input_render; 272 Efl.Canvas.Filter.Internal.filter_input_render;
272 Efl.Canvas.Filter.Internal.filter_dirty; 273 Efl.Canvas.Filter.Internal.filter_state_prepare;
273 Efl.Canvas.Object.paragraph_direction { get; set; } 274 Efl.Canvas.Object.paragraph_direction { set; get; }
274 } 275 }
275} 276}
diff --git a/src/lib/evas/filters/evas_filter.c b/src/lib/evas/filters/evas_filter.c
index 5440105a28..e4008d5600 100644
--- a/src/lib/evas/filters/evas_filter.c
+++ b/src/lib/evas/filters/evas_filter.c
@@ -1314,17 +1314,13 @@ _filter_target_render(Evas_Filter_Context *ctx)
1314 ctx->target.r, ctx->target.g, 1314 ctx->target.r, ctx->target.g,
1315 ctx->target.b, ctx->target.a); 1315 ctx->target.b, ctx->target.a);
1316 } 1316 }
1317 else
1318 {
1319 ENFN->context_multiplier_unset(ENDT, drawctx);
1320 }
1321 1317
1322 if (ctx->target.mask) 1318 if (ctx->target.mask)
1323 ENFN->context_clip_image_set(ENDT, drawctx, 1319 {
1324 ctx->target.mask, ctx->target.mask_x, ctx->target.mask_y, 1320 ENFN->context_clip_image_set(ENDT, drawctx, ctx->target.mask,
1325 ctx->evas, EINA_FALSE); 1321 ctx->target.mask_x, ctx->target.mask_y,
1326 else 1322 ctx->evas, EINA_FALSE);
1327 ENFN->context_clip_image_unset(ENDT, drawctx); 1323 }
1328 1324
1329 ENFN->image_draw(ENDT, drawctx, surface, image, 1325 ENFN->image_draw(ENDT, drawctx, surface, image,
1330 0, 0, src->w, src->h, 1326 0, 0, src->w, src->h,
@@ -1359,6 +1355,7 @@ evas_filter_font_draw(Evas_Filter_Context *ctx, void *draw_context, int bufid,
1359 evas_common_font_glyphs_ref(text_props->glyphs); 1355 evas_common_font_glyphs_ref(text_props->glyphs);
1360 evas_unref_queue_glyph_put(ctx->evas, text_props->glyphs); 1356 evas_unref_queue_glyph_put(ctx->evas, text_props->glyphs);
1361 } 1357 }
1358 //evas_common_save_image_to_file(surface, "/tmp/input.png", 0, 100, 0 ,0);
1362 1359
1363 return EINA_TRUE; 1360 return EINA_TRUE;
1364} 1361}
diff --git a/src/lib/evas/filters/evas_filter_parser.c b/src/lib/evas/filters/evas_filter_parser.c
index 6ccb649b39..8fce7c57a9 100644
--- a/src/lib/evas/filters/evas_filter_parser.c
+++ b/src/lib/evas/filters/evas_filter_parser.c
@@ -316,30 +316,6 @@ struct _Evas_Filter_Instruction
316 Eina_Bool valid : 1; 316 Eina_Bool valid : 1;
317}; 317};
318 318
319struct _Evas_Filter_Program_State
320{
321 struct {
322 struct { int a, r, g, b; } outline;
323 struct { int a, r, g, b; } shadow;
324 struct { int a, r, g, b; } glow;
325 struct { int a, r, g, b; } glow2;
326 } text;
327 struct {
328 int a, r, g, b;
329 } color;
330 struct {
331 const char *name;
332 double value;
333 } cur;
334 struct {
335 const char *name;
336 double value;
337 } next;
338 int w, h;
339 double scale;
340 double pos;
341};
342
343struct _Evas_Filter_Program 319struct _Evas_Filter_Program
344{ 320{
345 Eina_Stringshare *name; // Optional for now 321 Eina_Stringshare *name; // Optional for now
@@ -350,7 +326,7 @@ struct _Evas_Filter_Program
350 // Note: padding can't be in the state as it's calculated after running Lua 326 // Note: padding can't be in the state as it's calculated after running Lua
351 int l, r, t, b; 327 int l, r, t, b;
352 } pad; 328 } pad;
353 Evas_Filter_Program_State state; 329 Efl_Canvas_Filter_State state;
354 Eina_Inlist *data; // Evas_Filter_Data_Binding 330 Eina_Inlist *data; // Evas_Filter_Data_Binding
355 lua_State *L; 331 lua_State *L;
356 int lua_func; 332 int lua_func;
@@ -2967,50 +2943,24 @@ evas_filter_program_new(const char *name, Eina_Bool input_alpha)
2967 if (!pgm) return NULL; 2943 if (!pgm) return NULL;
2968 pgm->name = eina_stringshare_add(name); 2944 pgm->name = eina_stringshare_add(name);
2969 pgm->input_alpha = input_alpha; 2945 pgm->input_alpha = input_alpha;
2970 pgm->state.color.r = 255; 2946 pgm->state = (Efl_Canvas_Filter_State) EFL_CANVAS_FILTER_STATE_DEFAULT;
2971 pgm->state.color.g = 255;
2972 pgm->state.color.b = 255;
2973 pgm->state.color.a = 255;
2974 pgm->state.scale = 1.0;
2975 2947
2976 return pgm; 2948 return pgm;
2977} 2949}
2978 2950
2979EAPI Eina_Bool 2951EAPI Eina_Bool
2980evas_filter_program_state_set(Evas_Filter_Program *pgm, Evas_Object *eo_obj, 2952evas_filter_program_state_set(Evas_Filter_Program *pgm,
2981 Evas_Object_Protected_Data *obj, 2953 const Efl_Canvas_Filter_State *state)
2982 const char *cur_state, double cur_val,
2983 const char *next_state, double next_val,
2984 double pos)
2985{ 2954{
2986 Evas_Filter_Program_State old_state;
2987
2988 EINA_SAFETY_ON_NULL_RETURN_VAL(pgm, EINA_FALSE); 2955 EINA_SAFETY_ON_NULL_RETURN_VAL(pgm, EINA_FALSE);
2956 EINA_SAFETY_ON_NULL_RETURN_VAL(state, EINA_FALSE);
2989 2957
2990 memcpy(&old_state, &pgm->state, sizeof(Evas_Filter_Program_State)); 2958 if (memcmp(&pgm->state, state, sizeof(Efl_Canvas_Filter_State)) != 0)
2991
2992 pgm->state.w = obj->cur->geometry.w;
2993 pgm->state.h = obj->cur->geometry.h;
2994 pgm->state.scale = obj->cur->scale;
2995 pgm->state.pos = pos;
2996 pgm->state.cur.name = cur_state;
2997 pgm->state.cur.value = cur_val;
2998 pgm->state.next.name = next_state;
2999 pgm->state.next.value = next_val;
3000
3001 efl_gfx_color_get(eo_obj, &pgm->state.color.r, &pgm->state.color.g, &pgm->state.color.b, &pgm->state.color.a);
3002
3003 if (efl_isa(eo_obj, EVAS_TEXT_CLASS))
3004 { 2959 {
3005 evas_obj_text_shadow_color_get(eo_obj, &pgm->state.text.shadow.r, &pgm->state.text.shadow.g, &pgm->state.text.shadow.b, &pgm->state.text.shadow.a); 2960 pgm->changed = EINA_TRUE;
3006 evas_obj_text_outline_color_get(eo_obj, &pgm->state.text.outline.r, &pgm->state.text.outline.g, &pgm->state.text.outline.b, &pgm->state.text.outline.a); 2961 memcpy(&pgm->state, state, sizeof(Efl_Canvas_Filter_State));
3007 evas_obj_text_glow_color_get(eo_obj, &pgm->state.text.glow.r, &pgm->state.text.glow.g, &pgm->state.text.glow.b, &pgm->state.text.glow.a);
3008 evas_obj_text_glow2_color_get(eo_obj, &pgm->state.text.glow2.r, &pgm->state.text.glow2.g, &pgm->state.text.glow2.b, &pgm->state.text.glow2.a);
3009 } 2962 }
3010 2963
3011 if (memcmp(&old_state, &pgm->state, sizeof(Evas_Filter_Program_State)) != 0)
3012 pgm->changed = EINA_TRUE;
3013
3014 if (pgm->changed) 2964 if (pgm->changed)
3015 pgm->padding_calc = EINA_FALSE; 2965 pgm->padding_calc = EINA_FALSE;
3016 2966
diff --git a/src/lib/evas/include/evas_filter.h b/src/lib/evas/include/evas_filter.h
index bb7a32d287..60d946fddc 100644
--- a/src/lib/evas/include/evas_filter.h
+++ b/src/lib/evas/include/evas_filter.h
@@ -4,6 +4,8 @@
4#include "evas_common_private.h" 4#include "evas_common_private.h"
5#include "evas_private.h" 5#include "evas_private.h"
6 6
7#include "efl_canvas_filter_internal.eo.h"
8
7#ifdef EAPI 9#ifdef EAPI
8# undef EAPI 10# undef EAPI
9#endif 11#endif
@@ -35,7 +37,6 @@ typedef struct _Evas_Filter_Command Evas_Filter_Command;
35typedef struct _Evas_Filter_Instruction Evas_Filter_Instruction; 37typedef struct _Evas_Filter_Instruction Evas_Filter_Instruction;
36typedef struct _Evas_Filter_Buffer Evas_Filter_Buffer; 38typedef struct _Evas_Filter_Buffer Evas_Filter_Buffer;
37typedef struct _Evas_Filter_Proxy_Binding Evas_Filter_Proxy_Binding; 39typedef struct _Evas_Filter_Proxy_Binding Evas_Filter_Proxy_Binding;
38typedef struct _Evas_Filter_Program_State Evas_Filter_Program_State;
39typedef enum _Evas_Filter_Mode Evas_Filter_Mode; 40typedef enum _Evas_Filter_Mode Evas_Filter_Mode;
40typedef enum _Evas_Filter_Blur_Type Evas_Filter_Blur_Type; 41typedef enum _Evas_Filter_Blur_Type Evas_Filter_Blur_Type;
41typedef enum _Evas_Filter_Channel Evas_Filter_Channel; 42typedef enum _Evas_Filter_Channel Evas_Filter_Channel;
@@ -124,9 +125,11 @@ enum _Evas_Filter_Transform_Flags
124 EVAS_FILTER_TRANSFORM_VFLIP = 1 125 EVAS_FILTER_TRANSFORM_VFLIP = 1
125}; 126};
126 127
128#define EFL_CANVAS_FILTER_STATE_DEFAULT { {}, { 255, 255, 255, 255 }, { "default", 0.0 }, {}, 0, 0, 1.0, 0.0 }
129
127/* Parser stuff (high level API) */ 130/* Parser stuff (high level API) */
128EAPI Evas_Filter_Program *evas_filter_program_new(const char *name, Eina_Bool input_alpha); 131EAPI Evas_Filter_Program *evas_filter_program_new(const char *name, Eina_Bool input_alpha);
129EAPI Eina_Bool evas_filter_program_state_set(Evas_Filter_Program *pgm, Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, const char *cur_state, double cur_val, const char *next_state, double next_val, double pos); 132EAPI Eina_Bool evas_filter_program_state_set(Evas_Filter_Program *pgm, const Efl_Canvas_Filter_State *state);
130EAPI Eina_Bool evas_filter_program_parse(Evas_Filter_Program *pgm, const char *str); 133EAPI Eina_Bool evas_filter_program_parse(Evas_Filter_Program *pgm, const char *str);
131EAPI void evas_filter_program_del(Evas_Filter_Program *pgm); 134EAPI void evas_filter_program_del(Evas_Filter_Program *pgm);
132Eina_Bool evas_filter_context_program_use(Evas_Filter_Context *ctx, Evas_Filter_Program *pgm); 135Eina_Bool evas_filter_context_program_use(Evas_Filter_Context *ctx, Evas_Filter_Program *pgm);