Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn MacLeod2012-02-29 15:32:28 +0000
committerCarolyn MacLeod2012-02-29 15:32:28 +0000
commitc836120aac820af31403079dbaf5511db590b016 (patch)
treeb0336e0543a8191b1f2366f54797dea8e2b6816e
parent674130de6d18a5e8ff6185d5c42d30dc208f1519 (diff)
downloadeclipse.platform.swt-c836120aac820af31403079dbaf5511db590b016.tar.gz
eclipse.platform.swt-c836120aac820af31403079dbaf5511db590b016.tar.xz
eclipse.platform.swt-c836120aac820af31403079dbaf5511db590b016.zip
Work in progress for bug 212023 - limitation of SWT ColorDialog
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java
index cfc9cb5722..be00a74d7e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ColorDialog.java
@@ -217,14 +217,15 @@ public RGB open () {
/* Set the Custom Colors (if any) into the dialog */
if (rgbs != null) {
- for (int i=0; i<rgbs.length; i++) {
+ int length = rgbs.length > CUSTOM_COLOR_COUNT ? CUSTOM_COLOR_COUNT : rgbs.length;
+ for (int i=0; i<length; i++) {
RGB rgb = rgbs [i];
int red = rgb.red & 0xFF;
int green = (rgb.green << 8) & 0xFF00;
int blue = (rgb.blue << 16) & 0xFF0000;
colors[i] = red | green | blue;
}
- for (int i=rgbs.length; i < CUSTOM_COLOR_COUNT; i++) {
+ for (int i=length; i < CUSTOM_COLOR_COUNT; i++) {
colors[i] = 0x00FFFFFF;
}
OS.MoveMemory (display.lpCustColors, colors, CUSTOM_COLOR_COUNT * 4);

Back to the top