Review Request 122875: Fix KIconEngine::paint to handle different devicePixelRatios

David Edmundson david at davidedmundson.co.uk
Mon Mar 9 18:36:13 UTC 2015



> On March 9, 2015, 6:26 p.m., Albert Astals Cid wrote:
> > makes no sense to me, you are getting a rect to 
> > paint on and painting outside of it.
> > 
> > what even warrants that there will be "space"
> > on the qpainter?
> > 
> > should the size increase be done in upper levels?

It's not painting outside it, the first argument is the target area, the pixmap is scaled to fit.
Which is actually what's happening before this patch, scaling it upwards making it look blocky with a high QT_DEVICE_PIXEL_RATIO.


In this case I'm making sure what I'm painting does match the painter.

We know the painter's target is rect user pixels big.
Which means in reality it is rect * devicePixelRatio real device pixels big.

To draw a clean icon, we need the pixmaps with a matching size in device pixels, not a matching size in user pixels.


Normally this does happen in an upper level. QIcon::pixmap() does this resizing, but QIcon::paint which calls this cannot.


- David


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/122875/#review77223
-----------------------------------------------------------


On March 9, 2015, 5:54 p.m., David Edmundson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/122875/
> -----------------------------------------------------------
> 
> (Updated March 9, 2015, 5:54 p.m.)
> 
> 
> Review request for KDE Frameworks and Christoph Feck.
> 
> 
> Repository: kiconthemes
> 
> 
> Description
> -------
> 
> This now matches the behaviour of QPixmapIconEngine::paint
> 
> 
> Diffs
> -----
> 
>   src/kiconengine.cpp 6dff533 
> 
> Diff: https://git.reviewboard.kde.org/r/122875/diff/
> 
> 
> Testing
> -------
> 
> Opened configure toolbars in konversation with QT_DEVICE_PIXEL_RATIO=2
> QStyledItemDelegate calls QIcon::paint which ends up going through this code with our QPA.
> 
> 
> Thanks,
> 
> David Edmundson
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20150309/764a65d1/attachment.html>


More information about the Kde-frameworks-devel mailing list