[cairo-commit] src/cairo-bentley-ottmann-rectangular.c
Bryce Harrington
bryce at kemper.freedesktop.org
Mon Jul 27 18:20:21 PDT 2015
src/cairo-bentley-ottmann-rectangular.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
New commits:
commit 576bb3ffee2318cd50ecfd4717c8e6421d61d885
Author: Bryce Harrington <bryce at osg.samsung.com>
Date: Mon Jul 27 18:00:55 2015 -0700
If more than one trap is passed in then it's guaranteed that the
returned traps will have their left edge to the left of their right
edge, but if only one trap is passed in then the function always returns
without doing anything. This results in incorrect rendering of SVG
paths with more than one subpath.
Currently calls to _cairo_bentley_ottmann_tessellate_rectangular_traps
are guarded by traps.has_intersections checks, so this is only a
theoretical bug. But we'll eliminate the potential of the bug by
making the left side to be left of the right side, similar to what was
done in _cairo_bentley_ottmann_tessellate_boxes (commit 11b6c49c).
Patch authored by Tom Klein for Mozilla.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=90984
Ref: https://bugzilla.mozilla.org/show_bug.cgi?id=853889
Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
diff --git a/src/cairo-bentley-ottmann-rectangular.c b/src/cairo-bentley-ottmann-rectangular.c
index 5541bdc..29f902c 100644
--- a/src/cairo-bentley-ottmann-rectangular.c
+++ b/src/cairo-bentley-ottmann-rectangular.c
@@ -672,10 +672,19 @@ _cairo_bentley_ottmann_tessellate_rectangular_traps (cairo_traps_t *traps,
cairo_status_t status;
int i;
- if (unlikely (traps->num_traps <= 1))
+ assert (traps->is_rectangular);
+
+ if (unlikely (traps->num_traps <= 1)) {
+ if (traps->num_traps == 1) {
+ cairo_trapezoid_t *trap = traps->traps;
+ if (trap->left.p1.x > trap->right.p1.x) {
+ cairo_line_t tmp = trap->left;
+ trap->left = trap->right;
+ trap->right = tmp;
+ }
+ }
return CAIRO_STATUS_SUCCESS;
-
- assert (traps->is_rectangular);
+ }
dump_traps (traps, "bo-rects-traps-in.txt");
More information about the cairo-commit
mailing list