forked from enlightenment/efl
evas - font rendering - dont crash if we have color fonts and gl and sw
so if you use sw and gl enignes in a process and have color font glyphs.. *BOOM* because the color glyph code used ext dat that was intended for engines to extend with a gotcha of "only 1 engine can extend this"... commented already. so this unfortunately adds an extra ptr per glyph to store color data explicitly. but now it both renders right and doesn't crash. we still have a limit of 1 engine alone can extend glyphs with ext_dat though. @fix
This commit is contained in:
parent
79228cd723
commit
5f5e95e336
|
@ -315,6 +315,7 @@ struct _RGBA_Font_Glyph
|
|||
Evas_Coord y_bear;
|
||||
FT_Glyph glyph;
|
||||
RGBA_Font_Glyph_Out *glyph_out;
|
||||
void *col_dat;
|
||||
/* this is a problem - only 1 engine at a time can extend such a font... grrr */
|
||||
void *ext_dat;
|
||||
void (*ext_dat_free) (void *ext_dat);
|
||||
|
|
|
@ -35,12 +35,6 @@ _evas_font_image_new(RGBA_Font_Glyph *fg, int alpha, Evas_Colorspace cspace)
|
|||
return evas_cache_image_data(evas_common_image_cache_get(), src_w, src_h, image_data, alpha, cspace);
|
||||
}
|
||||
|
||||
static void
|
||||
_evas_font_image_free(void *image)
|
||||
{
|
||||
evas_cache_image_drop(image);
|
||||
}
|
||||
|
||||
static void
|
||||
_evas_font_image_draw(void *context, void *surface, void *image, RGBA_Font_Glyph *fg, int x, int y, int w, int h, int smooth)
|
||||
{
|
||||
|
@ -123,19 +117,21 @@ evas_common_font_rgba_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
|
|||
fg->ext_dat_free = dc->font_ext.func.gl_free;
|
||||
}
|
||||
|
||||
if ((!fg->ext_dat) && FT_HAS_COLOR(fg->fi->src->ft.face))
|
||||
{
|
||||
if (dc->font_ext.func.gl_image_new)
|
||||
{
|
||||
if ((!fg->ext_dat) && FT_HAS_COLOR(fg->fi->src->ft.face))
|
||||
{
|
||||
/* extension calls */
|
||||
fg->ext_dat = dc->font_ext.func.gl_image_new
|
||||
(dc->font_ext.data, fg, EINA_TRUE, EVAS_COLORSPACE_ARGB8888);
|
||||
fg->ext_dat_free = dc->font_ext.func.gl_image_free;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fg->ext_dat = _evas_font_image_new(fg, EINA_TRUE, EVAS_COLORSPACE_ARGB8888);
|
||||
fg->ext_dat_free = _evas_font_image_free;
|
||||
if ((!fg->col_dat) && FT_HAS_COLOR(fg->fi->src->ft.face))
|
||||
{
|
||||
fg->col_dat = _evas_font_image_new(fg, EINA_TRUE, EVAS_COLORSPACE_ARGB8888);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,15 +154,15 @@ evas_common_font_rgba_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
|
|||
ext_x, ext_y,
|
||||
ext_w, ext_h);
|
||||
}
|
||||
else if ((fg->ext_dat) && FT_HAS_COLOR(fg->fi->src->ft.face))
|
||||
else if (FT_HAS_COLOR(fg->fi->src->ft.face))
|
||||
{
|
||||
if (dc->font_ext.func.gl_image_draw)
|
||||
if ((fg->ext_dat) && (dc->font_ext.func.gl_image_draw))
|
||||
dc->font_ext.func.gl_image_draw
|
||||
(dc->font_ext.data, fg->ext_dat,
|
||||
chr_x, y - (chr_y - y), w, h, EINA_TRUE);
|
||||
else
|
||||
else if (fg->col_dat)
|
||||
_evas_font_image_draw
|
||||
(dc, dst, fg->ext_dat, fg,
|
||||
(dc, dst, fg->col_dat, fg,
|
||||
chr_x, y - (chr_y - y), w, h, EINA_TRUE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "evas_common_private.h"
|
||||
#include <assert.h>
|
||||
#include "evas_font_ot.h"
|
||||
|
||||
|
@ -996,6 +997,8 @@ _font_int_ext_clear(RGBA_Font_Int *fi)
|
|||
fg->ext_dat = NULL;
|
||||
fg->ext_dat_free = NULL;
|
||||
}
|
||||
if (fg->col_dat) evas_cache_image_drop(fg->col_dat);
|
||||
fg->col_dat = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -435,6 +435,7 @@ _glyph_free(RGBA_Font_Glyph *fg)
|
|||
FT_Done_Glyph(fg->glyph);
|
||||
/* extension calls */
|
||||
if (fg->ext_dat_free) fg->ext_dat_free(fg->ext_dat);
|
||||
if (fg->col_dat) evas_cache_image_drop(fg->col_dat);
|
||||
free(fg);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue