diff options
Diffstat (limited to 'src/display/canvas-bpath.cpp')
| -rw-r--r-- | src/display/canvas-bpath.cpp | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/src/display/canvas-bpath.cpp b/src/display/canvas-bpath.cpp index 725a1d0ff..f86743744 100644 --- a/src/display/canvas-bpath.cpp +++ b/src/display/canvas-bpath.cpp @@ -15,19 +15,17 @@ #endif #include <sstream> #include <string.h> -#include <desktop.h> +#include "desktop.h" #include "color.h" -#include "sp-canvas-util.h" -#include "inkscape-cairo.h" -#include "canvas-bpath.h" #include "display/sp-canvas-group.h" +#include "display/sp-canvas-util.h" +#include "display/canvas-bpath.h" +#include "display/display-forward.h" #include "display/curve.h" -#include "display/inkscape-cairo.h" -#include "libnr/nr-pixops.h" +#include "display/cairo-utils.h" #include "helper/geom.h" - void nr_pixblock_render_bpath_rgba (Shape* theS,uint32_t color,NRRectL &area,char* destBuf,int stride); static void sp_canvas_bpath_class_init (SPCanvasBPathClass *klass); @@ -139,8 +137,6 @@ sp_canvas_bpath_render (SPCanvasItem *item, SPCanvasBuf *buf) { SPCanvasBPath *cbp = SP_CANVAS_BPATH (item); - sp_canvas_prepare_buffer(buf); - Geom::Rect area (Geom::Point(buf->rect.x0, buf->rect.y0), Geom::Point(buf->rect.x1, buf->rect.y1)); if ( !cbp->curve || @@ -154,33 +150,29 @@ sp_canvas_bpath_render (SPCanvasItem *item, SPCanvasBuf *buf) bool dofill = ((cbp->fill_rgba & 0xff) != 0); bool dostroke = ((cbp->stroke_rgba & 0xff) != 0); - cairo_set_tolerance(buf->ct, 1.25); // low quality, but good enough for canvas items + cairo_set_tolerance(buf->ct, 0.5); cairo_new_path(buf->ct); - if (!dofill) - feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), cbp->affine, area, true, 1); - else - feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), cbp->affine, area, false, 1); + feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), cbp->affine, area, + /* optimized_stroke = */ !dofill, 1); if (dofill) { // RGB / BGR - cairo_set_source_rgba(buf->ct, SP_RGBA32_B_F(cbp->fill_rgba), SP_RGBA32_G_F(cbp->fill_rgba), SP_RGBA32_R_F(cbp->fill_rgba), SP_RGBA32_A_F(cbp->fill_rgba)); + ink_cairo_set_source_rgba32(buf->ct, cbp->fill_rgba); cairo_set_fill_rule(buf->ct, cbp->fill_rule == SP_WIND_RULE_EVENODD? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); - if (dostroke) - cairo_fill_preserve(buf->ct); - else - cairo_fill(buf->ct); + cairo_fill_preserve(buf->ct); } if (dostroke) { - // RGB / BGR - cairo_set_source_rgba(buf->ct, SP_RGBA32_B_F(cbp->stroke_rgba), SP_RGBA32_G_F(cbp->stroke_rgba), SP_RGBA32_R_F(cbp->stroke_rgba), SP_RGBA32_A_F(cbp->stroke_rgba)); + ink_cairo_set_source_rgba32(buf->ct, cbp->stroke_rgba); cairo_set_line_width(buf->ct, 1); if (cbp->dashes[0] != 0 && cbp->dashes[1] != 0) { cairo_set_dash (buf->ct, cbp->dashes, 2, 0); } cairo_stroke(buf->ct); + } else { + cairo_new_path(buf->ct); } } @@ -192,12 +184,12 @@ sp_canvas_bpath_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_ if ( !cbp->curve || ((cbp->stroke_rgba & 0xff) == 0 && (cbp->fill_rgba & 0xff) == 0 ) || cbp->curve->get_segment_count() < 1) - return NR_HUGE; + return Geom::infinity(); double width = 0.5; Geom::Rect viewbox = item->canvas->getViewbox(); viewbox.expandBy (width); - double dist = NR_HUGE; + double dist = Geom::infinity(); pathv_matrix_point_bbox_wind_distance(cbp->curve->get_pathvector(), cbp->affine, p, NULL, NULL, &dist, 0.5, &viewbox); if (dist <= 1.0) { |
