forked from enlightenment/efl
evas: Fix classic text styles with filters in textblock
Textblock filters support RGBA input which means legacy styles can be used in conjunction with filtering. Not recommended, but it works. Note: We may decide to drop this behaviour and use alpha-only inputs for simplicity. Still missing: support for filtering strikethrough, underline, or embedded items
This commit is contained in:
parent
277ca9c0fc
commit
1b881704db
|
@ -85,6 +85,8 @@ mixin Efl.Canvas.Filter.Internal (Efl.Gfx.Filter, Efl.Object)
|
||||||
r: int; [[Right]]
|
r: int; [[Right]]
|
||||||
t: int; [[Top]]
|
t: int; [[Top]]
|
||||||
b: int; [[Bottom]]
|
b: int; [[Bottom]]
|
||||||
|
x: int; [[X offset]]
|
||||||
|
y: int; [[Y offset]]
|
||||||
do_async: bool; [[$true when the operation should be done asynchronous, $false otherwise]]
|
do_async: bool; [[$true when the operation should be done asynchronous, $false otherwise]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,7 +309,7 @@ evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj,
|
||||||
|
|
||||||
// Request rendering from the object itself (child class)
|
// Request rendering from the object itself (child class)
|
||||||
evas_filter_program_padding_get(pd->data->chain, &l, &r, &t, &b);
|
evas_filter_program_padding_get(pd->data->chain, &l, &r, &t, &b);
|
||||||
ok = evas_filter_input_render(eo_obj, filter, drawctx, NULL, l, r, t, b, do_async);
|
ok = evas_filter_input_render(eo_obj, filter, drawctx, NULL, l, r, t, b, 0, 0, do_async);
|
||||||
if (!ok) ERR("Filter input render failed.");
|
if (!ok) ERR("Filter input render failed.");
|
||||||
|
|
||||||
ENFN->context_free(ENDT, drawctx);
|
ENFN->context_free(ENDT, drawctx);
|
||||||
|
|
|
@ -1751,7 +1751,7 @@ EOLIAN static Eina_Bool
|
||||||
_efl_canvas_image_internal_efl_canvas_filter_internal_filter_input_render(
|
_efl_canvas_image_internal_efl_canvas_filter_internal_filter_input_render(
|
||||||
Eo *eo_obj, Evas_Image_Data *o, void *_filter, void *context,
|
Eo *eo_obj, Evas_Image_Data *o, void *_filter, void *context,
|
||||||
void *data EINA_UNUSED, int l, int r EINA_UNUSED, int t, int b EINA_UNUSED,
|
void *data EINA_UNUSED, int l, int r EINA_UNUSED, int t, int b EINA_UNUSED,
|
||||||
Eina_Bool do_async)
|
int x, int y, Eina_Bool do_async)
|
||||||
{
|
{
|
||||||
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||||
Evas_Filter_Context *filter = _filter;
|
Evas_Filter_Context *filter = _filter;
|
||||||
|
@ -1794,7 +1794,8 @@ _efl_canvas_image_internal_efl_canvas_filter_internal_filter_input_render(
|
||||||
ENFN->context_render_op_set(output, context, EVAS_RENDER_BLEND);
|
ENFN->context_render_op_set(output, context, EVAS_RENDER_BLEND);
|
||||||
|
|
||||||
_evas_image_render(eo_obj, obj, output, context, surface,
|
_evas_image_render(eo_obj, obj, output, context, surface,
|
||||||
l - obj->cur->geometry.x, t - obj->cur->geometry.y,
|
x + l - obj->cur->geometry.x,
|
||||||
|
y + t - obj->cur->geometry.y,
|
||||||
l, t, r, b, do_async);
|
l, t, r, b, do_async);
|
||||||
|
|
||||||
if (!input_stolen)
|
if (!input_stolen)
|
||||||
|
|
|
@ -1722,6 +1722,7 @@ _evas_text_efl_canvas_filter_internal_filter_input_render(Eo *eo_obj EINA_UNUSED
|
||||||
void *_filter, void *drawctx,
|
void *_filter, void *drawctx,
|
||||||
void *data EINA_UNUSED,
|
void *data EINA_UNUSED,
|
||||||
int l, int r EINA_UNUSED, int t, int b EINA_UNUSED,
|
int l, int r EINA_UNUSED, int t, int b EINA_UNUSED,
|
||||||
|
int x, int y,
|
||||||
Eina_Bool do_async)
|
Eina_Bool do_async)
|
||||||
{
|
{
|
||||||
Evas_Filter_Context *filter = _filter;
|
Evas_Filter_Context *filter = _filter;
|
||||||
|
@ -1732,8 +1733,8 @@ _evas_text_efl_canvas_filter_internal_filter_input_render(Eo *eo_obj EINA_UNUSED
|
||||||
{
|
{
|
||||||
if (!evas_filter_font_draw(filter, drawctx,
|
if (!evas_filter_font_draw(filter, drawctx,
|
||||||
EVAS_FILTER_BUFFER_INPUT_ID, o->font,
|
EVAS_FILTER_BUFFER_INPUT_ID, o->font,
|
||||||
l + it->x,
|
x + l + it->x,
|
||||||
t + (int) o->max_ascent,
|
y + t + (int) o->max_ascent,
|
||||||
&it->text_props,
|
&it->text_props,
|
||||||
do_async))
|
do_async))
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
|
@ -13236,9 +13236,9 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DRAW_TEXT_FILTER(gf, ox, oy) do { \
|
#define DRAW_TEXT_FILTER(gf, ox, oy) do { \
|
||||||
evas_filter_input_render(eo_obj, _filter_context_get(ti), gf->dc, ti, \
|
evas_filter_input_render(eo_obj, ti->gfx_filter->ctx, gf->dc, ti, \
|
||||||
gf->pad.l, gf->pad.r, \
|
gf->pad.l, gf->pad.r, gf->pad.t, gf->pad.b, \
|
||||||
gf->pad.t, gf->pad.b, do_async); \
|
(ox), (oy), do_async); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define DRAW_TEXT_NOFILTER(ox, oy) do { \
|
#define DRAW_TEXT_NOFILTER(ox, oy) do { \
|
||||||
|
@ -13823,14 +13823,16 @@ _efl_canvas_text_efl_canvas_filter_internal_filter_state_prepare(
|
||||||
EOLIAN static Eina_Bool
|
EOLIAN static Eina_Bool
|
||||||
_efl_canvas_text_efl_canvas_filter_internal_filter_input_render(
|
_efl_canvas_text_efl_canvas_filter_internal_filter_input_render(
|
||||||
Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *pd EINA_UNUSED, void *filter, void *drawctx,
|
Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *pd EINA_UNUSED, void *filter, void *drawctx,
|
||||||
void *data, int l, int r EINA_UNUSED, int t, int b EINA_UNUSED, Eina_Bool do_async)
|
void *data, int l, int r EINA_UNUSED, int t, int b EINA_UNUSED,
|
||||||
|
int x, int y, Eina_Bool do_async)
|
||||||
{
|
{
|
||||||
Evas_Object_Textblock_Text_Item *ti = data;
|
Evas_Object_Textblock_Text_Item *ti = data;
|
||||||
|
|
||||||
return evas_filter_font_draw(filter, drawctx,
|
return evas_filter_font_draw(filter, drawctx,
|
||||||
EVAS_FILTER_BUFFER_INPUT_ID,
|
EVAS_FILTER_BUFFER_INPUT_ID,
|
||||||
ti->parent.format->font.font,
|
ti->parent.format->font.font,
|
||||||
l, t + ti->parent.yoff + ti->parent.h - ti->parent.ln->h,
|
x + l,
|
||||||
|
y + t + ti->parent.yoff + ti->parent.h - ti->parent.ln->h,
|
||||||
&ti->text_props, do_async);
|
&ti->text_props, do_async);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue