Bug 412083 - Image previews scaled incorrectly on hidpi
Summary: Image previews scaled incorrectly on hidpi
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: ImageEditor-Canvas (show other bugs)
Version: 6.3.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-19 20:37 UTC by Alex Merry
Modified: 2022-02-03 04:03 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.4.0
Sentry Crash Report:


Attachments
Image with no tool open (1.10 MB, image/png)
2019-09-19 20:37 UTC, Alex Merry
Details
Image in "before" state (818.58 KB, image/png)
2019-09-19 20:38 UTC, Alex Merry
Details
Image in "after" state (800.17 KB, image/png)
2019-09-19 20:38 UTC, Alex Merry
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Merry 2019-09-19 20:37:22 UTC
SUMMARY
When desktop scaling is used (Plasma desktop, set via the Displays section of System Settings, on a HiDPI display), the After images of previews in the Image Editor are scaled differently to the Before images

STEPS TO REPRODUCE
1. Set desktop scaling (eg: to 1.5) and logout/login to apply
2. Open an image in Digikam in the Image Editor (Tools -> Image Editor)
3. Select White Balance (for example) from the Colours menu
4. Move the mouse to the control pane (to cause the After image to be displayed)

OBSERVED RESULT
The image appears larger (2x?) when the mouse is over the control pane (After image) than when it is over the image itself (Before image). The Before image has the same scaling as when no tool is selected.

EXPECTED RESULT
The image is scaled the same amount in both cases.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.16.5
KDE Frameworks Version: 5.62.0
Qt Version: 5.13.1

ADDITIONAL INFORMATION
I also tried compiling the latest master (both Frameworks and DigiKam), and the issue was still there.

When I use a non-hidpi monitor and disable scaling, the problem goes away.
Comment 1 Alex Merry 2019-09-19 20:37:47 UTC
Created attachment 122738 [details]
Image with no tool open
Comment 2 Alex Merry 2019-09-19 20:38:11 UTC
Created attachment 122739 [details]
Image in "before" state
Comment 3 Alex Merry 2019-09-19 20:38:47 UTC
Created attachment 122740 [details]
Image in "after" state

All screenshots scaled to 50% to keep the file size down
Comment 4 Alex Merry 2019-09-19 20:40:44 UTC
If I get the time, I will attempt to figure out the code and submit a patch, but I thought a bug report would be useful to have in case other people are experiencing the same issue.
Comment 5 caulier.gilles 2019-09-19 21:31:58 UTC
You use the white balance plugin where the code is located here and it use ImageRegionWidget to render the canvas :

https://invent.kde.org/kde/digikam/blob/master/core/dplugins/editor/colors/whitebalance/whitebalancetool.cpp#L93

Code from this widget is common to plenty of Editor tools. Code is here :

https://invent.kde.org/kde/digikam/blob/master/core/utilities/imageeditor/widgets/imageregionwidget.cpp#L82

It's based on Qt GraphicView and use this item implementation to render contents on the canvas with paint() and paintExtraData() :

https://invent.kde.org/kde/digikam/blob/master/core/utilities/imageeditor/widgets/imageregionitem.cpp#L111

https://invent.kde.org/kde/digikam/blob/master/core/utilities/imageeditor/widgets/imageregionitem.cpp#L188

This last method draw the preview modes "before/after/mouse-over"...

Gilles Caulier
Comment 6 Maik Qualmann 2019-09-20 10:46:16 UTC
Git commit deaebf4a60780c01d8c0f5e320db3bb0488526be by Maik Qualmann.
Committed on 20/09/2019 at 10:45.
Pushed by mqualmann into branch 'master'.

fix use correct zoom value  dependent on device pixel ratio
FIXED-IN: 6.4.0

M  +2    -1    NEWS
M  +5    -0    core/libs/widgets/graphicsview/imagezoomsettings.cpp
M  +3    -0    core/libs/widgets/graphicsview/imagezoomsettings.h
M  +10   -0    core/libs/widgets/graphicsview/previewlayout.cpp
M  +1    -0    core/libs/widgets/graphicsview/previewlayout.h
M  +8    -6    core/utilities/imageeditor/widgets/canvas.cpp
M  +1    -1    core/utilities/imageeditor/widgets/imageregionwidget.cpp

https://invent.kde.org/kde/digikam/commit/deaebf4a60780c01d8c0f5e320db3bb0488526be
Comment 7 Maik Qualmann 2019-09-20 11:20:43 UTC
There are a few small things where we need to use the real zoom factor, I fix it tonight.

Maik
Comment 8 Maik Qualmann 2019-09-20 17:21:28 UTC
Git commit 38c1209c7fcce424d843f3508db6bc8cc39f08a8 by Maik Qualmann.
Committed on 20/09/2019 at 17:20.
Pushed by mqualmann into branch 'master'.

fix get capture points

M  +2    -2    core/utilities/imageeditor/widgets/imageregionitem.cpp
M  +2    -2    core/utilities/imageeditor/widgets/imageregionwidget.cpp

https://invent.kde.org/kde/digikam/commit/38c1209c7fcce424d843f3508db6bc8cc39f08a8
Comment 9 Maik Qualmann 2019-10-13 20:02:56 UTC
*** Bug 412920 has been marked as a duplicate of this bug. ***