Wednesday, March 22, 2006

better than watching paint dry: watching widgets paint!

with qt4 we got the much anticipated arthur painting engine/system. then we got the backing store which provides nice double buffering everywhere and makes things like transparency and other effects like fading in widgets rather easy to do well. well, here's another cool trick that's come along with the backing store: QT_FLUSH_PAINT.

what does it do? it shows you what's being painted by first filling in the about-to-be-painted areas with yellow:



move your mouse around, interact with things and you get a good idea of where painting is happening, such as here where i was mousing over a toolbar button:



since painting is expensive and something that really impacts the experience of using software (flicker, latency, etc) this can be very useful to see just how well your qt and kde apps deal with painting, particularly if you have custom widgets.

best part is that it doesn't require any recompiling or fancy footwork: just export QT_FLUSH_PAINT=1 and start the app from that environment... for the above shots i simply went to a konsole tab and did `QT_FLUSH_PAINT=1 assistant`.

enjoy.

(and speaking of enjoy, the season finale of battlestar galactica kicked ass. so much so that i'm really not happy i have to wait until the fall to get my next fix ;)

7 comments:

superstoned said...

hey, aaron - i changed the plastik windeco to get rid of the inner line around the window, makes it look cleaner. maybe it's usefull for kde 3.5.3...

you'll have to get rid of the ".dark(110)" (4 times) in plastik.cpp to get rid of the line. as totally non-hacker it took me some time to figure it out ;-)

anyway, screenshot to show it off:
http://web.inter.nl.net/users/jospoortvliet/pictures/tmp.jpg

grtz

liquidat said...
This comment has been removed by a blog administrator.
Aaron J. Seigo said...

@superstoned: yeah, that looks rather nice. my only concern would be about users knowing that the title bar is there and can be used to drag, versus the titlebar and everything that looks attached to it. macos x does this for the metal theme which does not have a well delineated title bar...

in any case, this would be more of a change for kde4 and the latest oxygen stuff i've seen melds the titlebar with the window background much as you've done =)

you may want to send your patch to the plastik (and lipstik?) mainater(s)

drowstar said...

Hey Aaron,
when I tried this with a little test app of mine it made a stupid update() mistake obvious. I guess this trick will come in handy in the future.

Thanks for that!

- Markus

superstoned said...

hey aaron,

sorry but i'm not much of a hacker (not at all, actually). it took me more than 30 min to find the file, and again more than 30 min to find out where the line was drawn (actually just trial and error). and send a patch?!?!?!?

i'd love to, but i think its easier for the mantainer to do it in a few secs - just do a search & replace for .dark(110) - and maybe there's a better way....

Anonymous said...

I would recommend using this in combination with valgrind. Valgrind slows things down quite a bit and checks your memory too.

I'm running opera 9b2 in valgrind now because I experience a crash and it's not even that much slower. Pretty amazing.

Max Howell said...

I imagine that if the title bar colour is not the same as the widget background colour (most themes), then the effect you refer to will not occur. The theme in superstoned's screenshot has the same colours.

I also would like to see that line surrounding the windows gone from the plastik deco, as it sometimes looks good, but more often than not it doesn't look great, especially apps that have frames at the window edge, eg Konqi and amaroK.

The default GNOME win deco is quite awesome (well I assume the XGL one is the default), and has no line, and the colour scheme melds the titlebar and the menubar, and doesn't look bad really. I think people can determine the implicit separation without a visible barrier, even those who have never used a Windowing system before.