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

Guard Image Type Icon from Smooth Scaling #1824

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

ShahzaibIbrahim
Copy link
Contributor

@ShahzaibIbrahim ShahzaibIbrahim commented Feb 11, 2025

Enabling the smooth scaling for icon produce erroneous result. Resulting in icon losing its transparency.

How to Test

Use the snippet to see the difference in behavior of the Image and Icon during the DPI change.

Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Image and Icon Example");
shell.setLayout(new RowLayout());

Image icon = display.getSystemImage(SWT.ICON_WORKING);
InputStream is = ImageExample.class.getResourceAsStream("eclipse.png");
Image image = new Image(display, is);

new Label(shell, SWT.NONE).setImage(icon);
new Label(shell, SWT.NONE).setImage(image);
shell.pack();

shell.open();

while (!shell.isDisposed()) {
	if (!display.readAndDispatch()) {
		display.sleep();
	}
}
display.dispose();
  • Run the snippet with -Dswt.autoScale.updateOnRuntime=true
  • Move the shell from primary (100%) monitor to secondary (200%) Or use any other combination of zooms
  • See if the icons losing transparency.

Before Fix

image

After Fix

image

Note: Image is only added in snippet to show smooth scaling still applicable for bitmap images.

@ShahzaibIbrahim ShahzaibIbrahim marked this pull request as ready for review February 11, 2025 13:55
Copy link
Contributor

github-actions bot commented Feb 11, 2025

Test Results

   502 files  ±0     502 suites  ±0   10m 32s ⏱️ - 5m 20s
 4 334 tests ±0   4 320 ✅ ±0   14 💤 ±0  0 ❌ ±0 
16 575 runs  ±0  16 466 ✅ ±0  109 💤 ±0  0 ❌ ±0 

Results for commit 5448e5d. ± Comparison against base commit cc07c36.

♻️ This comment has been updated with latest results.

@ShahzaibIbrahim ShahzaibIbrahim force-pushed the master-228 branch 2 times, most recently from 64a49b9 to 1a36df3 Compare February 12, 2025 09:48
@HeikoKlare HeikoKlare force-pushed the master-228 branch 6 times, most recently from 8397969 to 80813ea Compare February 13, 2025 14:34
Enabling the smooth scaling for images with a transparency mask produce
erroneous results with a loss of transparency. This guards the
application of smooth scaling with the given image not having a
transparency mask.
@HeikoKlare HeikoKlare merged commit 12e0564 into eclipse-platform:master Feb 13, 2025
14 checks passed
@HeikoKlare HeikoKlare deleted the master-228 branch February 13, 2025 16:13
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.

Wrong type of ImageData generated by smooth scaling
3 participants