forked from enlightenment/efl
2 problems fixed.
1. evas line draws of 2 pixelin size work now. oops! 2. font faces are shared between multiple sizes without a performance hit! yay! SVN revision: 8660
This commit is contained in:
parent
8086b80a5e
commit
6022da9101
|
@ -78,13 +78,6 @@ evas_common_font_source_find(const char *name)
|
|||
{
|
||||
Evas_Object_List *l;
|
||||
|
||||
#if 1
|
||||
/* this effectively disables sharing out loaded outlines between */
|
||||
/* multiple sizes of the same font. because FT_Set_Char_Size() needs */
|
||||
/* to be called to update the fonts size output and caluclations */
|
||||
/* for a different face size, but this can be SLOOOW */
|
||||
return NULL;
|
||||
#endif
|
||||
if (!name) return NULL;
|
||||
for (l = fonts_src; l; l = l->next)
|
||||
{
|
||||
|
@ -120,8 +113,7 @@ void
|
|||
evas_common_font_size_use(RGBA_Font *fn)
|
||||
{
|
||||
if (fn->src->current_size == fn->real_size) return;
|
||||
/* This call is evil and SLOW! */
|
||||
FT_Set_Char_Size(fn->src->ft.face, 0, fn->real_size, 96, 96);
|
||||
FT_Activate_Size(fn->ft.size);
|
||||
fn->src->current_size = fn->real_size;
|
||||
}
|
||||
|
||||
|
@ -180,6 +172,13 @@ evas_common_font_load_init(RGBA_Font *fn)
|
|||
{
|
||||
int error;
|
||||
|
||||
if (fn->src->references == 1)
|
||||
fn->ft.size = fn->src->ft.face->size;
|
||||
else
|
||||
{
|
||||
error = FT_New_Size(fn->src->ft.face, &(fn->ft.size));
|
||||
FT_Activate_Size(fn->ft.size);
|
||||
}
|
||||
fn->real_size = fn->size * 64;
|
||||
error = FT_Set_Char_Size(fn->src->ft.face, 0, fn->real_size, 96, 96);
|
||||
if (error)
|
||||
|
@ -254,7 +253,6 @@ evas_common_font_load_init(RGBA_Font *fn)
|
|||
}
|
||||
*/
|
||||
}
|
||||
|
||||
fn->glyphs = NULL;
|
||||
fn->usage = 0;
|
||||
fn->references = 1;
|
||||
|
@ -351,6 +349,8 @@ evas_common_font_flush_last(void)
|
|||
}
|
||||
if (!fn) return;
|
||||
|
||||
if (fn->src->references > 1) FT_Done_Size(fn->ft.size);
|
||||
|
||||
fonts = evas_object_list_remove(fonts, fn);
|
||||
evas_common_font_modify_cache_by(fn, -1);
|
||||
|
||||
|
|
|
@ -33,6 +33,53 @@ evas_common_line_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x1, int y1, in
|
|||
|
||||
if ((dx == 0) && (dy == 0))
|
||||
{
|
||||
if ((x1 < 0) ||
|
||||
(y1 < 0) ||
|
||||
(x1 >= dst->image->w) ||
|
||||
(y1 >= dst->image->h))
|
||||
return;
|
||||
if (dc->clip.use)
|
||||
{
|
||||
if ((x1 < dc->clip.x) ||
|
||||
(y1 < dc->clip.y) ||
|
||||
(x1 >= (dc->clip.x + dc->clip.w)) ||
|
||||
(y1 >= (dc->clip.y + dc->clip.h)))
|
||||
return;
|
||||
}
|
||||
if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
|
||||
{
|
||||
DATA32 __blend_tmp;
|
||||
DATA8 __blend_a;
|
||||
|
||||
ptr = dst->image->data + (y1 * dst->image->w) + x1;
|
||||
__blend_a = _evas_pow_lut[A_VAL(&(col))][A_VAL(ptr)];
|
||||
|
||||
BLEND_COLOR(__blend_a, R_VAL(ptr),
|
||||
R_VAL(&(col)), R_VAL(ptr),
|
||||
__blend_tmp);
|
||||
BLEND_COLOR(__blend_a, G_VAL(ptr),
|
||||
G_VAL(&(col)), G_VAL(ptr),
|
||||
__blend_tmp);
|
||||
BLEND_COLOR(__blend_a, B_VAL(ptr),
|
||||
B_VAL(&(col)), B_VAL(ptr),
|
||||
__blend_tmp);
|
||||
A_VAL(ptr) = A_VAL(ptr) + ((A_VAL(&(col)) * (255 - A_VAL(ptr))) / 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
DATA32 __blend_tmp;
|
||||
|
||||
ptr = dst->image->data + (y1 * dst->image->w) + x1;
|
||||
BLEND_COLOR(A_VAL(&(col)), R_VAL(ptr),
|
||||
R_VAL(&(col)), R_VAL(ptr),
|
||||
__blend_tmp);
|
||||
BLEND_COLOR(A_VAL(&(col)), G_VAL(ptr),
|
||||
G_VAL(&(col)), G_VAL(ptr),
|
||||
__blend_tmp);
|
||||
BLEND_COLOR(A_VAL(&(col)), B_VAL(ptr),
|
||||
B_VAL(&(col)), B_VAL(ptr),
|
||||
__blend_tmp);
|
||||
}
|
||||
/* point draw */
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -338,6 +338,10 @@ struct _RGBA_Font
|
|||
|
||||
int size;
|
||||
int real_size;
|
||||
|
||||
struct {
|
||||
FT_Size size;
|
||||
} ft;
|
||||
|
||||
Evas_Hash *glyphs;
|
||||
|
||||
|
|
Loading…
Reference in New Issue