summaryrefslogtreecommitdiffstats
path: root/win/tkWinColor.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-03-02 23:52:36 (GMT)
committerhobbs <hobbs>2000-03-02 23:52:36 (GMT)
commit2e992346d67c6e23c86d6d3808a0895116140fea (patch)
tree7de3d6716b43c5986c312c8a093a24dfdf3eebdf /win/tkWinColor.c
parent5cb508c4cca65602bd2fdb7013f5accbff1ddb18 (diff)
downloadtk-2e992346d67c6e23c86d6d3808a0895116140fea.zip
tk-2e992346d67c6e23c86d6d3808a0895116140fea.tar.gz
tk-2e992346d67c6e23c86d6d3808a0895116140fea.tar.bz2
* win/tkWinInt.h: change extern to EXTERN for TkWinChildProc
declaration with extra #defs. [Bug: 4240] * 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]
Diffstat (limited to 'win/tkWinColor.c')
-rw-r--r--win/tkWinColor.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/win/tkWinColor.c b/win/tkWinColor.c
index febf0cb..91a482b 100644
--- a/win/tkWinColor.c
+++ b/win/tkWinColor.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: tkWinColor.c,v 1.3 1999/04/16 01:51:49 stanton Exp $
+ * RCS: @(#) $Id: tkWinColor.c,v 1.4 2000/03/02 23:52:36 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -373,9 +373,9 @@ XAllocColor(display, colormap, color)
if ((index >= cmap->size) || (newPixel != closePixel)) {
if (cmap->size == sizePalette) {
- color->red = closeEntry.peRed << 8;
- color->green = closeEntry.peGreen << 8;
- color->blue = closeEntry.peBlue << 8;
+ color->red = (closeEntry.peRed << 8) | closeEntry.peRed;
+ color->green = (closeEntry.peGreen << 8) | closeEntry.peGreen;
+ color->blue = (closeEntry.peBlue << 8) | closeEntry.peBlue;
entry = closeEntry;
if (index >= cmap->size) {
OutputDebugString("XAllocColor: Colormap is bigger than we thought");
@@ -404,9 +404,12 @@ XAllocColor(display, colormap, color)
color->pixel = GetNearestColor(dc,
RGB(entry.peRed, entry.peGreen, entry.peBlue));
- color->red = (GetRValue(color->pixel) << 8);
- color->green = (GetGValue(color->pixel) << 8);
- color->blue = (GetBValue(color->pixel) << 8);
+ color->red = GetRValue(color->pixel);
+ color->red |= (color->red << 8);
+ color->green = GetGValue(color->pixel);
+ color->green |= (color->green << 8);
+ color->blue = GetBValue(color->pixel);
+ color->blue |= (color->blue << 8);
}
ReleaseDC(NULL, dc);