Skip to content

Conversation

@HeikoKlare
Copy link
Contributor

@HeikoKlare HeikoKlare commented Jan 17, 2025

Currently, AutoScaleMethod "nearest" is used by default, leading to jagged image scaling results. The method "smooth" is only used on GTK with a fractional scaling value not being a multiple of 100. The reason for not using "smooth" scaling on all platform was a bug regarding icon transparency that has long been resolved.

With this change, AutoScaleMethod "smooth" is used by default in fractional scaling scenarios (i.e., with deviceZoom not being an integer multiple of 100) and when using monitor-specific scaling on Windows. To still use "nearest" in these scenarios, it can be activated via system property.

The change has also been tested for GIFs that are only rarely used nowadays. In the screenshots below, the "JobFactory" view uses a GIF as its icon.

Why now?

A better interpolation method was already asked for in: https://bugs.eclipse.org/bugs/show_bug.cgi?id=493455

The issue that previously prevented us from using "smooth" scaling on Windows have meanwhile been resolved:

There are existing workarounds, e.g., for CompositeImageDescriptor, which should be adapted in a follow-up step as well. See:

Is this safe to do?

This change only taken effect when using any swt.scaleMode that supports fractional scaling, such as the mode quarter, exact or an explicit zoom value. None of them used as default value. The default behavior (known as "integer"/"integer200") will not be affected, as the deviceZoom will be multiples of 100.
So this change only affects the monitor-specific scaling mode on Windows (which is experimental anyway) and applications where custom configurations of swt.autoScale are in place anyway. In those situation, if the new image scaling behavior is undesired, swt.autoScaleMethod may be custom configured to "nearest" as well.
I propose to add an according information in the news for this.

How does it look?

The following screenshots are taken on a 150% monitor with swt.autoScale=quarter.

Before

image
image

After

image
image

image
image

@github-actions
Copy link
Contributor

github-actions bot commented Jan 17, 2025

Test Results

   494 files     494 suites   9m 11s ⏱️
 4 330 tests  4 317 ✅  13 💤 0 ❌
16 568 runs  16 460 ✅ 108 💤 0 ❌

Results for commit 5c293c0.

♻️ This comment has been updated with latest results.

@HeikoKlare HeikoKlare force-pushed the autoscalemethod-smooth branch from 9118c68 to f9c3e43 Compare January 17, 2025 16:54
@HeikoKlare HeikoKlare marked this pull request as ready for review January 18, 2025 13:46
@HeikoKlare HeikoKlare force-pushed the autoscalemethod-smooth branch 2 times, most recently from 7dcf570 to 7c31518 Compare January 19, 2025 18:29
@HeikoKlare HeikoKlare force-pushed the autoscalemethod-smooth branch 2 times, most recently from cbe83fa to 98b7bd6 Compare January 20, 2025 16:14
Copy link
Contributor

@akoch-yatta akoch-yatta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a look into the code. The logic is easy and looks good to me.

Currently, AutoScaleMethod "nearest" is used by default, leading to
jagged image scaling results. The method "smooth" is only used on GTK
with a fractional scaling value not being a multiple of 100.
The reason for not using "smooth" scaling on all platform was a bug
regarding icon transparency that has long been resolved.

With this change, AutoScaleMethod "smooth" is used by default in
fractional scaling scenarios (i.e., with deviceZoom not being an integer
multiple of 100) and when using monitor-specific scaling on Windows. To
still use "nearest" in these scenarios, it can be activated via system
property.
@HeikoKlare HeikoKlare force-pushed the autoscalemethod-smooth branch from 98b7bd6 to 5c293c0 Compare January 21, 2025 20:52
@HeikoKlare HeikoKlare merged commit ffa1084 into eclipse-platform:master Jan 21, 2025
14 checks passed
@HeikoKlare HeikoKlare deleted the autoscalemethod-smooth branch January 21, 2025 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use smooth scaling for images with swt.autoScale=quarter

2 participants