ktgw0316 / LightZone

LightZone is a photo editor for Mac, Windows, and Linux.
BSD 3-Clause "New" or "Revised" License
317 stars 50 forks source link

Editor tools incompletely applied when using `-Dsun.java2d.uiScale=2` #325

Open kunibertk opened 10 months ago

kunibertk commented 10 months ago

While trying out workarounds for #307, I came across the following: When I start lightzone with the -Dsun.java2d.uiScale=2 option, edit a picture and apply a filter, the filter is applied only to parts of the image. The image in the editor window appears tiled, with some rectangles showing the filter applied and some showing the original image. This does not happen when I start lightzone without the UI scaling option.

I am using ArchLinux with KDE on a 32" 3840x2160 screen. KDE overall application scaling is set to 150%. I am using java-21-openjdk. Lightzone is 5.0.0.beta2 - what was current on AUR on October 22, 2023. ArchLinux is a rolling release and I am using what was current on October 21, 2023.

To Reproduce

  1. Start lightzone as _JAVA_OPTIONS="-Dsun.java2d.uiScale=2" lightzone from the command line. (Same result if /usr/bin/lightzone is patched accordingly).
  2. Select an image and klick to edit
  3. Select, for example, the "HDR Dark Scene" or "Sunset" style. If unchecked, check the box to make the style active.

Screenshot

lzbug - big tools view s
sfink16 commented 10 months ago

Granted I'm using Ubuntu 23.10, but I don't get any errors with your reproduce instructions. My java is not 21 but 17, see the output below. Is java 21 the recommended for your OS and Beta 2? What's your output look like? Screenshot from 2023-10-22 11-05-52

kunibertk commented 10 months ago

I get the same error with Java 17. Here is a copy of the output. The issue is the same as with Java 21. However I noticed yours did not have the "Picked up _JAVA_OPTIONS". Did you set the uiScale? I get the issue only if uiScale is set and not 1. (Well I only tried 2 since fractions have no effect and 3 would be too gross).

Since Arch is a rolling release, this means that at some point in time it gets Java 21. Doesn't mean it is recommended or anything. I can switch between 8, 11, 17 and 21 but the current lightzone 5.0.0 only works for Java 17 and 21. Both show the same error. Below is the output from re-testing with Java 17.

Starting LightZone version 5.0.0 beta2 ...
with options :
Picked up _JAVA_OPTIONS: -Dsun.java2d.uiScale=2
openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment (build 17.0.9+8)
OpenJDK 64-Bit Server VM (build 17.0.9+8, mixed mode)
/usr/share/java/lightzone/*:/usr/share/java/*:/usr/share/java/javahelp/*
Picked up _JAVA_OPTIONS: -Dsun.java2d.uiScale=2
This is LightZone 5.0.0~beta2 (89b2c87)
Running Java version 17.0.9 (amd64)
Verifying Libraries
Initializing Engine Utilities
Max Memory:     2048 MB
Total Memory:     22 MB
Running on 8 processors
Tile Cache:     1024 MB
Allocating 5816 MB for the image cache.
Malformed display profile at (sRGB default)
Loading Classes
Scanning Color Profiles
Restoring Preferences
Starting Logging
Scanning Saved Documents
Opening...
Light Crafts JAI Library - 02/05/07
Opening /home/oliverb/Pictures/LZTEST/picture2.tif
asyncRepaint failed
Disposing Engine
Tile Cache Statistics r: 0, w: 94, on disk: 94
Tile Cache Statistics r: 0, w: 94, on disk: 92
Disposing Engine
sfink16 commented 10 months ago

No options set on my end. Apparently Ubuntu doesn't have the same issue you have on scaling. My LZ looks fine. I'll try scaling later today or tomorrow, if I get a chance. I'm leaving for the day now.

sfink16 commented 10 months ago

No options set on my end. Apparently Ubuntu doesn't have the same issue you have on scaling. My LZ looks fine. I'll try scaling later today or tomorrow, if I get a chance. I'm leaving for the day now.

sfink16 commented 10 months ago

Did a quick try with your options that you gave and did the test your recommend and still don't see what you're seeing. It must be unique to your OS.

kunibertk commented 10 months ago

In the meantime I tried "lightzone-git 4.2.5.r25.g07eda8f4-1" from AUR and that shows the same behaviour. Last year, lightzone did not have that issue. Unfortunately, the old version no longer builds and I don't have the binaries anymore. If you have standard Ubuntu, you have Gtk and the issue may be related to a difference between Gtk and Qt.

sfink16 commented 10 months ago

@kunibertk You're starting to lose me a little in understanding the difference between Gtk and Qt and how you believe it may be related to this problem. In any case, have you looked at the FlatPak 4.2.5 version found in THIS LINK? There is no 5.0 in the FlatPak and I have no idea how it was built. Perhaps that thread will help lead you in the right direction. NOTE: I can't open USB media in FlatPak.

kunibertk commented 10 months ago

@sfink16 Version 4.2.5 from AUR showed the same issue for me and I would expect the flatpak version of 4.2.5 to be the same just differently packaged. I found a workaround for #307 and therefore this issue #325 is no longer bothering me.

About the difference between Qt and Gtk, this was a premature speculation. This is a major difference between Gnome and KDE based systems - but it might also be the underlying window manager, or even a difference between X11 and Wayland (in case you use Wayland - I use X11), the OS's thread handler or something else.

Since the omitted blocks are different each time the editor tool is un-applied / re-applied, I suspect that some painting threads are "forgotten" by lightzone.