[Kde-games-devel] Faster KGameThemeSelector startup
Dmitry Suzdalev
dimsuz at gmail.com
Fri Jun 1 13:35:13 CEST 2007
Hi, guys!
While playing with KGameThemeSelector dialog, I noticed that even with
only two themes in it, it starts rather slow.
It turned out, that the faulty piece of code is KGameTheme::load(),
because it checks whether svg file is valid by loading it with
KSvgRenderer. Svg loading is performed only for this check, there are
no further actions with loaded svg.
I know it is a good check, that guarantees further success to games
that use KGameTheme, but isn't it too heavy? :)
While starting, KGameThemeSelector is calling KGameTheme::load on every
theme it finds, so just imagine how long it'll take to display this
dialog if a game has say 10 themes.
What I propose is to replace KSvgRenderer->load(...) with simple and
fast QFile::open(...) to test if file exists and can be opened
(i.e. file permissions are permittable ;-) )
And the check for SVG validity can be done in application itself,
which uses KSvgRenderer::load & friends anyway.
Mauricio, what do you think as KGameTheme's author?
Simple patch attached.
Any objections against me committing it?
Dmitry.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kgametheme.diff
Type: text/x-diff
Size: 1611 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20070601/d6d58bd0/attachment.bin
More information about the kde-games-devel
mailing list