summaryrefslogtreecommitdiffstats
path: root/src/display/inkscape-cairo.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2008-04-07 00:51:24 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2008-04-07 00:51:24 +0000
commitc9a62859b455a2ea82ff74d25c35b5bdacd98dac (patch)
treed1f0bb1be370676a5779c3851a7cc298a0659bc2 /src/display/inkscape-cairo.cpp
parentconsistency with offset keys (diff)
downloadinkscape-c9a62859b455a2ea82ff74d25c35b5bdacd98dac.tar.gz
inkscape-c9a62859b455a2ea82ff74d25c35b5bdacd98dac.zip
fix bug with garbage lines caused with close_path when part of a subpath is optimized out
(bzr r5360)
Diffstat (limited to 'src/display/inkscape-cairo.cpp')
-rw-r--r--src/display/inkscape-cairo.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/display/inkscape-cairo.cpp b/src/display/inkscape-cairo.cpp
index 5d87d39b2..d2e2b7d8b 100644
--- a/src/display/inkscape-cairo.cpp
+++ b/src/display/inkscape-cairo.cpp
@@ -56,17 +56,27 @@ feed_curve_to_cairo (cairo_t *ct, NArtBpath *bpath, NR::Matrix trans, NR::Maybe<
view.growBy (stroke_width);
NR::Rect swept;
bool closed = false;
+ NR::Point startpath(0,0);
for (int i = 0; bpath[i].code != NR_END; i++) {
switch (bpath[i].code) {
case NR_MOVETO_OPEN:
case NR_MOVETO:
- if (closed) cairo_close_path(ct);
- closed = (bpath[i].code == NR_MOVETO);
+ if (closed) {
+ // we cannot use close_path because some of the curves/lines may have been optimized out
+ cairo_line_to(ct, startpath[NR::X], startpath[NR::Y]);
+ }
next[NR::X] = bpath[i].x3;
next[NR::Y] = bpath[i].y3;
next *= trans;
last = next;
next -= shift;
+ if (bpath[i].code == NR_MOVETO) {
+ // remember the start point of the subpath, for closing it later
+ closed = true;
+ startpath = next;
+ } else {
+ closed = false;
+ }
cairo_move_to(ct, next[NR::X], next[NR::Y]);
break;