Skip to content

Commit 9a2a885

Browse files
committed
Simplify ControlExample image resources loading
Gif images do not contain transparency mask, it's generated based on the transparencyIndex value. As the codec already knows the transparencyIndex and applies it this is just useless operation.
1 parent 438fece commit 9a2a885

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

  • examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample

examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2022 IBM Corporation and others.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,7 +13,6 @@
1313
*******************************************************************************/
1414
package org.eclipse.swt.examples.controlexample;
1515

16-
1716
import java.io.InputStream;
1817
import java.text.MessageFormat;
1918
import java.util.MissingResourceException;
@@ -48,12 +47,6 @@ public class ControlExample {
4847
"target.gif", //$NON-NLS-1$
4948
"backgroundImage.png", //$NON-NLS-1$
5049
"parentBackgroundImage.png"}; //$NON-NLS-1$
51-
static final int[] imageTypes = {
52-
SWT.ICON,
53-
SWT.ICON,
54-
SWT.ICON,
55-
SWT.BITMAP,
56-
SWT.BITMAP};
5750

5851
boolean startup = true;
5952

@@ -205,12 +198,7 @@ void initResources() {
205198
for (int i = 0; i < imageLocations.length; ++i) {
206199
try (InputStream sourceStream = clazz.getResourceAsStream(imageLocations[i])) {
207200
ImageData source = new ImageData(sourceStream);
208-
if (imageTypes[i] == SWT.ICON) {
209-
ImageData mask = source.getTransparencyMask();
210-
images[i] = new Image(null, source, mask);
211-
} else {
212-
images[i] = new Image(null, source);
213-
}
201+
images[i] = new Image(null, source);
214202
}
215203
}
216204
}

0 commit comments

Comments
 (0)