[Interest] animation on font.pixelSize
Samuel Rødal
samuel.rodal at digia.com
Tue Jan 15 08:47:33 CET 2013
On 01/14/2013 06:04 PM, Thomas Senyk wrote:
> On Mon, January 14, 2013 12:54:56 Samuel Rødal wrote:
>> On 01/11/2013 04:59 PM, Thomas Senyk wrote:
>>> Hi,
>>>
>>> as with Quick2.0 we got the very nice DistanceField-font-rendering.
>>> So in theory animations on Text{ font.pixelSize } should be fairly cheap,
>>> right?
>>>
>>> With the following code snipped I got performance problems never the less:
>>>
>>> import QtQuick 2.0
>>> Text {
>>>
>>> id: text
>>> width: 500
>>> height: 100
>>> text: "Test font.pixelSize animation"
>>> NumberAnimation {
>>>
>>> running: true
>>> loops: Animation.Infinite
>>> duration: 2000
>>> target: text
>>> property: "font.pixelSize"
>>> from: 10
>>> to: 90
>>>
>>> }
>>>
>>> }
>>>
>>>
>>> The strange thing is, on my desktop he has 100% cpu load for the first 2-4
>>> loops.
>>> ... I wild guess: It looks like it needs to render the font-glyphs for
>>> each(?) size and after a few cycles it got all of them rendered and
>>> cached...? (it can't render all of them in the first loop as he jumps due
>>> to bad performance)
>>>
>>> On embedded (raspberry pi) I get <20% load all the time.
>>>
>>> On desktop I got:
>>> - intel xeon 3ghz
>>> - nvidia 8600gts
>>> - Qt5 checkout from this week, branch: stable
>>> - xcb as platform backend (using freetype and fontconfig)
>>>
>>> On the raspberry I got:
>>> - BCM 2835 (slow ARM11 cpu, fast VideoCore IV GPU)
>>> - eglfs as platform backend
>>> - no fontconfig -> QBasicFontDatabase
>>>
>>> (If it helps I can do a fontconfig build)
>>>
>>> Is this know? Can anyone verify?
>>> And possible explanation? .. maybe my Qt5 build on desktop is flawed?
>>
>> Try adding "renderType: Text.QtRendering" in the Text element. On
>> desktop it might be that Text.NativeRendering is the default (which does
>> not use distance field glyphs but texture glyphs cached based on the
>> pixel size, maybe even on the scale?).
>
> No the default was already "renderType: Text.QtRendering"
>
> Changing the property does work, as the font is rendered differently with
> "renderType: Text.NativeRendering"
> (Especially during the animation one can see how the font is changing with
> renderType: Text.NativeRendering, e.g. line-width/boldness is jumping)
>
>
> The performance behavior seams to be the same.
> First 2-4 cycles it's 100% cpu then is drops to <5%
>
>
> Again from the other side of this thread:
> I'm not searching for a quick work-around (e.g. scale), I rather want to
> understand why this is happening, why it's different on my rpi and if this is
> a bug or a wanted/accepted behavior.
I don't understand it, the distance field text should not be
re-generated based on pixelSize. Maybe there's something else going on,
since it's on desktop you could run it through callgrind perhaps :)
> Greets
> Thomas
>
> p.s.: (a bit off-topic)
> @ "cached based even on scale"
> Scale with "renderType: Text.NativeRendering" is similar as with Qt4/Quick1:
> He renders with the specified font size and scales it during gl-painting
> -> "font.pixelSize: 1; scale: 30" looks extremely unreadable.
>
> Where "renderType: Text.QtRendering" produces the same output with
> "font.pixelSize: 1; scale: 30;" and "font.pixelSize: 30; scale: 1;"
> (not counting the 'Text' elements geometry properties)
Good to know :)
--
Samuel
More information about the Interest
mailing list