aaah... so.. if we have a fribidi lock.. shall we.. hmrrrm maybe use

it? and... lets not just throw pointer onto pipelines just for the
hell of it.. as like.. hmm the object owning the pointer might be
freed before pipelien finishes.. or hell. it might change pointer
contents? :) need to nwo dup bidi intl_props. probably a better plan..
tasn looking at you... is to fix up evas bidi utils and make the intl
props a new/free thing (and sharable eh?) with reference counts to
avoid dups (just ref up most of the time - and if u change, make a new
intl prop - dont change current one) etc. etc. for now dup - this
gives a perf hit tho. at least async rendering works now.



SVN revision: 51736
This commit is contained in:
Carsten Haitzler 2010-08-30 03:21:15 +00:00
parent f3faf1730b
commit 075531cc54
6 changed files with 115 additions and 29 deletions

View File

@ -224,6 +224,8 @@ evas_bidi_update_props(const Eina_Unicode *eina_ustr, Evas_BiDi_Paragraph_Props
free(bidi_props->char_types);
}
bidi_props->char_types = char_types;
bidi_props->len = len;
if (base_ustr) free(base_ustr);
@ -239,6 +241,61 @@ cleanup:
return len;
}
int
evas_bidi_update_props_dup(const Evas_BiDi_Props *src, Evas_BiDi_Props *dst)
{
dst->start = src->start;
dst->props = NULL;
if (!src->props) return 1;
dst->props = malloc(sizeof(Evas_BiDi_Paragraph_Props));
if (!dst->props) return 0;
if (src->props->len > 0)
{
if (src->props->char_types)
{
dst->props->char_types =
malloc(sizeof(EvasBiDiCharType) * src->props->len);
if (!dst->props->char_types)
{
free(dst->props);
dst->props = NULL;
dst->start = 0;
return 0;
}
memcpy(dst->props->char_types, src->props->char_types,
sizeof(EvasBiDiCharType) * src->props->len);
}
else
dst->props->char_types = NULL;
if (src->props->embedding_levels)
{
dst->props->embedding_levels =
malloc(sizeof(EvasBiDiLevel) * src->props->len);
if (!dst->props->embedding_levels)
{
if (dst->props->char_types) free(dst->props->char_types);
free(dst->props);
dst->props = NULL;
dst->start = 0;
return 0;
}
memcpy(dst->props->embedding_levels, src->props->embedding_levels,
sizeof(EvasBiDiLevel) * src->props->len);
}
else
dst->props->embedding_levels = NULL;
}
else
{
dst->props->char_types = NULL;
dst->props->embedding_levels = NULL;
dst->props->len = 0;
}
dst->props->len = src->props->len;
dst->props->direction = src->props->direction;
return 1;
}
/**
* @internal
* Reorders ustr according to the bidi props.

View File

@ -67,6 +67,7 @@ typedef struct _Evas_BiDi_Props Evas_BiDi_Props;
struct _Evas_BiDi_Paragraph_Props {
EvasBiDiCharType *char_types; /* BiDi char types */
EvasBiDiLevel *embedding_levels; /* BiDi embedding levels */
int len; /* length of char_types & embedding_levels */
#ifdef USE_FRIBIDI
EvasBiDiParType direction;
#endif
@ -112,6 +113,8 @@ evas_bidi_props_reorder_line(Eina_Unicode *text, const Evas_BiDi_Props *intl_pro
int
evas_bidi_update_props(const Eina_Unicode *text, Evas_BiDi_Paragraph_Props *intl_props) EINA_ARG_NONNULL(1, 2);
int
evas_bidi_update_props_dup(const Evas_BiDi_Props *src, Evas_BiDi_Props *dst);
Eina_Bool
evas_bidi_shape_string(Eina_Unicode *ustr, const Evas_BiDi_Props *intl_props, size_t len);

View File

@ -50,10 +50,6 @@ evas_common_font_draw_init(void)
{
char *p;
int tmp;
#ifdef EVAS_FRAME_QUEUING
LKI(lock_font_draw);
LKI(lock_fribidi);
#endif
if ((p = getenv("EVAS_WORD_CACHE_MAX_WORDS")))
{
tmp = strtol(p,NULL,10);
@ -67,9 +63,7 @@ evas_common_font_draw_init(void)
#ifdef EVAS_FRAME_QUEUING
EAPI void
evas_common_font_draw_finish(void)
{
LKD(lock_font_draw);
LKD(lock_fribidi);
{
}
#endif
@ -488,6 +482,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
#endif
#ifdef BIDI_SUPPORT
LKL(lock_fribidi);
Eina_Unicode *visual_text;
visual_text = eina_unicode_strdup(in_text);
@ -501,6 +496,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
{
text = in_text;
}
LKU(lock_fribidi);
#endif
@ -743,7 +739,7 @@ evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font *fn, int
if (ext_w <= 0) return;
if (ext_h <= 0) return;
#ifndef EVAS_FRAME_QUEUING
#ifdef EVAS_FRAME_QUEUING
LKL(fn->lock);
#endif
// evas_common_font_size_use(fn);
@ -778,7 +774,7 @@ evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font *fn, int
}
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
}
#ifndef EVAS_FRAME_QUEUING
#ifdef EVAS_FRAME_QUEUING
LKU(fn->lock);
#endif
}
@ -851,6 +847,7 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, Eva
{
int kern = 0;
# ifdef BIDI_SUPPORT
LKL(lock_fribidi);
/* if it's rtl, the kerning matching should be reversed, i.e prev
* index is now the index and the other way around.
* There is a slight exception when there are compositing chars
@ -863,14 +860,18 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, Eva
pen_x += kern;
}
else
# endif
{
{
if (evas_common_font_query_kerning(fi, prev_index, ci->index, &kern))
pen_x += kern;
}
}
LKU(lock_fribidi);
# else
if (evas_common_font_query_kerning(fi, prev_index, ci->index, &kern))
pen_x += kern;
# endif
}
pface = fi->src->ft.face;
LKU(fi->ft_mutex);

View File

@ -111,24 +111,28 @@ evas_common_font_query_size(RGBA_Font *fn, const Eina_Unicode *text, const Evas_
(pface == fi->src->ft.face))
{
#ifdef BIDI_SUPPORT
LKL(lock_fribidi);
/* if it's rtl, the kerning matching should be reversed, i.e prev
* index is now the index and the other way around.
* There is a slight exception when there are compositing chars
* involved.*/
if (intl_props &&
evas_bidi_is_rtl_char(intl_props->props->embedding_levels, char_index) &&
fg->glyph->advance.x >> 16 > 0)
evas_bidi_is_rtl_char(intl_props->props->embedding_levels, char_index) &&
fg->glyph->advance.x >> 16 > 0)
{
if (evas_common_font_query_kerning(fi, index, prev_index, &kern))
pen_x += kern;
pen_x += kern;
}
else
#endif
{
if (evas_common_font_query_kerning(fi, prev_index, index, &kern))
pen_x += kern;
pen_x += kern;
}
LKU(lock_fribidi);
#else
if (evas_common_font_query_kerning(fi, prev_index, index, &kern))
pen_x += kern;
#endif
}
pface = fi->src->ft.face;
@ -273,6 +277,7 @@ evas_common_font_query_advance(RGBA_Font *fn, const Eina_Unicode *text, const Ev
(pface == fi->src->ft.face))
{
#ifdef BIDI_SUPPORT
LKL(lock_fribidi);
/* if it's rtl, the kerning matching should be reversed, i.e prev
* index is now the index and the other way around.
* There is a slight exception when there are compositing chars
@ -285,12 +290,15 @@ evas_common_font_query_advance(RGBA_Font *fn, const Eina_Unicode *text, const Ev
pen_x += kern;
}
else
#endif
{
if (evas_common_font_query_kerning(fi, prev_index, index, &kern))
pen_x += kern;
}
LKU(lock_fribidi);
#else
if (evas_common_font_query_kerning(fi, prev_index, index, &kern))
pen_x += kern;
#endif
}
pface = fi->src->ft.face;
@ -333,8 +341,8 @@ evas_common_font_query_char_coords(RGBA_Font *fn, const Eina_Unicode *in_text, c
EvasBiDiStrIndex *visual_to_logical = NULL;
Eina_Unicode *visual_text;
LKL(lock_fribidi);
visual_text = eina_unicode_strdup(in_text);
if (visual_text)
{
evas_bidi_props_reorder_line(visual_text, intl_props, &visual_to_logical);
@ -345,6 +353,7 @@ evas_common_font_query_char_coords(RGBA_Font *fn, const Eina_Unicode *in_text, c
text = in_text;
}
len = eina_unicode_strlen(text);
LKU(lock_fribidi);
#endif
fi = fn->fonts->data;
@ -366,8 +375,10 @@ evas_common_font_query_char_coords(RGBA_Font *fn, const Eina_Unicode *in_text, c
desc = evas_common_font_max_descent_get(fn);
#ifdef BIDI_SUPPORT
LKL(lock_fribidi);
/* Get the position in the visual string because those are the coords we care about */
position = evas_bidi_position_logical_to_visual(visual_to_logical, len, pos);
LKU(lock_fribidi);
#else
position = pos;
#endif
@ -479,6 +490,7 @@ evas_common_font_query_char_at_coords(RGBA_Font *fn, const Eina_Unicode *in_text
EvasBiDiStrIndex *visual_to_logical = NULL;
Eina_Unicode *visual_text;
LKL(lock_fribidi);
visual_text = eina_unicode_strdup(in_text);
if (visual_text)
@ -491,6 +503,7 @@ evas_common_font_query_char_at_coords(RGBA_Font *fn, const Eina_Unicode *in_text
text = in_text;
}
len = eina_unicode_strlen(text);
LKU(lock_fribidi);
#endif
fi = fn->fonts->data;
@ -580,10 +593,12 @@ evas_common_font_query_char_at_coords(RGBA_Font *fn, const Eina_Unicode *in_text
if (cw) *cw = chr_w;
if (ch) *ch = asc + desc;
#ifdef BIDI_SUPPORT
LKL(lock_fribidi);
/* we found the char position of the wanted char in the
* visual string, we now need to translate it to the
* position in the logical string */
position = evas_bidi_position_visual_to_logical(visual_to_logical, position);
LKU(lock_fribidi);
#endif
ret_val = position;
goto end;
@ -659,6 +674,7 @@ evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const Eina_Unicode *in_text
(pface == fi->src->ft.face))
{
#ifdef BIDI_SUPPORT
LKL(lock_fribidi);
/* if it's rtl, the kerning matching should be reversed, i.e prev
* index is now the index and the other way around.
* There is a slight exception when there are compositing chars
@ -672,13 +688,17 @@ evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const Eina_Unicode *in_text
pen_x += kern;
}
else
#endif
{
if (evas_common_font_query_kerning(fi, prev_index, index,
&kern))
pen_x += kern;
}
LKU(lock_fribidi);
#else
if (evas_common_font_query_kerning(fi, prev_index, index,
&kern))
pen_x += kern;
#endif
}
pface = fi->src->ft.face;
fg = evas_common_font_int_cache_glyph_get(fi, index);

View File

@ -1185,6 +1185,9 @@ evas_common_pipe_op_text_free(RGBA_Pipe_Op *op)
#else
evas_common_font_free(op->op.text.font);
#endif
#ifdef BIDI_SUPPORT
evas_bidi_props_clean(&(op->op.text.intl_props));
#endif
free(op->op.text.text);
evas_common_pipe_op_free(op);
}
@ -1223,13 +1226,13 @@ evas_common_pipe_text_draw_do(RGBA_Image *dst, RGBA_Pipe_Op *op, RGBA_Pipe_Threa
#endif
evas_common_font_draw(dst, &(context),
op->op.text.font, op->op.text.x, op->op.text.y,
op->op.text.text, op->op.text.intl_props);
op->op.text.text, &op->op.text.intl_props);
}
else
{
evas_common_font_draw(dst, &(op->context),
op->op.text.font, op->op.text.x, op->op.text.y,
op->op.text.text, op->op.text.intl_props);
op->op.text.text, &op->op.text.intl_props);
}
}
@ -1245,7 +1248,9 @@ evas_common_pipe_text_draw(RGBA_Image *dst, RGBA_Draw_Context *dc,
op->op.text.x = x;
op->op.text.y = y;
op->op.text.text = eina_unicode_strdup(text);
op->op.text.intl_props = intl_props;
#ifdef BIDI_SUPPORT
evas_bidi_update_props_dup(intl_props, &(op->op.text.intl_props));
#endif
#ifdef EVAS_FRAME_QUEUING
LKL(fn->ref_fq_add);
fn->ref_fq[0]++;

View File

@ -675,7 +675,7 @@ struct _RGBA_Pipe_Op
RGBA_Font *font;
int x, y;
Eina_Unicode *text;
const Evas_BiDi_Props *intl_props;
Evas_BiDi_Props intl_props;
} text;
struct {
RGBA_Image *src;