D24321: [KCM] Scale more coarsely with the slider, but more finely with a semi-hidden spinbox

Dominik Haumann noreply at phabricator.kde.org
Tue Oct 1 21:52:08 BST 2019


dhaumann added a comment.


  As far as I understand, the reasoning of @cullmann is that 0.1 cannot be accurately be represented by a computer. Following this discussion <https://stackoverflow.com/questions/46249288/how-to-determine-a-number-closest-to-a-given-number-in-floating-point>, the number 0.1 will turn into either 0.09999999999999999167332731531132594682276248931884765625 or 0.1000000000000000055511151231257827021181583404541015625.
  
  And @cullmann's point here is: Do we really want to have calls of QPainter::scale() with these above numbers? It is quite obvious that you will never get any full pixels with such scaling factors.
  
  That's why i) proposing a coarser step width, and ii) numbers that CAN be represented lead to the proposed patch of 0.25, 0.5, 0.75, ... These numbers are perfectly representable by a computer without rounding artifacts, and multiplying with ints you may even have a chance of getting a nice int again in many cases, which is exactly what you want if you want, since the chance of getting full pixels is much higher.
  
  So +1 for this patch, it does make a lot of sense (in fact, based on the above reasoning, I'd even drop the option of setting 0.05, 0.1, ... via the advanced button). Please reconsider this patch.

REPOSITORY
  R104 KScreen

REVISION DETAIL
  https://phabricator.kde.org/D24321

To: ngraham, #vdg, #plasma, romangg
Cc: dhaumann, davidedmundson, ouwerkerk, GB_2, ndavis, cullmann, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20191001/cab06b9e/attachment.html>


More information about the Plasma-devel mailing list