Bug 478944

Summary: Background color in viewer changes after zooming in or out
Product: [Applications] kphotoalbum Reporter: Johannes Zarl-Zierl <johannes>
Component: ViewerAssignee: KPhotoAlbum Bugs <kpabugs>
Status: RESOLVED FIXED    
Severity: minor    
Priority: NOR    
Version: 5.12.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Johannes Zarl-Zierl 2023-12-23 17:27:26 UTC
SUMMARY
In the viewer window, if one uses any zoom operation on the image display, the color changes from gray to black.


STEPS TO REPRODUCE
1. Open kphotoalbum --demo
2. Go to thumbnail view
3. Double-click an image to open the viewer
4. Press a shortcut associated with a zoom operation (+,-,=,.)

OBSERVED RESULT
The image is zoomed correctly, but the margins between the image and the viewer window border / screen border changes from dark gray to black.

EXPECTED RESULT
The background color should be preserved.

ADDITIONAL INFORMATION
Can be reproduced every time, can be reproduced using the demo database.
Comment 1 Johannes Zarl-Zierl 2023-12-23 23:20:57 UTC
Git commit 0883c80af5d5d545c13d7e707cac362456073ec1 by Johannes Zarl-Zierl.
Committed on 24/12/2023 at 00:14.
Pushed by johanneszarl into branch 'master'.

Use the correct background color in viewer for zoomed images

When zooming in the viewer window, such that there is a border outside
of the image itself, that border was until now drawn black instead of
the QPalette::base() color.
The reason for this is that the zoomed image is actually a copy of the
loaded image with those borders.
Adding an alpha channel to the image fixes the issue.

It would possibly be a better fix to draw a scaled image in
ImageDisplay::paintEvent instead, but that would be a major rewrite of
the ImageDisplay code.

M  +1    -0    CHANGELOG.md
M  +4    -1    Viewer/ImageDisplay.cpp

https://invent.kde.org/graphics/kphotoalbum/-/commit/0883c80af5d5d545c13d7e707cac362456073ec1