Bug 429569

Summary: Zoom notification tooltip displays incorrect percentage
Product: [Applications] krita Reporter: Evren <evren320>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: alvin, tamtamy.tymona
Priority: NOR    
Version: 4.4.1   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: 100% zoom at bottom bar
100% zoom showing at floating box

Description Evren 2020-11-23 22:38:42 UTC
SUMMARY
When using zoom tool, mouse wheel or zoom combobox at bottom of the app, after the zoom, a small box appears that says "Zoom: 200%" etc. but that percentage is different than the real zoom percentage that is correctly displayed at the bottom of the app, when i click on "use same aspect as pixels" zoom level still incorrect, but it changes to a different value this time. I am using 4K screen with 150% scaling.

STEPS TO REPRODUCE
1. Create or open any image
2. Change zoom level either with zoom tool, mouse wheel, or combobox at bottom

OBSERVED RESULT
Zoom notification tooltip shown and has incorrect value of the zoom level

EXPECTED RESULT
Zoom value should be correctly displayed

SOFTWARE/OS VERSIONS
Windows: Windows 10 Build 2004

ADDITIONAL INFORMATION
Using 4K resolution with 150% scaling set in windows display settings
Comment 1 Tiar 2021-03-22 17:35:08 UTC
Yes, seems like the zoom is scaled like this:
actual_shown_value = real_zoom_user_visible_value*1/UI_scale.
That's a very easy fix to make.
Comment 2 Tiar 2021-03-22 21:38:47 UTC
It's easy, but not trivial: before fixing the screen notification, one needs to understand why exactly the value is wrong, and which value is wrong, the one in the floating message, or the one on the bottom bar.
Comment 3 Evren 2021-04-20 19:48:10 UTC
Created attachment 137735 [details]
100% zoom at bottom bar

Screenshot from an image 100% zoom showing at bottom bar
Comment 4 Evren 2021-04-20 19:48:48 UTC
Created attachment 137736 [details]
100% zoom showing at floating box

Screenshot from an image 100% zoom showing at floating box
Comment 5 Evren 2021-04-21 10:09:26 UTC
According to the blurriness of the image in attachment, bottom bar shows correct value, floating bar shows wrong value
Comment 6 Alvin Wong 2021-08-26 17:00:06 UTC
(In reply to Tiar from comment #2)
> It's easy, but not trivial: before fixing the screen notification, one needs
> to understand why exactly the value is wrong, and which value is wrong, the
> one in the floating message, or the one on the bottom bar.

The zoom value shall be based on the physical pixels, so that 100% (with "Use same aspect as pixels" being on) means that each individual pixel of the image maps to exactly one pixel on the monitor, regardless of high DPI UI scaling. (That is unless a framebuffer-based scaling is being used, like macOS or some xrandr modes, since in these cases we are prevented from drawing in a pixel-perfect way.) In this case, the zoom level on the floating message is incorrect.

In addition, I noticed that when "Use same aspect as pixels" is off, the floating message appears to show the "actual zoom" that also takes the image resolution and screen resolution into account, instead of the configured zoom level. The cause is probably the same.
Comment 7 Bug Janitor Service 2021-08-27 09:47:26 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1021
Comment 8 Dmitry Kazakov 2021-08-30 04:24:27 UTC
Git commit ba89aa33d5d1e934da9842570197cb0893da5188 by Dmitry Kazakov, on behalf of Alvin Wong.
Committed on 30/08/2021 at 04:22.
Pushed by dkazakov into branch 'master'.

Fix zoom level on floating message mismatch with other places

M  +2    -6    libs/ui/kis_zoom_manager.cc

https://invent.kde.org/graphics/krita/commit/ba89aa33d5d1e934da9842570197cb0893da5188
Comment 9 Alvin Wong 2021-08-30 06:56:07 UTC
Git commit 6dadff3a302d815f33fcfc457d3c855313ead4cf by Alvin Wong.
Committed on 30/08/2021 at 06:55.
Pushed by alvinwong into branch 'krita/5.0'.

Fix zoom level on floating message mismatch with other places
(cherry picked from commit ba89aa33d5d1e934da9842570197cb0893da5188)

M  +2    -6    libs/ui/kis_zoom_manager.cc

https://invent.kde.org/graphics/krita/commit/6dadff3a302d815f33fcfc457d3c855313ead4cf