From 386a5b9eb536656a1276ce09f19c473069bf129b Mon Sep 17 00:00:00 2001 From: Govindaraju SM Date: Thu, 14 Oct 2010 21:49:13 +0530 Subject: [PATCH] [SVN MERGE] Change set 51891 to 52920 done. --- src/lib/canvas/evas_object_textblock.c | 34 ++--------- src/lib/engines/common/evas_bidi_utils.c | 19 +++---- src/modules/engines/gl_common/evas_gl_common.h | 3 +- src/modules/engines/gl_common/evas_gl_context.c | 76 +++++++++++++++++++++++-- src/modules/engines/gl_common/evas_gl_image.c | 7 ++- 5 files changed, 92 insertions(+), 47 deletions(-) diff --git a/src/lib/canvas/evas_object_textblock.c b/src/lib/canvas/evas_object_textblock.c index 6e71cdf..b402562 100644 --- a/src/lib/canvas/evas_object_textblock.c +++ b/src/lib/canvas/evas_object_textblock.c @@ -1065,36 +1065,7 @@ static const char *linefillstr = NULL; static void _format_command_init(void) { - /* if (fontstr) return; - fontstr = eina_stringshare_add("font"); - font_fallbacksstr = eina_stringshare_add("font_fallbacks"); - font_sizestr = eina_stringshare_add("font_size"); - font_sourcestr = eina_stringshare_add("font_source"); - colorstr = eina_stringshare_add("color"); - underline_colorstr = eina_stringshare_add("underline_color"); - underline2_colorstr = eina_stringshare_add("underline2_color"); - outline_colorstr = eina_stringshare_add("outline_color"); - shadow_colorstr = eina_stringshare_add("shadow_color"); - glow_colorstr = eina_stringshare_add("glow_color"); - glow2_colorstr = eina_stringshare_add("glow2_color"); - backing_colorstr = eina_stringshare_add("backing_color"); - strikethrough_colorstr = eina_stringshare_add("strikethrough_color"); - alignstr = eina_stringshare_add("align"); - valignstr = eina_stringshare_add("valign"); - wrapstr = eina_stringshare_add("wrap"); - left_marginstr = eina_stringshare_add("left_margin"); - right_marginstr = eina_stringshare_add("right_margin"); - underlinestr = eina_stringshare_add("underline"); - strikethroughstr = eina_stringshare_add("strikethrough"); - backingstr = eina_stringshare_add("backing"); - stylestr = eina_stringshare_add("style"); - tabstopsstr = eina_stringshare_add("tabstops"); - linesizestr = eina_stringshare_add("linesize"); - linerelsizestr = eina_stringshare_add("linerelsize"); - linegapstr = eina_stringshare_add("linegap"); - linerelgapstr = eina_stringshare_add("linerelgap"); - itemstr = eina_stringshare_add("item"); */ - if (format_refcount == 0) + if (format_refcount == 0) { fontstr = eina_stringshare_add("font"); font_fallbacksstr = eina_stringshare_add("font_fallbacks"); @@ -6277,8 +6248,11 @@ evas_textblock_cursor_range_delete(Evas_Textblock_Cursor *cur1, Evas_Textblock_C if (should_merge) { + /* We call this function instead of the cursor one because we already + * updated the cursors */ _evas_textblock_nodes_merge(o, n1); } + #ifdef BIDI_SUPPORT evas_bidi_paragraph_props_unref(n1->bidi_props); n1->bidi_props = evas_bidi_paragraph_props_get( diff --git a/src/lib/engines/common/evas_bidi_utils.c b/src/lib/engines/common/evas_bidi_utils.c index ccc79ca..7cdc69e 100644 --- a/src/lib/engines/common/evas_bidi_utils.c +++ b/src/lib/engines/common/evas_bidi_utils.c @@ -105,7 +105,8 @@ evas_bidi_shape_string(Eina_Unicode *eina_ustr, const Evas_BiDi_Props *bidi_prop /* The size of fribidichar is different than eina_unicode, convert */ /*FIXME: Make this comparison at compile time and compile out - * unwanted code. - In all of this source file. */ + * unwanted code. - In all of this source file. (including the actual + * function declerations. */ if (sizeof(Eina_Unicode) != sizeof(FriBidiChar)) { base_ustr = ustr = calloc(len + 1, sizeof(FriBidiChar)); @@ -145,15 +146,11 @@ evas_bidi_shape_string(Eina_Unicode *eina_ustr, const Evas_BiDi_Props *bidi_prop /** * @internal - * Updates the bidi properties according to ustr. First checks to see if the - * passed has rtl chars, if not, it cleans intl_props and returns. - * Otherwise, it essentially frees the old fields, allocates new fields, and - * populates them. - * On error: bidi_props is cleaned. + * Allocates bidi properties according to ustr. First checks to see if the + * passed has rtl chars, if not, it returns NULL. * * @param ustr The string to update according to. - * @param bidi_props the bidi_props to update. - * @return returns the length of the string on success, a negative value on error. + * @return returns allocated paragraph props on success, NULL otherwise. */ Evas_BiDi_Paragraph_Props * @@ -261,7 +258,7 @@ evas_bidi_props_copy_and_ref(const Evas_BiDi_Props *src, Evas_BiDi_Props *dst) * @internal * Reorders ustr according to the bidi props. * - * @param ustr the string to reorder. + * @param ustr the string to reorder. - Null is ok, will just populate the map. * @param intl_props the intl properties to rerorder according to. * @param _v_to_l The visual to logical map to populate - if NULL it won't populate it. * @return #EINA_FALSE on success, #EINA_TRUE on error. @@ -362,7 +359,7 @@ evas_bidi_position_logical_to_visual(EvasBiDiStrIndex *v_to_l, int len, EvasBiDi * Checks if the char is rtl oriented. I.e even a neutral char can become rtl * if surrounded by rtl chars. * - * @param embedded_level_list the bidi embedding list. + * @param bidi_props The bidi properties * @param index the index of the string. * @return #EINA_TRUE if true, #EINA_FALSE otherwise. */ @@ -394,8 +391,10 @@ Evas_BiDi_Paragraph_Props * evas_bidi_paragraph_props_ref(Evas_BiDi_Paragraph_Props *bidi_props) { if (!bidi_props) return NULL; + BIDILOCK(); bidi_props->refcount++; + BIDIUNLOCK(); return bidi_props; } diff --git a/src/modules/engines/gl_common/evas_gl_common.h b/src/modules/engines/gl_common/evas_gl_common.h index b957e15..507c454 100644 --- a/src/modules/engines/gl_common/evas_gl_common.h +++ b/src/modules/engines/gl_common/evas_gl_common.h @@ -429,7 +429,8 @@ void evas_gl_common_context_image_map4_push(Evas_GL_Context *gc, int clip, int cx, int cy, int cw, int ch, int r, int g, int b, int a, Eina_Bool smooth, - Eina_Bool tex_only); + Eina_Bool tex_only, + Eina_Bool yuv); void evas_gl_common_context_flush(Evas_GL_Context *gc); int evas_gl_common_shader_program_init(Evas_GL_Program *p, diff --git a/src/modules/engines/gl_common/evas_gl_context.c b/src/modules/engines/gl_common/evas_gl_context.c index 4bc2c25..48a5a42 100644 --- a/src/modules/engines/gl_common/evas_gl_context.c +++ b/src/modules/engines/gl_common/evas_gl_context.c @@ -1791,12 +1791,13 @@ evas_gl_common_context_image_map4_push(Evas_GL_Context *gc, RGBA_Map_Point *p, int clip, int cx, int cy, int cw, int ch, int r, int g, int b, int a, - Eina_Bool smooth, Eina_Bool tex_only) + Eina_Bool smooth, Eina_Bool tex_only, + Eina_Bool yuv) { - int pnum, nv, nc, nu, nu2, nt, i; + int pnum, nv, nc, nu, nu2, nu3, nt, i; const int points[6] = { 0, 1, 2, 0, 2, 3 }; int x = 0, y = 0, w = 0, h = 0, px = 0, py = 0; - GLfloat tx[4], ty[4]; + GLfloat tx[4], ty[4], t2x[4], t2y[4]; Eina_Bool blend = 1; DATA32 cmul; GLuint prog = gc->shared->shader.img.prog; @@ -1808,6 +1809,22 @@ evas_gl_common_context_image_map4_push(Evas_GL_Context *gc, (A_VAL(&(p[2].col)) < 0xff) || (A_VAL(&(p[3].col)) < 0xff)) blend = 1; + if (yuv) + { + prog = gc->shared->shader.yuv.prog; + if ((a == 255) && (r == 255) && (g == 255) && (b == 255)) + { + if ((p[0].col == 0xffffffff) && (p[1].col == 0xffffffff) && + (p[2].col == 0xffffffff) && (p[3].col == 0xffffffff)) + prog = gc->shared->shader.yuv_nomul.prog; + else + prog = gc->shared->shader.yuv.prog; + } + else + prog = gc->shared->shader.yuv.prog; + } + else + { if (tex_only) { if (tex->pt->dyn.img) @@ -1866,8 +1883,9 @@ evas_gl_common_context_image_map4_push(Evas_GL_Context *gc, prog = gc->shared->shader.img.prog; } } + } - /*xxx*/ shader_array_flush(gc); +// /*xxx*/ shader_array_flush(gc); again: pn = gc->state.top_pipe; #ifdef GLPIPES @@ -1875,6 +1893,11 @@ again: { gc->pipe[pn].region.type = RTYPE_MAP; gc->pipe[pn].shader.cur_tex = tex->pt->texture; + if (yuv) + { + gc->pipe[pn].shader.cur_texu = tex->ptu->texture; + gc->pipe[pn].shader.cur_texv = tex->ptv->texture; + } gc->pipe[pn].shader.cur_prog = prog; gc->pipe[pn].shader.smooth = smooth; gc->pipe[pn].shader.blend = blend; @@ -1888,8 +1911,16 @@ again: gc->pipe[pn].array.use_vertex = 1; gc->pipe[pn].array.use_color = 1; gc->pipe[pn].array.use_texuv = 1; + if (yuv) + { + gc->pipe[pn].array.use_texuv2 = 1; + gc->pipe[pn].array.use_texuv3 = 1; + } + else + { gc->pipe[pn].array.use_texuv2 = 0; gc->pipe[pn].array.use_texuv3 = 0; + } } else { @@ -1927,6 +1958,11 @@ again: gc->state.top_pipe = pn; gc->pipe[pn].region.type = RTYPE_MAP; gc->pipe[pn].shader.cur_tex = tex->pt->texture; + if (yuv) + { + gc->pipe[pn].shader.cur_texu = tex->ptu->texture; + gc->pipe[pn].shader.cur_texv = tex->ptv->texture; + } gc->pipe[pn].shader.cur_prog = prog; gc->pipe[pn].shader.smooth = smooth; gc->pipe[pn].shader.blend = blend; @@ -1940,8 +1976,16 @@ again: gc->pipe[pn].array.use_vertex = 1; gc->pipe[pn].array.use_color = 1; gc->pipe[pn].array.use_texuv = 1; + if (yuv) + { + gc->pipe[pn].array.use_texuv2 = 1; + gc->pipe[pn].array.use_texuv3 = 1; + } + else + { gc->pipe[pn].array.use_texuv2 = 0; gc->pipe[pn].array.use_texuv3 = 0; + } } } if ((tex->im) && (tex->im->native.data)) @@ -2011,8 +2055,16 @@ again: gc->pipe[pn].array.use_vertex = 1; gc->pipe[pn].array.use_color = 1; gc->pipe[pn].array.use_texuv = 1; + if (yuv) + { + gc->pipe[pn].array.use_texuv2 = 1; + gc->pipe[pn].array.use_texuv3 = 1; + } + else + { gc->pipe[pn].array.use_texuv2 = 0; gc->pipe[pn].array.use_texuv3 = 0; + } #endif x = w = (p[points[0]].x >> FP); @@ -2029,6 +2081,11 @@ again: py = (p[points[i]].y >> FP); if (py < y) y = py; else if (py > h) h = py; + if (yuv) + { + t2x[i] = ((((double)p[i].u / 2) / FP1)) / (double)tex->ptu->w; + t2y[i] = ((((double)p[i].v / 2) / FP1)) / (double)tex->ptu->h; + } } w = w - x; h = h - y; @@ -2037,7 +2094,7 @@ again: pnum = gc->pipe[pn].array.num; nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nu2 = pnum * 2; - nt = pnum * 4; + nu2 = pnum * 2; nu3 = pnum * 2; nt = pnum * 4; gc->pipe[pn].array.num += 6; array_alloc(gc, pn); @@ -2058,6 +2115,15 @@ again: PUSH_TEXUV(pn, tx[points[i]], ty[points[i]]); + if (yuv) + { + PUSH_TEXUV2(pn, + t2x[points[i]], + t2y[points[i]]); + PUSH_TEXUV3(pn, + t2x[points[i]], + t2y[points[i]]); + } PUSH_COLOR(pn, R_VAL(&cl), diff --git a/src/modules/engines/gl_common/evas_gl_image.c b/src/modules/engines/gl_common/evas_gl_image.c index 31e40d6..b932a5e 100644 --- a/src/modules/engines/gl_common/evas_gl_image.c +++ b/src/modules/engines/gl_common/evas_gl_image.c @@ -468,6 +468,7 @@ evas_gl_common_image_map4_draw(Evas_GL_Context *gc, Evas_GL_Image *im, RGBA_Draw_Context *dc; int r, g, b, a; int c, cx, cy, cw, ch; + Eina_Bool yuv = 0; dc = gc->dc; if (dc->mul.use) @@ -488,9 +489,13 @@ evas_gl_common_image_map4_draw(Evas_GL_Context *gc, Evas_GL_Image *im, cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h; im->tex->im = im; + if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) || + (im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL)) + yuv = 1; evas_gl_common_context_image_map4_push(gc, im->tex, p, c, cx, cy, cw, ch, - r, g, b, a, smooth, im->tex_only); + r, g, b, a, smooth, im->tex_only, + yuv); } void -- 2.7.4