summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 221c984)
raw | patch | inline | side by side (parent: 221c984)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 31 Aug 2008 14:02:18 +0000 (14:02 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 31 Aug 2008 14:02:18 +0000 (14:02 +0000) |
src/extension/internal/cairo-render-context.cpp | patch | blob | history | |
src/extension/internal/cairo-render-context.h | patch | blob | history |
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index 09d4fc74c2b9a83cca03bb55d4cc8be1118b982d..2434e454b6cc266592ad6b6403980a0f49ee3258 100644 (file)
#include <signal.h>
#include <errno.h>
-
-#include <libnr/n-art-bpath.h>
-#include <libnr/nr-matrix-ops.h>
-#include <libnr/nr-matrix-fns.h>
-#include <libnr/nr-matrix-scale-ops.h>
-#include <libnr/nr-matrix-translate-ops.h>
-#include <libnr/nr-scale-matrix-ops.h>
-#include <libnr/n-art-bpath-2geom.h>
#include <2geom/pathvector.h>
#include <glib/gmem.h>
#include "display/nr-arena-group.h"
#include "display/curve.h"
#include "display/canvas-bpath.h"
+#include "display/inkscape-cairo.h"
#include "sp-item.h"
#include "sp-item-group.h"
#include "style.h"
}
void
-CairoRenderContext::addClipPath(NArtBpath const *bp, SPIEnum const *fill_rule)
+CairoRenderContext::addClipPath(Geom::PathVector const &pv, SPIEnum const *fill_rule)
{
g_assert( _is_valid );
} else {
cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_WINDING);
}
- addBpath(bp);
+ addPathVector(pv);
}
void
@@ -1252,25 +1245,14 @@ CairoRenderContext::_setStrokeStyle(SPStyle const *style, NRRect const *pbox)
bool
CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle const *style, NRRect const *pbox)
-{
- NArtBpath * bpath = BPath_from_2GeomPath (pathv);
- const_NRBPath bp;
- bp.path = bpath;
- bool retvalue = renderPath(&bp, style, pbox);
- g_free(bpath);
- return retvalue;
-}
-
-bool
-CairoRenderContext::renderPath(const_NRBPath const *bpath, SPStyle const *style, NRRect const *pbox)
{
g_assert( _is_valid );
if (_render_mode == RENDER_MODE_CLIP) {
if (_clip_mode == CLIP_MODE_PATH) {
- addClipPath(bpath->path, &style->fill_rule);
+ addClipPath(pathv, &style->fill_rule);
} else {
- setBpath(bpath->path);
+ setPathVector(pathv);
if (style->fill_rule.value == SP_WIND_RULE_EVENODD) {
cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_EVEN_ODD);
} else {
@@ -1295,7 +1277,7 @@ CairoRenderContext::renderPath(const_NRBPath const *bpath, SPStyle const *style,
if (!style->fill.isNone()) {
_setFillStyle(style, pbox);
- setBpath(bpath->path);
+ setPathVector(pathv);
if (style->fill_rule.value == SP_WIND_RULE_EVENODD) {
cairo_set_fill_rule(_cr, CAIRO_FILL_RULE_EVEN_ODD);
@@ -1312,7 +1294,7 @@ CairoRenderContext::renderPath(const_NRBPath const *bpath, SPStyle const *style,
if (!style->stroke.isNone()) {
_setStrokeStyle(style, pbox);
if (style->fill.isNone())
- setBpath(bpath->path);
+ setPathVector(pathv);
cairo_stroke(_cr);
}
@@ -1523,47 +1505,16 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Matrix const *font_ma
/* Helper functions */
void
-CairoRenderContext::addBpath(NArtBpath const *bp)
+CairoRenderContext::setPathVector(Geom::PathVector const &pv)
{
- 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);
- }
+ cairo_new_path(_cr);
+ addPathVector(pv);
}
void
-CairoRenderContext::setBpath(NArtBpath const *bp)
+CairoRenderContext::addPathVector(Geom::PathVector const &pv)
{
- cairo_new_path(_cr);
- if (bp)
- addBpath(bp);
+ feed_pathvector_to_cairo(_cr, pv);
}
void
diff --git a/src/extension/internal/cairo-render-context.h b/src/extension/internal/cairo-render-context.h
index fe76cb105861b0cb15e274cd653fd25c11e395f2..e9241808589f59ce02ccea967b4af3990be792f6 100644 (file)
void setClipMode(CairoClipMode mode);
CairoClipMode getClipMode(void) const;
- void addBpath(NArtBpath const *bp);
- void setBpath(NArtBpath const *bp);
+ void addPathVector(Geom::PathVector const &pv);
+ void setPathVector(Geom::PathVector const &pv);
void pushLayer(void);
void popLayer(void);
void getParentTransform(Geom::Matrix *copy) const;
/* Clipping methods */
- void addClipPath(NArtBpath const *bp, SPIEnum const *fill_rule);
+ void addClipPath(Geom::PathVector const &pv, SPIEnum const *fill_rule);
void addClippingRect(double x, double y, double width, double height);
/* Rendering methods */