<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://reviewboard.kde.org/r/5081/">http://reviewboard.kde.org/r/5081/</a>
     </td>
    </tr>
   </table>
   <br />








<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On August 23rd, 2010, 8:50 a.m., <b>Stefan Majewsky</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="/r/5081/diff/1/?file=34367#file34367line393" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/KDE/kdegames/kblocks/KBlocksScene.cpp</a>
    <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void KBlocksScene::readyForAction(int groupID)</pre></td>

  </tr>
 </tbody>



 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">387</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="k">if</span> <span class="p">(</span><span class="n">mpGrafx</span><span class="o">-&gt;</span><span class="n">renderer</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">isValid</span><span class="p">())</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">393</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="n">QPixmap</span> <span class="n">bg</span> <span class="o">=</span> <span class="n">mpGrafx</span><span class="o">-&gt;</span><span class="n">spritePixmap</span><span class="p">(</span><span class="s">&quot;BACKGROUND&quot;</span><span class="p">,</span> <span class="n">rect</span><span class="p">.</span><span class="n">size</span><span class="p">().</span><span class="n">toSize</span><span class="p">());</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">388</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="p">{</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">394</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="n">painter</span><span class="o">-&gt;</span><span class="n">drawPixmap</span><span class="p">(</span><span class="n">rect</span><span class="p">,</span> <span class="n">bg</span><span class="p">,</span> <span class="n">bg</span><span class="p">.</span><span class="n">rect</span><span class="p">());</span></pre></td>
  </tr>

 </tbody>




 
 


 <tbody>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">389</font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="n">mpGrafx</span><span class="o">-&gt;</span><span class="n">renderer</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">render</span><span class="p">(</span><span class="n">painter</span><span class="p">,</span> <span class="n">QString</span><span class="p">(</span><span class="s">&quot;BACKGROUND&quot;</span><span class="p">),</span> <span class="n">rect</span><span class="p">);</span></pre></td>
    <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
  </tr>

  <tr>
    <th bgcolor="#ebb1ba" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">390</font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span class="p">}</span></pre></td>
    <th bgcolor="#ebb1ba" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#ffc5ce" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></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;">Could you please do this with setBackgroundBrush, as in the other games, in order to avoid repeated spritePixmap() calls?</pre>
 </blockquote>



 <p>On August 23rd, 2010, 1:56 p.m., <b>Brian Croom</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&#39;d love to, but I&#39;m going to need some pointers on the right way to do this. In this case, the scene rect is often considerably smaller than the visualized part of the scene. In other words, the QRectF passed to the scene&#39;s drawBackground is different than the sceneRect. So when and where should the background be set? Is this still the responsibility of the scene, which would get the view size through QGraphicsScene::views()? Then I suppose it is necessary to connect a signal so it knows when the view size changes?</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;">You can set the background (by either drawBackground() or setBackgroundBrush()) in either the QGView or the QGScene. So if it makes more sense to do it in the view, feel free to. Do keep in mind that scene coordinates are used either way. If setting the background in the view, you should probably do it in a reimplemented resizeEvent(). If setting it in the scene, you should probably do it where setSceneRect() is called. In this case, updateDimensions(). 

When I ported Killbots to KGameRenderer I ran into some trouble as my sceneRect doesn&#39;t start at (0,0) so I ended up having to &quot;rotate&quot; the pixmap before calling setBackgroundBrush with it. See http://websvn.kde.org/trunk/KDE/kdegames/killbots/scene.cpp?r1=1164840&amp;r2=1164839&amp;pathrev=1164840</pre>
<br />




<p>- Parker</p>


<br />
<p>On August 23rd, 2010, 1:04 a.m., Brian Croom wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://reviewboard.kde.orgrb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for KDE Games, Mauricio Piacentini and Stefan Majewsky.</div>
<div>By Brian Croom.</div>


<p style="color: grey;"><i>Updated 2010-08-23 01:04:01</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 straightforward patch makes the KBlocks rendering code use KGameRenderer instead of making its own KGameTheme and QSvgRenderer instances</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 have tested playing games and switching themes, and encountered no problems.</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>/trunk/KDE/kdegames/kblocks/KBlocksGraphics.h <span style="color: grey">(1166816)</span></li>

 <li>/trunk/KDE/kdegames/kblocks/KBlocksGraphics.cpp <span style="color: grey">(1166816)</span></li>

 <li>/trunk/KDE/kdegames/kblocks/KBlocksItemGroup.cpp <span style="color: grey">(1166816)</span></li>

 <li>/trunk/KDE/kdegames/kblocks/KBlocksScene.cpp <span style="color: grey">(1166816)</span></li>

 <li>/trunk/KDE/kdegames/kblocks/KBlocksSvgItem.h <span style="color: grey">(1166816)</span></li>

 <li>/trunk/KDE/kdegames/kblocks/KBlocksSvgItem.cpp <span style="color: grey">(1166816)</span></li>

 <li>/trunk/KDE/kdegames/kblocks/main.cpp <span style="color: grey">(1166816)</span></li>

</ul>

<p><a href="http://reviewboard.kde.org/r/5081/diff/" style="margin-left: 3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>