<div dir="ltr"><div><font face="verdana,sans-serif">Hi all,</font></div>
<div><font face="Verdana"></font> </div>
<div><font face="Verdana">I'm trying to optimize the "cairo_show_text" for the "DirectFB/freetype" backend.</font></div>
<div><font face="Verdana">So I added the following function to the cairo-directfb-surface.c.</font></div>
<div><font face="Verdana"></font> </div>
<div><font face="Verdana">It compiles fine.</font></div>
<div><font face="Verdana"></font> </div>
<div><font face="Verdana">but calling it from the cairo_show_text,</font></div>
<div><font face="Verdana"></font> </div>
<div><font face="Verdana">I got the "printf" put at the end of the function but NOTHING on the screen.</font></div>
<div><font face="Verdana"></font> </div>
<div><font face="Verdana">any Idea?</font></div>
<div><font face="Verdana"></font> </div>
<div><font face="Verdana">Notice:</font></div>
<div><font face="Verdana"></font> </div>
<ul>
<li><font face="Verdana"> I took the same code of "</font><font face="Courier New">_cairo_directfb_surface_show_glyphs" </font><font face="verdana,sans-serif">and juste modified it a bit to call the DrawString.</font></li>
<li><font face="Verdana"> I don't know how to set the Font File so I setting it in a envirement Variable.</font></li>
<li><font face="Verdana">I failed to enable the debug messages from cairo. Do they need the build to be in debug mode ?</font></li></ul>
<div><font face="Verdana">regards.</font></div>
<div> </div>
<div><font face="courier new,monospace"></font> </div>
<div><font face="courier new,monospace"></font> </div>
<div><font face="courier new,monospace">_cairo_directfb_surface_show_text (cairo_surface_t *surface,<br> cairo_operator_t op,<br> cairo_pattern_t *pattern,<br>
const char *utf8,<br> double x,<br> double y,<br> cairo_scaled_font_t *scaled_font)<br>
{<br> cairo_directfb_surface_t *dst = surface;<br> cairo_directfb_font_cache_t *cache;<br> cairo_status_t ret;<br> DFBSurfaceBlittingFlags flags;<br> DFBSurfaceBlendFunction sblend;<br>
DFBSurfaceBlendFunction dblend;<br> DFBColor color;<br> /********** SEE the _cairo_directfb_surface_show_glyphs *********<br> * going to call the IDirectFBSurface->DrawString(...)<br>
* need to prepare the font<br> * the drawing flags<br> * the font size */<br> if (pattern->type != CAIRO_PATTERN_TYPE_SOLID)<br> return CAIRO_INT_STATUS_UNSUPPORTED;</font></div>
<p><font face="courier new,monospace"> if (_directfb_get_operator (op, &sblend, &dblend) ||<br> sblend == DSBF_DESTALPHA || sblend == DSBF_INVDESTALPHA)<br> return CAIRO_INT_STATUS_UNSUPPORTED;<br>
/*<br> ret = _directfb_acquire_font_cache (dst, scaled_font, glyphs, num_glyphs,<br> &cache, &rects[0], &points[0], &num);<br> if (ret) {<br> if (ret == CAIRO_INT_STATUS_NOTHING_TO_DO)<br>
ret = CAIRO_STATUS_SUCCESS;<br> return ret;<br> }<br>*/</font></p>
<p><font face="courier new,monospace"> color.a = ((cairo_solid_pattern_t *)pattern)->color.alpha_short >> 8;<br> color.r = ((cairo_solid_pattern_t *)pattern)->color.red_short >> 8;<br> color.g = ((cairo_solid_pattern_t *)pattern)->color.green_short >> 8;<br>
color.b = ((cairo_solid_pattern_t *)pattern)->color.blue_short >> 8;</font></p>
<p><font face="courier new,monospace"> flags = DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_COLORIZE;<br> if (color.a != 0xff)<br> flags |= DSBLIT_BLEND_COLORALPHA;</font></p>
<p><font face="courier new,monospace"> if (!_directfb_argb_font) {<br> if (sblend == DSBF_ONE) {<br> sblend = DSBF_SRCALPHA;<br> if (dblend == DSBF_ZERO)<br> dblend = DSBF_INVSRCALPHA;<br>
}<br> }<br> dst->dfbsurface->SetBlittingFlags (dst->dfbsurface, flags);<br> dst->dfbsurface->SetSrcBlendFunction (dst->dfbsurface, sblend);<br> dst->dfbsurface->SetDstBlendFunction (dst->dfbsurface, dblend);<br>
dst->dfbsurface->SetColor (dst->dfbsurface, color.r, color.g, color.b, color.a);</font></p>
<p><font face="courier new,monospace"> dst->dfbsurface->GetFont(dst->dfbsurface, &font);<br> if (font == NULL)<br> {<br> DFBFontDescription font_dsc;<br> char *defaultFont = getenv("DEFAULT_FONT_FILE");<br>
printf("dst->dfbsurface->Getfont : returned NULL \n");<br> dst->dfb->CreateFont (dst->dfb, ((defaultFont == NULL) ? "./default.ttf" : defaultFont), &font_dsc, &font);<br>
dst->dfbsurface->SetFont(dst->dfbsurface, font);<br> }<br> /*RUN_CLIPPED(dst, NULL, (dst->dfbsurface->DrawString(dst->dfbsurface, utf8, -1, (int)x, (int)y, DSTF_LEFT)));*/<br> dst->dfbsurface->DrawString(dst->dfbsurface, utf8, -1, (int)x, (int)y, DSTF_LEFT);<br>
printf("RMH : DrawString : %s , %d, %d\n", utf8, ((int)x), ((int)y));<br> return CAIRO_STATUS_SUCCESS;</font></p>
<p><font face="courier new,monospace"> }<br></font></p></div>