This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch v-1.29
in repository efl.
View the commit online.
commit 70f57bf31725305a57fbd11a2333f8303baf52b7
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Nov 21 11:48:16 2026 -0600
evas: draw a font array with one clip and cutout computation
evas_common_font_draw_cb() redid the clip and cutout walk for every
glyph run it was handed. evas_common_font_draw_array() factors that
walk out, so a whole Evas_Font_Array is drawn with one setup. It is
EVAS_API because the engines are separate modules.
The software engine's multi_font_draw uses it for the async command.
Its sync branch used to return without drawing anything; it draws now.
No caller takes the sync branch yet, so this change is neutral on its
own (all tests within +-2.6% of the base). It is groundwork for the GL
and textgrid changes that follow.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/evas/common/evas_font_draw.c | 92 +++++++++++++++++++---
src/lib/evas/common/evas_font_draw.h | 1 +
.../evas/engines/software_generic/evas_engine.c | 21 ++---
3 files changed, 86 insertions(+), 28 deletions(-)
diff --git a/src/lib/evas/common/evas_font_draw.c b/src/lib/evas/common/evas_font_draw.c
index 60bda0f003..13e037cf53 100644
--- a/src/lib/evas/common/evas_font_draw.c
+++ b/src/lib/evas/common/evas_font_draw.c
@@ -301,24 +301,35 @@ error:
eina_inarray_free(glyphs);
}
-EVAS_API Eina_Bool
-evas_common_font_draw_cb(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs, Evas_Common_Font_Draw_Cb cb)
+typedef Eina_Bool (*Evas_Font_Draw_Area_Cb)(RGBA_Image *dst, RGBA_Draw_Context *dc, const void *data, int ext_x, int ext_y, int ext_w, int ext_h, int im_w, int im_h);
+
+typedef struct
+{
+ int x, y;
+ Evas_Glyph_Array *glyphs;
+ RGBA_Gfx_Func func;
+ Evas_Common_Font_Draw_Cb cb;
+} Evas_Font_Draw_Glyphs;
+
+typedef struct
+{
+ int x, y;
+ Evas_Font_Array *texts;
+} Evas_Font_Draw_Array;
+
+/* Calls cb once per area the clip and the cutouts leave visible. */
+static Eina_Bool
+_font_draw_clipped(RGBA_Image *dst, RGBA_Draw_Context *dc, Evas_Font_Draw_Area_Cb cb, const void *data)
{
int ext_x, ext_y, ext_w, ext_h;
int im_w, im_h;
- RGBA_Gfx_Func func;
Cutout_Rect *r;
int c, cx, cy, cw, ch;
int i;
- if (!glyphs) return EINA_FALSE;
-
im_w = dst->cache_entry.w;
im_h = dst->cache_entry.h;
-// evas_common_font_size_use(fn);
- func = evas_common_gfx_func_composite_mask_color_span_get(dc->col.col, dst->cache_entry.flags.alpha, 1, dc->render_op);
-
if (!dc->cutout.rects)
{
ext_x = 0; ext_y = 0; ext_w = im_w; ext_h = im_h;
@@ -346,9 +357,7 @@ evas_common_font_draw_cb(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, E
if (ext_w <= 0) return EINA_FALSE;
if (ext_h <= 0) return EINA_FALSE;
- return cb(dst, dc, x, y, glyphs,
- func, ext_x, ext_y, ext_w, ext_h,
- im_w, im_h);
+ return cb(dst, dc, data, ext_x, ext_y, ext_w, ext_h, im_w, im_h);
}
else
{
@@ -363,8 +372,7 @@ evas_common_font_draw_cb(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, E
{
r = dc->cache.rects->rects + i;
evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
- ret |= cb(dst, dc, x, y, glyphs,
- func, r->x, r->y, r->w, r->h,
+ ret |= cb(dst, dc, data, r->x, r->y, r->w, r->h,
im_w, im_h);
}
evas_common_draw_context_cache_update(dc);
@@ -375,6 +383,64 @@ evas_common_font_draw_cb(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, E
}
}
+static Eina_Bool
+_font_draw_glyphs_area(RGBA_Image *dst, RGBA_Draw_Context *dc, const void *data, int ext_x, int ext_y, int ext_w, int ext_h, int im_w, int im_h)
+{
+ const Evas_Font_Draw_Glyphs *d = data;
+
+ return d->cb(dst, dc, d->x, d->y, d->glyphs, d->func,
+ ext_x, ext_y, ext_w, ext_h, im_w, im_h);
+}
+
+static Eina_Bool
+_font_draw_array_area(RGBA_Image *dst, RGBA_Draw_Context *dc, const void *data, int ext_x, int ext_y, int ext_w, int ext_h, int im_w, int im_h)
+{
+ const Evas_Font_Draw_Array *d = data;
+ Evas_Font_Array_Data *fad;
+ Eina_Bool ret = EINA_FALSE;
+
+ EINA_INARRAY_FOREACH(d->texts->array, fad)
+ {
+ evas_common_draw_context_set_color(dc, fad->color.r, fad->color.g,
+ fad->color.b, fad->color.a);
+ ret |= evas_common_font_rgba_draw(dst, dc, d->x + fad->x, d->y,
+ fad->glyphs, NULL,
+ ext_x, ext_y, ext_w, ext_h,
+ im_w, im_h);
+ }
+ return ret;
+}
+
+EVAS_API Eina_Bool
+evas_common_font_draw_cb(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs, Evas_Common_Font_Draw_Cb cb)
+{
+ Evas_Font_Draw_Glyphs d;
+
+ if (!glyphs) return EINA_FALSE;
+
+ d.x = x;
+ d.y = y;
+ d.glyphs = glyphs;
+ d.cb = cb;
+ d.func = evas_common_gfx_func_composite_mask_color_span_get(dc->col.col, dst->cache_entry.flags.alpha, 1, dc->render_op);
+
+ return _font_draw_clipped(dst, dc, _font_draw_glyphs_area, &d);
+}
+
+EVAS_API void
+evas_common_font_draw_array(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Font_Array *texts)
+{
+ Evas_Font_Draw_Array d;
+
+ if ((!texts) || (!texts->array)) return;
+
+ d.x = x;
+ d.y = y;
+ d.texts = texts;
+
+ _font_draw_clipped(dst, dc, _font_draw_array_area, &d);
+}
+
EVAS_API void
evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs)
{
diff --git a/src/lib/evas/common/evas_font_draw.h b/src/lib/evas/common/evas_font_draw.h
index cf31d6b385..7eece5a8d2 100644
--- a/src/lib/evas/common/evas_font_draw.h
+++ b/src/lib/evas/common/evas_font_draw.h
@@ -8,6 +8,7 @@ typedef Eina_Bool (*Evas_Common_Font_Draw_Cb)(RGBA_Image *dst, RGBA_Draw_Context
EVAS_API Eina_Bool evas_common_font_draw_cb (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs, Evas_Common_Font_Draw_Cb cb);
EVAS_API void evas_common_font_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs);
+EVAS_API void evas_common_font_draw_array (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Font_Array *texts);
EVAS_API Eina_Bool evas_common_font_rgba_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs, RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w, int ext_h, int im_w, int im_h);
EVAS_API void evas_common_font_draw_init (void);
EVAS_API void evas_common_font_draw_prepare (Evas_Text_Props *text_props);
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 02f4f7430f..b7e1e4a93c 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -2917,22 +2917,10 @@ static void
_draw_thread_multi_font_draw(void *data)
{
Evas_Thread_Command_Multi_Font *mf = data;
- Evas_Font_Array_Data *itr;
- EINA_INARRAY_FOREACH(mf->texts->array, itr)
- {
- unsigned int r, g, b, a;
- int x = mf->x + itr->x, y = mf->y;
-
- r = itr->color.r;
- g = itr->color.g;
- b = itr->color.b;
- a = itr->color.a;
-
- eng_context_color_set(NULL, mf->context, r, g, b, a);
- evas_common_font_draw(mf->surface, mf->context, x, y, itr->glyphs);
- evas_common_cpu_end_opt();
- }
+ evas_common_font_draw_array(mf->surface, mf->context, mf->x, mf->y,
+ mf->texts);
+ evas_common_cpu_end_opt();
evas_common_draw_context_free(mf->context);
eina_mempool_free(_mp_command_multi_font, mf);
@@ -2971,6 +2959,9 @@ eng_multi_font_draw(void *engine EINA_UNUSED, void *data EINA_UNUSED, void *cont
if (do_async)
return _multi_font_draw_thread_cmd(surface, context, x, y, texts);
+ evas_common_font_draw_array(surface, context, x, y, texts);
+ evas_common_cpu_end_opt();
+
return EINA_FALSE;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.