Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utiLITI windows scaling issues #275

Closed
profiluefter opened this issue Jun 21, 2019 · 11 comments
Closed

utiLITI windows scaling issues #275

profiluefter opened this issue Jun 21, 2019 · 11 comments
Labels
bug MAJOR This label is intended to distinguish major features from all the others.
Milestone

Comments

@profiluefter
Copy link

If I open utiLITI on my 4k monitor, the tiles of a map get scaled but the grid doesn't and weird rendering issues appear.
standard behavior
A workaround to get it working is to let windows handle the scaling. This is done via the compatibility settings by selecting system as a scaling mode. The downside of this workaround is that the UI gets blurry.

@steffen-wilke steffen-wilke added this to the v0.5.0-beta milestone Jul 20, 2019
@nightm4re94
Copy link
Member

Thanks for reporting this!

@nightm4re94 nightm4re94 self-assigned this Aug 5, 2019
@nightm4re94 nightm4re94 removed their assignment Aug 19, 2019
@nightm4re94
Copy link
Member

Sorry, can't test without having a 4k monitor at my disposal :/ anyone else?

@profiluefter
Copy link
Author

I can test builds for you but I currently don't have time to look into the source code or something like that

@steffen-wilke
Copy link
Contributor

Just to track this: WQHD (2560 x1440) works fine.

@nightm4re94
Copy link
Member

While working on my Laptop with FullHD resolution, I also encountered this issue (and it persists, no matter which game project I edit).
The rendering of the Tiles is misaligned from the actual grid, as you can see in the screenshot below:
grafik
If I zoom out more, the offset increases.

@nightm4re94
Copy link
Member

Today we have been able to reproduce the issue on my laptop:
When using the built-in Windows scaling feature (for readability on small screens), the Entity bounding boxes are rendered with an offset.
Can you confirm this as the reason for the issue? Try messing around with Windows scaling settings and see if the problem still occurs.

@profiluefter
Copy link
Author

Monitor scaling 100%:
100%
Monitor scaling 150%:
150%
Monitor scaling 200%:
200%

So I'm pretty sure this is the reason for this issue, yes.

@nightm4re94
Copy link
Member

Thanks for checking it out! We may already have a lead on this, but oddly this doesn't seem to happen on all hardware.

@steffen-wilke steffen-wilke added the MAJOR This label is intended to distinguish major features from all the others. label Dec 6, 2020
@steffen-wilke
Copy link
Contributor

Update: This issue is related to the installed/used JDK version. It works as expected for up until Java 8 (tested with jdk1.8.0_201).
The problem occurs, starting with Java 9 and above. Tested with jdk-9.0.4, jdk-11.0.2, jdk-13.0.2

@steffen-wilke
Copy link
Contributor

Possibly related to HiDPI support, implemented with Java 9:
JEP 263: HiDPI Graphics on Windows and Linux

see also: jfree/jfreechart#170

@steffen-wilke
Copy link
Contributor

Starting with Java9, the implementation defines a default transformation for the Graphics2D object to support HighDPI settings:

JAVA 9:

image

JAVA 8

image

When rendering Shapes we overwrite the default AffineTransform of the Graphics2D object:

final AffineTransform oldTransForm = g.getTransform();
g.setTransform(transform);
renderOutline(g, shape, stroke);
g.setTransform(oldTransForm);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug MAJOR This label is intended to distinguish major features from all the others.
Projects
None yet
Development

No branches or pull requests

3 participants