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 <pcacjr@profusion.mobi>

Patch by: Paulo Alcantara <pcacjr@profusion.mobi>



SVN revision: 79853
This commit is contained in:
Paulo Alcantara 2012-11-29 20:47:12 +00:00 committed by Gustavo Sverzut Barbieri
parent bf451a024a
commit a9bdfcca37
2 changed files with 17 additions and 7 deletions

View File

@ -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);

View File

@ -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,