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





 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">It looks good to me... But it's not my code: Cyrille wrote this. The only change I did there was this:

-    const qint16 weights[2] = { 255 - weight, weight };
+    const qint16 weights[2] = { (qint16)255 - weight, (qint16)weight };

trying to fix a warning.</pre>
 <br />









<p>- Boudewijn</p>


<br />
<p>On February 2nd, 2013, 3:30 a.m. UTC, Friedrich W. H. Kossebau 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 Calligra and Boudewijn Rempt.</div>
<div>By Friedrich W. H. Kossebau.</div>


<p style="color: grey;"><i>Updated Feb. 2, 2013, 3:30 a.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;">While I just wanted to fix the warning about "(qint16)255 - weight" possibly being out-of-range, I wondered if the calculation of the parts of the colors being mixed in is behaving like wanted.
The old code "(int)(mix * 255)" will map to "0" for values of mix in the range of [0..1/255[, while it will only map to 255 when mix is exactly 1.0.
Which gives the foreground color less power than the background color in average here.

Attached patch fixes that by using the formula "int(mix * 256)" which distributes the values [0.0..1.0[ equally to the range [0..255], with the exception of 1.0, which would be 256, but that can be catched.

The proposed algorithm might be more correct, but has the problem that any stored settings of the mix value would result in slight color changes. No idea if that can happen, your call.

Any better algorithm?

If okay, okay to also backport to 2.6?</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>krita/plugins/paintops/libpaintop/kis_color_source.cpp <span style="color: grey">(fe19834)</span></li>

</ul>

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







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








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