[Gambas-user] Draw.Begin/End execution time

Adrien Prokopowicz adrien.prokopowicz at ...626...
Sun Jun 10 01:02:28 CEST 2012


Le dimanche 10 juin 2012 00:32:16 Benoît Minisini a écrit :
> Le 10/06/2012 00:02, Adrien Prokopowicz a écrit :
> > I have another little question.
> > 
> > In the project I sent you, I added two lines after FillRect() :
> >    Draw.Text("Gambas", 50, 50)
> >    Draw.Text("Gambas", 100, 100)
> > 
> > The first takes around 2 msec, the second only 120usec.
> > Is there any font loading, or something like that, when calling draw.text
> > ?
> 
> I imagine that Qt loads each font glyph only when it actually needs it.
> 
> The second time you display "Gambas", the six glyphs are already loaded,
> and so drawing is faster.

No, I tried to change the text in the second call, and results are the same.
But I launched callgrind on my example, and I saw that for a few calls to 
Draw_text, there is one call to QFontMetrics, that loads the font only once 
(call to QFontDatabase::load, then to fontconfig). 

I find the calls to fontconfig very slow, but this is another problem. This one 
is solved. :-)




More information about the User mailing list