summaryrefslogtreecommitdiffstats
path: root/src/extension/internal/pdf-cairo.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-07-12 15:44:30 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-07-12 15:44:30 +0000
commit9377f816024bd56159ee1f1760c08098f25ef25f (patch)
treebe86e5fd686a64317670ae49546cee26382ef61d /src/extension/internal/pdf-cairo.cpp
parentadd simplified feed_path_to_cairo functions (diff)
downloadinkscape-9377f816024bd56159ee1f1760c08098f25ef25f.tar.gz
inkscape-9377f816024bd56159ee1f1760c08098f25ef25f.zip
* remove code duplication from pdf-cairo extension
* try to fix line closing bug when using cairo. didn't succeed (bzr r6276)
Diffstat (limited to 'src/extension/internal/pdf-cairo.cpp')
-rw-r--r--src/extension/internal/pdf-cairo.cpp49
1 files changed, 6 insertions, 43 deletions
diff --git a/src/extension/internal/pdf-cairo.cpp b/src/extension/internal/pdf-cairo.cpp
index 6dfed9e82..813724e71 100644
--- a/src/extension/internal/pdf-cairo.cpp
+++ b/src/extension/internal/pdf-cairo.cpp
@@ -48,6 +48,7 @@
#include <glibmm/i18n.h>
#include "display/nr-arena-item.h"
#include "display/canvas-bpath.h"
+#include "display/inkscape-cairo.h"
#include "sp-item.h"
#include "style.h"
#include "sp-linear-gradient.h"
@@ -600,9 +601,9 @@ PrintCairoPDF::fill(Inkscape::Extension::Print *mod, Geom::PathVector const &pat
cairo_save(cr);
print_fill_style(cr, style, pbox);
- NArtBpath * bpath = BPath_from_2GeomPath(pathv);
- print_bpath(cr, bpath);
- g_free(bpath);
+
+ feed_pathvector_to_cairo(cr, pathv);
+
if (style->fill_rule.computed == SP_WIND_RULE_EVENODD) {
cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
} else {
@@ -700,9 +701,8 @@ PrintCairoPDF::stroke(Inkscape::Extension::Print *mod, Geom::PathVector const &p
cairo_save(cr);
print_stroke_style(cr, style, pbox);
- NArtBpath * bpath = BPath_from_2GeomPath(pathv);
- print_bpath(cr, bpath);
- g_free(bpath);
+
+ feed_pathvector_to_cairo(cr, pathv);
cairo_stroke(cr);
cairo_restore(cr);
@@ -988,43 +988,6 @@ PrintCairoPDF::text(Inkscape::Extension::Print *mod, char const *text, NR::Point
/* Helper functions */
-void
-PrintCairoPDF::print_bpath(cairo_t *cr, NArtBpath const *bp)
-{
- cairo_new_path(cr);
- bool closed = false;
- while (bp->code != NR_END) {
- switch (bp->code) {
- case NR_MOVETO:
- if (closed) {
- cairo_close_path(cr);
- }
- closed = true;
- cairo_move_to(cr, bp->x3, bp->y3);
- break;
- case NR_MOVETO_OPEN:
- if (closed) {
- cairo_close_path(cr);
- }
- closed = false;
- cairo_move_to(cr, bp->x3, bp->y3);
- break;
- case NR_LINETO:
- cairo_line_to(cr, bp->x3, bp->y3);
- break;
- case NR_CURVETO:
- cairo_curve_to(cr, bp->x1, bp->y1, bp->x2, bp->y2, bp->x3, bp->y3);
- break;
- default:
- break;
- }
- bp += 1;
- }
- if (closed) {
- cairo_close_path(cr);
- }
-}
-
static void
_concat_transform(cairo_t *cr, double xx, double yx, double xy, double yy, double x0, double y0)
{