diff options
author | Silenio Quarti | 2011-10-21 15:05:58 +0000 |
---|---|---|
committer | Silenio Quarti | 2011-10-21 15:05:58 +0000 |
commit | bd2766fbbc1833bd27095dbb70acd67cae7b7651 (patch) | |
tree | 73d915f8612962ed2cb918d673e94d72c6e1a519 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal | |
parent | 4413b196a3c0667867869360085098c445fd3306 (diff) | |
download | eclipse.platform.swt-bd2766fbbc1833bd27095dbb70acd67cae7b7651.tar.gz eclipse.platform.swt-bd2766fbbc1833bd27095dbb70acd67cae7b7651.tar.xz eclipse.platform.swt-bd2766fbbc1833bd27095dbb70acd67cae7b7651.zip |
remove floating point math for pre-multiplied alpha
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/ImageList.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/ImageList.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/ImageList.java index be1310f77e..4274870c69 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/ImageList.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/ImageList.java @@ -56,10 +56,9 @@ public static int /*long*/ createPixbuf(Image image) { int b = line[offset + ob] & 0xFF; line[offset + 3] = (byte)a; if (a != 0) { - //TODO write this without floating point math - line[offset + 0] = (byte)(((r) / (float)a) * 0xFF); - line[offset + 1] = (byte)(((g) / (float)a) * 0xFF); - line[offset + 2] = (byte)(((b) / (float)a) * 0xFF); + line[offset + 0] = (byte)(((r * 0xFF) + a / 2) / a); + line[offset + 1] = (byte)(((g * 0xFF) + a / 2) / a); + line[offset + 2] = (byte)(((b * 0xFF) + a / 2) / a); } } OS.memmove (pixels + (y * stride), line, stride); |