Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiraj Modi2018-05-07 02:57:46 -0400
committerNiraj Modi2018-05-07 02:57:46 -0400
commit666356d88ba7544a9cd64a502c564db3e6edb535 (patch)
treeeb7c6b6580a8982bed60adca27009d666d2f1943 /bundles/org.eclipse.swt/Eclipse SWT/win32
parent089ee64f4be07cb1cf1404fd5d249f1cf061cebd (diff)
downloadeclipse.platform.swt-666356d88ba7544a9cd64a502c564db3e6edb535.tar.gz
eclipse.platform.swt-666356d88ba7544a9cd64a502c564db3e6edb535.tar.xz
eclipse.platform.swt-666356d88ba7544a9cd64a502c564db3e6edb535.zip
Bug 532443 - Creating a new Image using SWT.IMAGE_GRAY returns an Image
equal to the old Image - Also fixed the JavaDoc typo in ImageDataProvider.java and ImageFileNameProvider.java Change-Id: I2d40061a256e5feba717b765f7cbe9b3e359e508 Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/win32')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
index c78ec94891..ed69d81b4a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/Image.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -129,6 +129,13 @@ public final class Image extends Resource implements Drawable {
private ImageDataProvider imageDataProvider;
/**
+ * Style flag used to differentiate normal, gray-scale and disabled images based
+ * on image data providers. Without this, a normal and a disabled image of the
+ * same image data provider would be considered equal.
+ */
+ private int styleFlag = SWT.IMAGE_COPY;
+
+ /**
* Attribute to cache current device zoom level
*/
private int currentDeviceZoom = 100;
@@ -245,6 +252,7 @@ public Image(Device device, Image srcImage, int flag) {
this.type = srcImage.type;
this.imageDataProvider = srcImage.imageDataProvider;
this.imageFileNameProvider = srcImage.imageFileNameProvider;
+ this.styleFlag = srcImage.styleFlag | flag;
this.currentDeviceZoom = srcImage.currentDeviceZoom;
switch (flag) {
case SWT.IMAGE_COPY: {
@@ -1165,9 +1173,9 @@ public boolean equals (Object object) {
Image image = (Image) object;
if (device != image.device || transparentPixel != image.transparentPixel) return false;
if (imageDataProvider != null && image.imageDataProvider != null) {
- return imageDataProvider.equals (image.imageDataProvider);
+ return (styleFlag == image.styleFlag) && imageDataProvider.equals (image.imageDataProvider);
} else if (imageFileNameProvider != null && image.imageFileNameProvider != null) {
- return imageFileNameProvider.equals (image.imageFileNameProvider);
+ return (styleFlag == image.styleFlag) && imageFileNameProvider.equals (image.imageFileNameProvider);
} else {
return handle == image.handle;
}

Back to the top