summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-03-02 23:53:26 (GMT)
committerhobbs <hobbs>2000-03-02 23:53:26 (GMT)
commitdce4aa48ee2b710aa9a7de6fc2f232c7d19e59f9 (patch)
treea40eff55f84947ff378378efb211455e715887fb
parent067c0df725833372c99b28875b37891f7de40d15 (diff)
downloadtk-dce4aa48ee2b710aa9a7de6fc2f232c7d19e59f9.zip
tk-dce4aa48ee2b710aa9a7de6fc2f232c7d19e59f9.tar.gz
tk-dce4aa48ee2b710aa9a7de6fc2f232c7d19e59f9.tar.bz2
* tests/color.test:
* xlib/xcolors.c (XParseColor FindColor): * win/tkWinColor.c (XAllocColor): Fixed bit fiddling for colors to return "correct" values for color mapping. [Bug: 4282]
-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;