summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2003-11-11 00:26:16 (GMT)
committerhobbs <hobbs>2003-11-11 00:26:16 (GMT)
commit4c25e8fdfdfbbc4f3b10f030e43f1f4fe13838d6 (patch)
tree9a9d32b3274d799143980dc53f9e7d8e4900e4b8
parent999d107d4da05b69bc623ad414e6705ff33ad61a (diff)
downloadtk-4c25e8fdfdfbbc4f3b10f030e43f1f4fe13838d6.zip
tk-4c25e8fdfdfbbc4f3b10f030e43f1f4fe13838d6.tar.gz
tk-4c25e8fdfdfbbc4f3b10f030e43f1f4fe13838d6.tar.bz2
* win/tkWinDraw.c (XFillRectangles): correctly handle the
XGCValues.function parameter when filling rectangles. [Bug #820278] [Patch #820282]
-rw-r--r--ChangeLog4
-rw-r--r--win/tkWinDraw.c31
2 files changed, 29 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 8a340f0..e999a19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2003-11-10 Jeff Hobbs <jeffh@ActiveState.com>
+ * win/tkWinDraw.c (XFillRectangles): correctly handle the
+ XGCValues.function parameter when filling rectangles.
+ [Bug #820278] [Patch #820282]
+
* win/configure:
* win/configure.in: define TK_LIB_FLAG, TK_LIB_SPEC,
TK_BUILD_LIB_SPEC, TK_STUB_LIB_SPEC, TK_STUB_LIB_PATH, and
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index 39a3d9c..86d22a8 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinDraw.c,v 1.12 2003/02/26 02:47:04 hobbs Exp $
+ * RCS: @(#) $Id: tkWinDraw.c,v 1.13 2003/11/11 00:26:17 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -630,7 +630,7 @@ XFillRectangles(display, d, gc, rectangles, nrectangles)
int i;
RECT rect;
TkWinDCState state;
- HBRUSH brush;
+ HBRUSH brush, oldBrush;
if (d == None) {
return;
@@ -644,7 +644,7 @@ XFillRectangles(display, d, gc, rectangles, nrectangles)
|| gc->fill_style == FillOpaqueStippled)
&& gc->stipple != None) {
TkWinDrawable *twdPtr = (TkWinDrawable *)gc->stipple;
- HBRUSH oldBrush, stipple;
+ HBRUSH stipple;
HBITMAP oldBitmap, bitmap;
HDC dcMem;
HBRUSH bgBrush = CreateSolidBrush(gc->background);
@@ -694,9 +694,28 @@ XFillRectangles(display, d, gc, rectangles, nrectangles)
DeleteObject(stipple);
DeleteObject(bgBrush);
} else {
- for (i = 0; i < nrectangles; i++) {
- TkWinFillRect(dc, rectangles[i].x, rectangles[i].y,
- rectangles[i].width, rectangles[i].height, gc->foreground);
+ if (gc->function == GXcopy) {
+ for (i = 0; i < nrectangles; i++) {
+ rect.left = rectangles[i].x;
+ rect.right = rect.left + rectangles[i].width;
+ rect.top = rectangles[i].y;
+ rect.bottom = rect.top + rectangles[i].height;
+ FillRect(dc, &rect, brush);
+ }
+ } else {
+ HPEN newPen = CreatePen(PS_NULL, 0, gc->foreground);
+ HPEN oldPen = SelectObject(dc, newPen);
+ oldBrush = SelectObject(dc, brush);
+
+ for (i = 0; i < nrectangles; i++) {
+ Rectangle(dc, rectangles[i].x, rectangles[i].y,
+ rectangles[i].x + rectangles[i].width + 1,
+ rectangles[i].y + rectangles[i].height + 1);
+ }
+
+ SelectObject(dc, oldBrush);
+ SelectObject(dc, oldPen);
+ DeleteObject(newPen);
}
}
DeleteObject(brush);