evas/font: Refactor common code for font drawing
authorPaulo Alcantara <pcacjr@profusion.mobi>
Thu, 29 Nov 2012 20:47:12 +0000 (20:47 +0000)
committerGustavo Sverzut Barbieri <barbieri@gmail.com>
Thu, 29 Nov 2012 20:47:12 +0000 (20:47 +0000)
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

src/lib/evas/common/evas_font.h
src/lib/evas/common/evas_font_draw.c

index 6517aa7..b259e63 100644 (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);
index 0c760e6..7848842 100644 (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,9 +358,9 @@ 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;
@@ -368,6 +368,13 @@ evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, cons
 }
 
 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,
                          int x, int y, const Evas_Text_Props *text_props)