Make QPainter canvas render at device pixel size in hidpi mode
AbandonedPublic

Authored by alvinhochun on Sep 24 2017, 5:21 PM.

Details

Summary

Before this change, the QPainter-based canvas will render in the "logical pixel" size, e.g. zoomed in 200% when dpi scale factor is 2x, which causes the canvas to render all blurry.

After this change, the QPainter-based canvas will render in the device pixel size. This does not change the existing view scaling, which means with a dpi scale factor of 2x, setting a scale level of 50% will result in a pixel-perfect canvas render, while 100% will be effectively 200%.

I would assume this works on Linux, but somebody should test this on OS X with a retina display...

Diff Detail

Repository
R37 Krita
Lint
Lint Skipped
Unit
Unit Tests Skipped
rempt accepted this revision.Sep 25 2017, 8:51 AM
rempt added a subscriber: rempt.

I'm not sure I see any difference on OSX:

With the patch:

Withouth the patch:

But I'm notorious in not seeing these kind of things. The patch itself looks fine to me.

This revision is now accepted and ready to land.Sep 25 2017, 8:51 AM

Oh, I should've made some test images with 1-pixel-wide lines. Best to test at 50% zoom (assuming the mac uses 200% dpi scaling), and also test some random scale levels below 50% and within 50~100%.

Surely you shouldn't see any difference at 100% zoom...

alvinhochun requested review of this revision.Sep 25 2017, 2:53 PM

Ok, here are three images for testing pixel-perfect rendering:



With these images the change should be pretty obvious at <100% and higher non-integral zoom levels. Here's what I get at 50% zoom, at scale factor 200% (view at original resolution):


@rempt Can you please test again with these images at 50% zoom and other non-integral zoom levels?

rempt added a comment.Sep 25 2017, 4:09 PM

Here are six screenshots at 50%: I can do at another zoom level, but not right now. Dinner time...

Hi, @alvinhochun!

Could you test if this test works fine on QPainter canvas?

https://phabricator.kde.org/D7982#148929

Hi, @alvinhochun!

Could you test if this test works fine on QPainter canvas?

https://phabricator.kde.org/D7982#148929

No, it works the same way as the OpenGL canvas, but it's not a regression.

One thing I should also test is moving the Krita window between two monitors of different dpi scaling settings (Windows 10)...

Updated diff so it applies after D8044

rempt accepted this revision.Oct 2 2017, 8:25 AM
This revision is now accepted and ready to land.Oct 2 2017, 8:25 AM