<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://git.reviewboard.kde.org/r/109365/">http://git.reviewboard.kde.org/r/109365/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On March 14th, 2013, 7:23 p.m. UTC, <b>Albert Astals Cid</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="http://git.reviewboard.kde.org/r/109365/diff/2/?file=119160#file119160line42" style="color: black; font-weight: bold; text-decoration: underline;">kgimageprovider.cpp</a>
<span style="font-weight: normal;">
(Diff revision 2)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">42</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">QSvgRenderer</span><span class="o">*</span> <span class="n">renderer</span> <span class="o">=</span> <span class="k">new</span> <span class="n">QSvgRenderer</span><span class="p">(</span><span class="n">m_provider</span><span class="o">-></span><span class="n">currentTheme</span><span class="p">()</span><span class="o">-></span><span class="n">graphicsPath</span><span class="p">());</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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</pre>
</blockquote>
<p>On March 15th, 2013, 11:41 a.m. UTC, <b>Viranch Mehta</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On March 14th, 2013, 7:23 p.m. UTC, <b>Albert Astals Cid</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="http://git.reviewboard.kde.org/r/109365/diff/2/?file=119161#file119161line57" style="color: black; font-weight: bold; text-decoration: underline;">kgthemeprovider.h</a>
<span style="font-weight: normal;">
(Diff revision 2)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">57</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="n">QString</span> <span class="n">name</span><span class="p">()</span> <span class="k">const</span><span class="p">;</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Need documentation for these (and the rest of functions you added) and @since markers
</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">since 4.10.2?</pre>
<br />
<p>- Viranch</p>
<br />
<p>On March 15th, 2013, 9:18 p.m. UTC, Viranch Mehta wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for KDE Games.</div>
<div>By Viranch Mehta.</div>
<p style="color: grey;"><i>Updated March 15, 2013, 9:18 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I'm using KBreakout to test all of this. The relevant port can be found in "qtquick/imageprovider" branch in KBreakout's git repo.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>CMakeLists.txt <span style="color: grey">(67b8b40)</span></li>
<li>declarativeimports/CMakeLists.txt <span style="color: grey">(PRE-CREATION)</span></li>
<li>declarativeimports/corebindingsplugin.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>declarativeimports/corebindingsplugin.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>declarativeimports/qml/KgItem.qml <span style="color: grey">(PRE-CREATION)</span></li>
<li>declarativeimports/qml/qmldir <span style="color: grey">(PRE-CREATION)</span></li>
<li>includes/CMakeLists.txt <span style="color: grey">(8756a50)</span></li>
<li>includes/KgDeclarativeView <span style="color: grey">(PRE-CREATION)</span></li>
<li>kgdeclarativeview.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>kgdeclarativeview.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>kgimageprovider.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>kgimageprovider.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>kgthemeprovider.h <span style="color: grey">(6ca9b63)</span></li>
<li>kgthemeprovider.cpp <span style="color: grey">(e186106)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/109365/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>