This is an automated email from the git hooks/post-receive script.
git pushed a commit to reference refs/pull/285/head
in repository efl.
View the commit online.
commit 18c5b04934506ce2998de1a75673f8823ea026e4
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Nov 28 15:13:12 2026 -0600
evas/textblock: do not cut a filtered span by its padding
The width given to the filter of a span was that of its text item,
which does not include the padding of the filter, unlike the height.
The padding of a blur, grow or padding_set() cut the right end of the
span off.
The tests also cover several programs in one textblock, data bindings,
spans over two lines and grow.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/evas/canvas/evas_object_textblock.c | 3 +-
src/tests/evas/evas_test_filter_textblock.c | 60 +++++++++++++++++++++++++++++
2 files changed, 62 insertions(+), 1 deletion(-)
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index c0f08bb31f..ff588cacfc 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -15543,7 +15543,8 @@ _efl_canvas_textblock_efl_canvas_filter_internal_filter_state_prepare(
program = _filter_program_find(o, ti->parent.format->gfx_filter->name);
if (program) evas_filter_program_padding_get(program->pgm, &pad, NULL);
- state->w = ti->parent.w; // + l + r; (already included)
+ /* the item is sized as its text, without the padding of the filter */
+ state->w = ti->parent.w + pad.l + pad.r;
state->h = ti->parent.h + pad.t + pad.b;
state->scale = obj->cur->scale;
}
diff --git a/src/tests/evas/evas_test_filter_textblock.c b/src/tests/evas/evas_test_filter_textblock.c
index 3c37d22981..42f054a40a 100644
--- a/src/tests/evas/evas_test_filter_textblock.c
+++ b/src/tests/evas/evas_test_filter_textblock.c
@@ -91,6 +91,10 @@ _render(const char *engine, const Scene *s, uint32_t *out)
"font_size=40 color=#000'");
evas_object_textblock_style_set(tb, style);
if (s->code) efl_gfx_filter_program_set(tb, s->code, "f");
+ /* more programs, for the markups which name them */
+ efl_gfx_filter_program_set(tb, "blend { color = '#00f' }", "blue");
+ efl_gfx_filter_data_set(tb, "tint", "'#0f0'", EINA_TRUE);
+ efl_gfx_filter_program_set(tb, "blend { color = tint }", "tinted");
evas_object_textblock_text_markup_set(tb, s->markup);
evas_object_move(tb, 8, 8);
evas_object_resize(tb, W - 16, H - 16);
@@ -261,6 +265,62 @@ _textblock_check(const char *engine)
failed++;
}
+ /* plain text again after filtered spans, of two programs */
+ failed += _same_as_plain(engine, "two programs and a plain end",
+ SCENE(SPAN " <gfx_filter=other>x</gfx_filter>"
+ " end", "blend { }"),
+ TEXT " x end");
+ failed += _same_as_plain(engine, "span over two lines",
+ SCENE("<gfx_filter=f>Fil<br/>ter</gfx_filter>",
+ "blend { }"),
+ "Fil<br/>ter");
+ /* white text takes the color of each program */
+ s = SCENE("<color=#fff><gfx_filter=blue>Fil</gfx_filter>"
+ "<gfx_filter=tinted>ter</gfx_filter></color>", NULL);
+ if (!_render(engine, &s, got)) return;
+ if ((_count(got, 0, 0, 255) < 80) || (_count(got, 0, 255, 0) < 80) ||
+ _errors)
+ {
+ fprintf(stderr, "VALUE %s: textblock programs and data: %d blue, %d "
+ "green, %d errors\n", engine, _count(got, 0, 0, 255),
+ _count(got, 0, 255, 0), _errors);
+ failed++;
+ }
+
+ /* A padding moves the text of the whole block, as that of a style does,
+ * and none of the span is cut */
+ s = SCENE("Ab " TEXT, NULL);
+ if (!_render(engine, &s, want)) return;
+ s = SCENE("Ab " SPAN, "padding_set { 6 } blend { }");
+ if (!_render(engine, &s, got)) return;
+ for (int y = H - 1; y >= 6; y--)
+ for (int x = W - 1; x >= 6; x--)
+ want[(y * W) + x] = want[((y - 6) * W) + x - 6];
+ if ((_differ(got, want) > 60) || _errors)
+ {
+ fprintf(stderr, "VALUE %s: textblock forced padding: %d pixels differ "
+ "from the moved plain text, %d errors\n", engine,
+ _differ(got, want), _errors);
+ failed++;
+ }
+
+ /* a grown outline keeps around the glyphs */
+ s = SCENE(TEXT, NULL);
+ if (!_render(engine, &s, want)) return;
+ s = SCENE(SPAN, "a = buffer { 'alpha' } grow { 3, dst = a } "
+ "blend { a, color = 'black' }");
+ if (!_render(engine, &s, got)) return;
+ a = _box(want);
+ b = _box(got);
+ /* grow moves edges by less than its radius */
+ if ((b.w < a.w + 2) || (b.h < a.h + 2) || (abs(a.x - b.x) > 6) || _errors)
+ {
+ fprintf(stderr, "VALUE %s: textblock grow covers %d,%d %dx%d, the "
+ "text %d,%d %dx%d, %d errors\n", engine, b.x, b.y, b.w, b.h,
+ a.x, a.y, a.w, a.h, _errors);
+ failed++;
+ }
+
/* a blur stays where the text is */
s = SCENE(TEXT, NULL);
if (!_render(engine, &s, want)) return;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.