From 825a3d837a33f226c879cd02ad15c3fba57e8b2c Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 23 Jan 2012 23:30:42 +1000 Subject: Update the EFL to what I'm actually using, coz I'm using some stuff not yet released. --- .../evas/src/lib/engines/common/evas_font_draw.c | 135 ++++++++++++++------- 1 file changed, 89 insertions(+), 46 deletions(-) (limited to 'libraries/evas/src/lib/engines/common/evas_font_draw.c') diff --git a/libraries/evas/src/lib/engines/common/evas_font_draw.c b/libraries/evas/src/lib/engines/common/evas_font_draw.c index 94aa085..638cdfe 100644 --- a/libraries/evas/src/lib/engines/common/evas_font_draw.c +++ b/libraries/evas/src/lib/engines/common/evas_font_draw.c @@ -22,7 +22,7 @@ static int max_cached_words = WORD_CACHE_NWORDS; -struct prword +struct prword { EINA_INLIST; struct cinfo *cinfo; @@ -34,16 +34,16 @@ struct prword int baseline; }; -struct cinfo +struct cinfo { FT_UInt index; - struct + struct { int x, y; } pos; int posx; RGBA_Font_Glyph *fg; - struct + struct { int w,h; int rows; @@ -77,11 +77,11 @@ evas_common_font_draw_init(void) #ifdef EVAS_FRAME_QUEUING EAPI void evas_common_font_draw_finish(void) -{ +{ } #endif -/* +/* * BiDi handling: We receive the shaped string + other props from text_props, * we need to reorder it so we'll have the visual string (the way we draw) * and then for kerning we have to switch the order of the kerning query (as the prev @@ -89,7 +89,7 @@ evas_common_font_draw_finish(void) */ static void evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font *fn __UNUSED__, int x, int y, - const Evas_Text_Props *text_props, RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w, + 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 __UNUSED__) { DATA32 *im; @@ -136,7 +136,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font { xrun -= x + xrun - ext_x - ext_w; } - if (x < ext_x) + if (x < ext_x) { int excess = ext_x - x; xstart = excess - 1; @@ -244,10 +244,29 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font if (j < w) j = w; h = fg->glyph_out->bitmap.rows; /* - if ((fg->glyph_out->bitmap.pixel_mode == ft_pixel_mode_grays) - && (fg->glyph_out->bitmap.num_grays == 256) - ) - */ + if ((fg->glyph_out->bitmap.pixel_mode == ft_pixel_mode_grays) + && (fg->glyph_out->bitmap.num_grays == 256) + ) + */ + +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_FONT + int index; + DATA32 *font_alpha_buffer; + pixman_image_t *font_mask_image; + + font_alpha_buffer = alloca(w * h * sizeof(DATA32)); + for (index = 0; index < (w * h); index++) + font_alpha_buffer[index] = data[index] << 24; + + font_mask_image = pixman_image_create_bits(PIXMAN_a8r8g8b8, w, h, + font_alpha_buffer, + w * sizeof(DATA32)); + + if (!font_mask_image) return; +# endif +#endif + { if ((j > 0) && (chr_x + w > ext_x)) { @@ -255,44 +274,63 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font { /* ext glyph draw */ dc->font_ext.func.gl_draw(dc->font_ext.data, - (void *)dst, - dc, fg, chr_x, - y - (chr_y - y)); + (void *)dst, + dc, fg, chr_x, + y - (chr_y - y)); } else { if ((fg->glyph_out->bitmap.num_grays == 256) && - (fg->glyph_out->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY)) + (fg->glyph_out->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY)) { - for (i = 0; i < h; i++) +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_FONT + if ((dst->pixman.im) && + (dc->col.pixman_color_image)) + pixman_image_composite(PIXMAN_OP_OVER, + dc->col.pixman_color_image, + font_mask_image, + dst->pixman.im, + chr_x, + y - (chr_y - y), + 0, 0, + chr_x, + y - (chr_y - y), + w, h); + else +# endif +#endif { - int dx, dy; - int in_x, in_w; - - in_x = 0; - in_w = 0; - dx = chr_x; - dy = y - (chr_y - i - y); + for (i = 0; i < h; i++) + { + int dx, dy; + int in_x, in_w; + + in_x = 0; + in_w = 0; + dx = chr_x; + dy = y - (chr_y - i - y); #ifdef EVAS_SLI - if (((dy) % dc->sli.h) == dc->sli.y) + if (((dy) % dc->sli.h) == dc->sli.y) #endif - { - if ((dx < (ext_x + ext_w)) && - (dy >= (ext_y)) && - (dy < (ext_y + ext_h))) { - if (dx + w > (ext_x + ext_w)) - in_w += (dx + w) - (ext_x + ext_w); - if (dx < ext_x) + if ((dx < (ext_x + ext_w)) && + (dy >= (ext_y)) && + (dy < (ext_y + ext_h))) { - in_w += ext_x - dx; - in_x = ext_x - dx; - dx = ext_x; - } - if (in_w < w) - { - func(NULL, data + (i * j) + in_x, dc->col.col, - im + (dy * im_w) + dx, w - in_w); + if (dx + w > (ext_x + ext_w)) + in_w += (dx + w) - (ext_x + ext_w); + if (dx < ext_x) + { + in_w += ext_x - dx; + in_x = ext_x - dx; + dx = ext_x; + } + if (in_w < w) + { + func(NULL, data + (i * j) + in_x, dc->col.col, + im + (dy * im_w) + dx, w - in_w); + } } } } @@ -309,7 +347,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font { int dx, dy; int in_x, in_w, end; - + in_x = 0; in_w = 0; dx = chr_x; @@ -333,8 +371,8 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font dp++; } if ((dx < (ext_x + ext_w)) && - (dy >= (ext_y)) && - (dy < (ext_y + ext_h))) + (dy >= (ext_y)) && + (dy < (ext_y + ext_h))) { if (dx + w > (ext_x + ext_w)) in_w += (dx + w) - (ext_x + ext_w); @@ -347,7 +385,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font if (in_w < w) { func(NULL, tmpbuf + in_x, dc->col.col, - im + (dy * im_w) + dx, w - in_w); + im + (dy * im_w) + dx, w - in_w); } } } @@ -356,6 +394,11 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font } } } +#ifdef HAVE_PIXMAN +# ifdef PIXMAN_FONT + pixman_image_unref(font_mask_image); +# endif +#endif } else break; @@ -573,7 +616,7 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Evas_Text_Props *text_prop } } } - else + else { im = NULL; } @@ -599,7 +642,7 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Evas_Text_Props *text_prop { struct prword *last = (struct prword *)(words->last); - if (last) + if (last) { if (last->im) free(last->im); if (last->cinfo) free(last->cinfo); -- cgit v1.1