summaryrefslogtreecommitdiffstats
path: root/xlib
diff options
context:
space:
mode:
Diffstat (limited to 'xlib')
-rw-r--r--xlib/xcolors.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/xlib/xcolors.c b/xlib/xcolors.c
index bc15d42..f345e08 100644
--- a/xlib/xcolors.c
+++ b/xlib/xcolors.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: xcolors.c,v 1.2 1998/09/14 18:24:02 stanton Exp $
+ * RCS: @(#) $Id: xcolors.c,v 1.3 2000/03/02 23:53:26 hobbs Exp $
*/
#include <tkInt.h>
@@ -854,9 +854,9 @@ FindColor(name, colorPtr)
if (l > u) {
return 0;
}
- colorPtr->red = xColors[i].red << 8;
- colorPtr->green = xColors[i].green << 8;
- colorPtr->blue = xColors[i].blue << 8;
+ colorPtr->red = ((xColors[i].red << 8) | xColors[i].red);
+ colorPtr->green = ((xColors[i].green << 8) | xColors[i].green);
+ colorPtr->blue = ((xColors[i].blue << 8) | xColors[i].blue);
return 1;
}
@@ -896,9 +896,12 @@ XParseColor(display, map, spec, colorPtr)
if (sscanf(spec+1, fmt, &red, &green, &blue) != 3) {
return 0;
}
- colorPtr->red = ((unsigned short) red) << (4 * (4 - i));
- colorPtr->green = ((unsigned short) green) << (4 * (4 - i));
- colorPtr->blue = ((unsigned short) blue) << (4 * (4 - i));
+ colorPtr->red = (((unsigned short) red) << (4 * (4 - i)))
+ | ((unsigned short) red);
+ colorPtr->green = (((unsigned short) green) << (4 * (4 - i)))
+ | ((unsigned short) green);
+ colorPtr->blue = (((unsigned short) blue) << (4 * (4 - i)))
+ | ((unsigned short) blue);
} else {
if (!FindColor(spec, colorPtr)) {
return 0;