diff options
author | hobbs <hobbs@noemail.net> | 2000-03-02 23:53:26 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 2000-03-02 23:53:26 (GMT) |
commit | e547376023939c339be656df15cf19816e4d78b0 (patch) | |
tree | a40eff55f84947ff378378efb211455e715887fb | |
parent | 1dcf4098629b6d626d942fffcbc4cc95ccccf7ec (diff) | |
download | tk-e547376023939c339be656df15cf19816e4d78b0.zip tk-e547376023939c339be656df15cf19816e4d78b0.tar.gz tk-e547376023939c339be656df15cf19816e4d78b0.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]
FossilOrigin-Name: 715adc7da8ee2b83a8bf78647b9c266f4d4130f8
-rw-r--r-- | xlib/xcolors.c | 17 |
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; |