[Kde-games-devel] Review Request 109365: Support for QtQuick in libkdegames

Viranch Mehta viranch.mehta at gmail.com
Fri Mar 15 21:27:13 UTC 2013



> On March 14, 2013, 7:23 p.m., Albert Astals Cid wrote:
> > kgimageprovider.cpp, line 42
> > <http://git.reviewboard.kde.org/r/109365/diff/2/?file=119160#file119160line42>
> >
> >     As far as i remember creating a QSvgRenderer was quite expensive, you may want to check if it still is and instead of creating it every time, create it just once in the constructor
> 
> Viranch Mehta wrote:
>     I think the actual expensive part should be when a SVG file is loaded. we can maintain a QHash<svgfile, svgrenderer> and use these objects for rendering. also, since these are asynchronous threaded rendering, we might have to use mutex around the QHash object. I'll implement this and update the patch.

so in the updated patch, I keep a QSvgRenderer as private member, which is simply used to render sprites on each request. This saves the cost of re-constructing the renderer and loading the SVG file for each sprite request. the renderer loads the new SVG file on a theme change. this has resulted in significant performance improvement when resizing windows and changing themes. I tested with fallback image mechanism disabled and the flicker reduced *a lot*, though not enough to be able to discard the fallback mechanism.


> On March 14, 2013, 7:23 p.m., Albert Astals Cid wrote:
> > kgthemeprovider.h, line 57
> > <http://git.reviewboard.kde.org/r/109365/diff/2/?file=119161#file119161line57>
> >
> >     Need documentation for these (and the rest of functions you added) and @since markers
> >     
> >

since 4.10.2?


- Viranch


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/109365/#review29223
-----------------------------------------------------------


On March 15, 2013, 9:18 p.m., Viranch Mehta wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/109365/
> -----------------------------------------------------------
> 
> (Updated March 15, 2013, 9:18 p.m.)
> 
> 
> Review request for KDE Games.
> 
> 
> Description
> -------
> 
> This is a copy of review request #7017 in SVN review board because I needed to update the patch (it won't accept git diffs). Updated description:
> 
> This patch contains support for QtQuick in libkdegames for future porting QML. Post this patch, libkdeclarative becomes a dependency for libkdegames.
> 
> We have some new classes:
> 
> 1. KgImageProvider:
> This is a QDeclarativeImageProvider, and a sort-of replacement for KGameRenderer for QML ports. This class is supplied with a KgThemeProvider which it uses to discover SVG locations, reads them using QSvgRenderer and returns the requested sprite pixmap. QDeclarativeImageProvider has inbuilt ability of caching and asynchronous loading of pixmaps, which is why can replace usages of KGameRenderer in QML ports.
> 
> 2. KgDeclarativeView:
> This is a QDeclarativeView with KDE-specific import paths for QML components configured and javascript functions bindings added (like i18n() methods) using the KDeclarative library. Game's KgThemeProviders are supplied to this class which in turn registers them with the underlying QML engine, and adds KgImageProviders corresponding to each KgThemeProvider.
> 
> 3. KgItem QML component:
> This is simple QML Image element wrapper for showing sprites on QML views using the KgImageProviders. We specify which one of the KgImageProviders we want to use and which sprite key we want to show, and it will be painted on the view.
> 
> The patch may not stay up-to-date, relevant code is in "viranch/qtquick" branch in libkdegames's git repo.
> 
> 
> Diffs
> -----
> 
>   CMakeLists.txt 67b8b40 
>   declarativeimports/CMakeLists.txt PRE-CREATION 
>   declarativeimports/corebindingsplugin.h PRE-CREATION 
>   declarativeimports/corebindingsplugin.cpp PRE-CREATION 
>   declarativeimports/qml/KgItem.qml PRE-CREATION 
>   declarativeimports/qml/qmldir PRE-CREATION 
>   includes/CMakeLists.txt 8756a50 
>   includes/KgDeclarativeView PRE-CREATION 
>   kgdeclarativeview.h PRE-CREATION 
>   kgdeclarativeview.cpp PRE-CREATION 
>   kgimageprovider.h PRE-CREATION 
>   kgimageprovider.cpp PRE-CREATION 
>   kgthemeprovider.h 6ca9b63 
>   kgthemeprovider.cpp e186106 
> 
> Diff: http://git.reviewboard.kde.org/r/109365/diff/
> 
> 
> Testing
> -------
> 
> I'm using KBreakout to test all of this. The relevant port can be found in "qtquick/imageprovider" branch in KBreakout's git repo.
> 
> 
> Thanks,
> 
> Viranch Mehta
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20130315/a29243a2/attachment.html>


More information about the kde-games-devel mailing list