summaryrefslogtreecommitdiffstats
path: root/src/display/inkscape-cairo.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2009-01-02 15:33:11 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2009-01-02 15:33:11 +0000
commit9429b6ba9a9952a31f3efd42ed816f64cffdf7f8 (patch)
treea2eea918acc3efddb003372050e75264127d7f32 /src/display/inkscape-cairo.cpp
parentfix bug in livarot where open paths are rendered as closed path when start ==... (diff)
downloadinkscape-9429b6ba9a9952a31f3efd42ed816f64cffdf7f8.tar.gz
inkscape-9429b6ba9a9952a31f3efd42ed816f64cffdf7f8.zip
improve cairo path drawing
(bzr r7060)
Diffstat (limited to 'src/display/inkscape-cairo.cpp')
-rw-r--r--src/display/inkscape-cairo.cpp43
1 files changed, 20 insertions, 23 deletions
diff --git a/src/display/inkscape-cairo.cpp b/src/display/inkscape-cairo.cpp
index a31a9387f..a3e550fc5 100644
--- a/src/display/inkscape-cairo.cpp
+++ b/src/display/inkscape-cairo.cpp
@@ -157,14 +157,7 @@ feed_path_to_cairo (cairo_t *ct, Geom::Path const &path)
}
if (path.closed()) {
- cairo_line_to(ct, path.initialPoint()[0], path.initialPoint()[1]);
-// cairo_close_path(ct);
- /* I think we should use cairo_close_path(ct) here but it doesn't work. (the closing line is not rendered completely)
- According to cairo documentation:
- The behavior of cairo_close_path() is distinct from simply calling cairo_line_to() with the equivalent coordinate
- in the case of stroking. When a closed sub-path is stroked, there are no caps on the ends of the sub-path. Instead,
- there is a line join connecting the final and initial segments of the sub-path.
- */
+ cairo_close_path(ct);
}
}
@@ -193,21 +186,25 @@ feed_path_to_cairo (cairo_t *ct, Geom::Path const &path, Geom::Matrix trans, Geo
}
if (path.closed()) {
- cairo_line_to(ct, initial[0], initial[1]);
- /* We cannot use cairo_close_path(ct) here because some parts of the path may have been
- clipped and not drawn (maybe the before last segment was outside view area), which
- would result in closing the "subpath" after the last interruption, not the entire path.
-
- However, according to cairo documentation:
- The behavior of cairo_close_path() is distinct from simply calling cairo_line_to() with the equivalent coordinate
- in the case of stroking. When a closed sub-path is stroked, there are no caps on the ends of the sub-path. Instead,
- there is a line join connecting the final and initial segments of the sub-path.
-
- The correct fix will be possible when cairo introduces methods for moving without
- ending/starting subpaths, which we will use for skipping invisible segments; then we
- will be able to use cairo_close_path here. This issue also affects ps/eps/pdf export,
- see bug 168129
- */
+ if (!optimize_stroke) {
+ cairo_close_path(ct);
+ } else {
+ cairo_line_to(ct, initial[0], initial[1]);
+ /* We cannot use cairo_close_path(ct) here because some parts of the path may have been
+ clipped and not drawn (maybe the before last segment was outside view area), which
+ would result in closing the "subpath" after the last interruption, not the entire path.
+
+ However, according to cairo documentation:
+ The behavior of cairo_close_path() is distinct from simply calling cairo_line_to() with the equivalent coordinate
+ in the case of stroking. When a closed sub-path is stroked, there are no caps on the ends of the sub-path. Instead,
+ there is a line join connecting the final and initial segments of the sub-path.
+
+ The correct fix will be possible when cairo introduces methods for moving without
+ ending/starting subpaths, which we will use for skipping invisible segments; then we
+ will be able to use cairo_close_path here. This issue also affects ps/eps/pdf export,
+ see bug 168129
+ */
+ }
}
}