Review Request 108709: in KisPlainColorSource equally distribute mix factor between values [0..255]
Boudewijn Rempt
boud at valdyas.org
Sat Feb 2 21:35:02 GMT 2013
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/108709/#review26548
-----------------------------------------------------------
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.
- Boudewijn Rempt
On Feb. 2, 2013, 3:30 a.m., Friedrich W. H. Kossebau wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/108709/
> -----------------------------------------------------------
>
> (Updated Feb. 2, 2013, 3:30 a.m.)
>
>
> Review request for Calligra and Boudewijn Rempt.
>
>
> Description
> -------
>
> 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?
>
>
> Diffs
> -----
>
> krita/plugins/paintops/libpaintop/kis_color_source.cpp fe19834
>
> Diff: http://git.reviewboard.kde.org/r/108709/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Friedrich W. H. Kossebau
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20130202/6ecd912b/attachment.htm>
More information about the calligra-devel
mailing list