[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (d78a5ad30f1ad2d183306ec0b4c0e75d9db02ef9)
The branch, master has been updated
via d78a5ad30f1ad2d183306ec0b4c0e75d9db02ef9 (commit)
via 6b2b5df93273fd4b6c95ed65679982e39aae8f2d (commit)
from 9d40aaacebbdeaff69be5e28bbd2a186bd6bd304 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
src/polygon.c | 26 +++++++++++---------------
1 files changed, 11 insertions(+), 15 deletions(-)
=================
Commit Messages
=================
commit d78a5ad30f1ad2d183306ec0b4c0e75d9db02ef9
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
polygon.c: Fix dicer to give up if the clipping region passed is invalid.
Most of the dance checking return codes from polyBoolean_free was
unnecessary, as it sets the output to NULL if there is a problem, so
remove that. Whilst we're at it, fix up some variable names to make the
operation of the function clearer.
:100644 100644 b17edf0... 14f239d... M src/polygon.c
commit 6b2b5df93273fd4b6c95ed65679982e39aae8f2d
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
polygon.c: Make RectPoly return NULL for zero or negatively sized rectangles
Previously we would hit an assertion failure, where we could indicate the
problem by returning NULL.
I've hit an issue in which some expose events in the GTK (+GL) HID are
collapsing to a zero-width region on the PCB, and some code is tripping
up on the bad clip polygon produced using RectPoly on the coordinates.
This causes segfaults in the branch which contains code to clip rendering
of the soldermask at the board outline.
We could (and perhaps should) test in the expose handler, but the failure
mode here is not ideal. Since most builds of PCB run with asserts disabled,
the asserts are not hit here and a bad polygon is silently gets created
with no contours. This upsets the polygon algebra routines somewhat, but
returning a NULL (empty) polygon would be fine.
:100644 100644 7367968... b17edf0... M src/polygon.c
=========
Changes
=========
commit d78a5ad30f1ad2d183306ec0b4c0e75d9db02ef9
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
polygon.c: Fix dicer to give up if the clipping region passed is invalid.
Most of the dance checking return codes from polyBoolean_free was
unnecessary, as it sets the output to NULL if there is a problem, so
remove that. Whilst we're at it, fix up some variable names to make the
operation of the function clearer.
diff --git a/src/polygon.c b/src/polygon.c
index b17edf0..14f239d 100644
--- a/src/polygon.c
+++ b/src/polygon.c
@@ -1750,29 +1750,23 @@ void
NoHolesPolygonDicer (PolygonTypePtr p, const BoxType * clip,
void (*emit) (PLINE *, void *), void *user_data)
{
- POLYAREA *save, *ans, *cur, *next;
+ POLYAREA *main_contour, *cur, *next;
- ans = save = poly_Create ();
+ main_contour = poly_Create ();
/* copy the main poly only */
- poly_Copy1 (save, p->Clipped);
+ poly_Copy1 (main_contour, p->Clipped);
/* clip to the bounding box */
if (clip)
{
POLYAREA *cbox = RectPoly (clip->X1, clip->X2, clip->Y1, clip->Y2);
- if (cbox)
- {
- int r = poly_Boolean_free (save, cbox, &ans, PBO_ISECT);
- save = ans;
- if (r != err_ok)
- save = NULL;
- }
+ poly_Boolean_free (main_contour, cbox, &main_contour, PBO_ISECT);
}
- if (!save)
+ if (main_contour == NULL)
return;
/* Now dice it up.
* NB: Could be more than one piece (because of the clip above)
*/
- cur = save;
+ cur = main_contour;
do
{
next = cur->f;
@@ -1780,7 +1774,7 @@ NoHolesPolygonDicer (PolygonTypePtr p, const BoxType * clip,
r_NoHolesPolygonDicer (cur, emit, user_data);
/* NB: The POLYAREA was freed by its use in the recursive dicer */
}
- while ((cur = next) != save);
+ while ((cur = next) != main_contour);
}
/* make a polygon split into multiple parts into multiple polygons */
commit 6b2b5df93273fd4b6c95ed65679982e39aae8f2d
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
polygon.c: Make RectPoly return NULL for zero or negatively sized rectangles
Previously we would hit an assertion failure, where we could indicate the
problem by returning NULL.
I've hit an issue in which some expose events in the GTK (+GL) HID are
collapsing to a zero-width region on the PCB, and some code is tripping
up on the bad clip polygon produced using RectPoly on the coordinates.
This causes segfaults in the branch which contains code to clip rendering
of the soldermask at the board outline.
We could (and perhaps should) test in the expose handler, but the failure
mode here is not ideal. Since most builds of PCB run with asserts disabled,
the asserts are not hit here and a bad polygon is silently gets created
with no contours. This upsets the polygon algebra routines somewhat, but
returning a NULL (empty) polygon would be fine.
diff --git a/src/polygon.c b/src/polygon.c
index 7367968..b17edf0 100644
--- a/src/polygon.c
+++ b/src/polygon.c
@@ -335,8 +335,10 @@ RectPoly (Coord x1, Coord x2, Coord y1, Coord y2)
PLINE *contour = NULL;
Vector v;
- assert (x2 > x1);
- assert (y2 > y1);
+ /* Return NULL for zero or negatively sized rectangles */
+ if (x2 <= x1 || y2 <= y1)
+ return NULL;
+
v[0] = x1;
v[1] = y1;
if ((contour = poly_NewContour (v)) == NULL)
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs