Bug 426247 - [Graphics] org.eclipse.ui/icons/full/obj16/blank.png is
shown as black box in Eclipse

Change-Id: I71dd783809878e9fb55c1a4ba56723fff7a900fc
Signed-off-by: Niraj Modi <niraj.modi@in.ibm.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ImageList.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ImageList.java
index 87f7b27..6f31c07 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ImageList.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ImageList.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 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
@@ -405,7 +405,27 @@
 			ImageData data = image.getImageData ();
 			switch (data.getTransparencyType ()) {
 				case SWT.TRANSPARENCY_ALPHA:
-					if (OS.COMCTL32_MAJOR >= 6) {
+					/*
+					 * Fully transparent image is rendered as a black image, so such
+					 * image needs to be rendered using ImageData mask approach.
+					 * Refer bug 426247
+					 * 
+					 * TODO: Explore using createMaskFromAlpha() method even
+					 * for newer versions of the COMCTL32 library.
+					 */
+					boolean fullyTransparent = true;
+					if (data.alphaData == null) {
+						fullyTransparent = false;
+					}
+					else {
+						for (byte alphaData : data.alphaData) {
+							if (alphaData != 0) {
+								fullyTransparent = false;
+								break;
+							}
+						}
+					}
+					if (OS.COMCTL32_MAJOR >= 6 && !fullyTransparent) {
 						hBitmap = copyWithAlpha (hImage, -1, data.alphaData, cx [0], cy [0]);
 					} else {
 						hBitmap = copyBitmap (hImage, cx [0], cy [0]);