From a9bdfcca37f56c70e4ee30cc9b8edf1752ac86f3 Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Thu, 29 Nov 2012 20:47:12 +0000 Subject: [PATCH] evas/font: Refactor common code for font drawing This patch refactors common code for font draws - so that it can be used by other engines and *threaded* X11. Signed-off-by: Paulo Alcantara Patch by: Paulo Alcantara SVN revision: 79853 --- src/lib/evas/common/evas_font.h | 3 +++ src/lib/evas/common/evas_font_draw.c | 21 ++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/lib/evas/common/evas_font.h b/src/lib/evas/common/evas_font.h index 6517aa7f87..b259e63c8c 100644 --- a/src/lib/evas/common/evas_font.h +++ b/src/lib/evas/common/evas_font.h @@ -18,6 +18,9 @@ EAPI int evas_common_font_get_line_advance (RGBA_Font *fn); /* draw */ +typedef void (*Evas_Common_Font_Draw_Cb)(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, const Evas_Text_Props *text_props, RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w, int ext_h, int im_w, int im_h); + +EAPI void evas_common_font_draw_cb (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, const Evas_Text_Props *intl_props, Evas_Common_Font_Draw_Cb cb); EAPI void evas_common_font_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, const Evas_Text_Props *intl_props); EAPI int evas_common_font_glyph_search (RGBA_Font *fn, RGBA_Font_Int **fi_ret, Eina_Unicode gl); EAPI RGBA_Font_Glyph *evas_common_font_int_cache_glyph_get (RGBA_Font_Int *fi, FT_UInt index); diff --git a/src/lib/evas/common/evas_font_draw.c b/src/lib/evas/common/evas_font_draw.c index 0c760e6174..784884270e 100644 --- a/src/lib/evas/common/evas_font_draw.c +++ b/src/lib/evas/common/evas_font_draw.c @@ -299,7 +299,7 @@ evas_common_font_draw_prepare(Evas_Text_Props *text_props) } EAPI void -evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, const Evas_Text_Props *text_props) +evas_common_font_draw_cb(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, const Evas_Text_Props *text_props, Evas_Common_Font_Draw_Cb cb) { static Cutout_Rects *rects = NULL; int ext_x, ext_y, ext_w, ext_h; @@ -342,9 +342,9 @@ evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, cons if (!dc->cutout.rects) { - evas_common_font_draw_internal(dst, dc, x, y, text_props, - func, ext_x, ext_y, ext_w, ext_h, - im_w, im_h); + cb(dst, dc, x, y, text_props, + func, ext_x, ext_y, ext_w, ext_h, + im_w, im_h); } else { @@ -358,15 +358,22 @@ evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, cons { r = rects->rects + i; evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h); - evas_common_font_draw_internal(dst, dc, x, y, text_props, - func, r->x, r->y, r->w, r->h, - im_w, im_h); + cb(dst, dc, x, y, text_props, + func, r->x, r->y, r->w, r->h, + im_w, im_h); } } dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch; } } +EAPI void +evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, const Evas_Text_Props *text_props) +{ + evas_common_font_draw_cb(dst, dc, x, y, text_props, + evas_common_font_draw_internal); +} + EAPI void evas_common_font_draw_do(const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Gfx_Func func, RGBA_Image *dst, RGBA_Draw_Context *dc,