summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--generic/tkCanvPoly.c21
-rw-r--r--tests/canvas.test21
3 files changed, 35 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 37e0ec5..41503b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2001-07-03 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * tests/canvas.test:
+ * generic/tkCanvPoly.c (PolygonToArea): Added patch that respects
+ the polygon difference of including points in the polygon even
+ when fill is empty. [Bug #226357]
+
2001-07-03 Mo DeJong <mdejong@redhat.com>
* win/Makefile.in: Remove PATHTYPE variable.
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index 8e21d4f..c4adf3c 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.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: tkCanvPoly.c,v 1.7 2001/07/03 06:03:44 hobbs Exp $
+ * RCS: @(#) $Id: tkCanvPoly.c,v 1.8 2001/07/04 00:40:11 hobbs Exp $
*/
#include <stdio.h>
@@ -1484,21 +1484,16 @@ PolygonToArea(canvas, itemPtr, rectPtr)
polyPoints = polyPtr->coordPtr;
}
- if (polyPtr->fillGC != None) {
- inside = TkPolygonToArea(polyPoints, numPoints, rectPtr);
- if (inside==0) goto donearea;
- } else {
- if ((polyPoints[0] >= rectPtr[0])
- && (polyPoints[0] <= rectPtr[2])
- && (polyPoints[1] >= rectPtr[1])
- && (polyPoints[1] <= rectPtr[3])) {
- inside = 1;
- }
- }
+ /*
+ * Simple test to see if we are in the polygon. Polygons are
+ * different from othe canvas items in that they register points
+ * being inside even if it isn't filled.
+ */
+ inside = TkPolygonToArea(polyPoints, numPoints, rectPtr);
+ if (inside==0) goto donearea;
if (polyPtr->outline.gc == None) goto donearea ;
-
/*
* Iterate through all of the edges of the line, computing a polygon
* for each edge and testing the area against that polygon. In
diff --git a/tests/canvas.test b/tests/canvas.test
index 5029c0a..15cd806 100644
--- a/tests/canvas.test
+++ b/tests/canvas.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-2000 Ajuba Solutions.
# All rights reserved.
#
-# RCS: @(#) $Id: canvas.test,v 1.12 2001/04/03 04:40:31 hobbs Exp $
+# RCS: @(#) $Id: canvas.test,v 1.13 2001/07/04 00:40:11 hobbs Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
source [file join [pwd] [file dirname [info script]] defs.tcl]
@@ -366,6 +366,25 @@ test canvas-11.1 {canvas poly fill check, bug 5783} {
.c create polygon 0 0 100 100 200 50 \
-fill {} -stipple gray50 -outline black
} 1
+test canvas-11.2 {canvas poly overlap fill check, bug 226357} {
+ destroy .c
+ pack [canvas .c]
+ set result {}
+ .c create poly 30 30 90 90 30 90 90 30
+ lappend result [.c find over 40 40 45 45]; # rect region inc. edge
+ lappend result [.c find over 60 40 60 40]; # top-center point
+ lappend result [.c find over 0 0 0 0]; # not on poly
+ lappend result [.c find over 60 60 60 60]; # center-point
+ lappend result [.c find over 45 50 45 50]; # outside poly
+ .c itemconfig 1 -fill "" -outline black
+ lappend result [.c find over 40 40 45 45]; # rect region inc. edge
+ lappend result [.c find over 60 40 60 40]; # top-center point
+ lappend result [.c find over 0 0 0 0]; # not on poly
+ lappend result [.c find over 60 60 60 60]; # center-point
+ lappend result [.c find over 45 50 45 50]; # outside poly
+ .c itemconfig 1 -width 8
+ lappend result [.c find over 45 50 45 50]; # outside poly
+} {1 1 {} 1 {} 1 1 {} 1 {} 1}
test canvas-12.1 {canvas mm obj, patch SF-403327, 102471} {
destroy .c