index 6974b000817f7dca8e0efeafa83d628d56e0a5c0..d5a098c391d91ef390ea47a3aa8d32f65a241311 100644 (file)
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-
-
+#include <2geom/svg-path.h>
+#include <2geom/svg-path-parser.h>
#include <display/canvas-arena.h>
#include <display/nr-arena.h>
#include <display/nr-arena-shape.h>
#include "display/curve.h"
-#include <libnr/n-art-bpath.h>
-#include <libnr/nr-path.h>
#include <libnr/nr-pixops.h>
-#include <libnr/nr-matrix-ops.h>
-#include <libnr/nr-matrix-fns.h>
#include <libnr/nr-blit.h>
#include <libnr/nr-convert2geom.h>
#include <2geom/pathvector.h>
#include <livarot/float-line.h>
#include <livarot/int-line.h>
#include <style.h>
-#include "prefs-utils.h"
#include "inkscape-cairo.h"
#include "helper/geom.h"
+#include "helper/geom-curves.h"
#include "sp-filter.h"
#include "sp-filter-reference.h"
#include "display/nr-filter.h"
#include <typeinfo>
#include <cairo.h>
+#include "preferences.h"
+#include "svg/svg-device-color.h"
+
+#include <glib.h>
+#include "svg/svg.h"
+#include <fenv.h>
//int showRuns=0;
void nr_pixblock_render_shape_mask_or(NRPixBlock &m,Shape* theS);
static guint nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, guint reset);
static unsigned int nr_arena_shape_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int flags);
static guint nr_arena_shape_clip(NRArenaItem *item, NRRectL *area, NRPixBlock *pb);
-static NRArenaItem *nr_arena_shape_pick(NRArenaItem *item, NR::Point p, double delta, unsigned int sticky);
+static NRArenaItem *nr_arena_shape_pick(NRArenaItem *item, Geom::Point p, double delta, unsigned int sticky);
static NRArenaItemClass *shape_parent_class;
shape->paintbox.x0 = shape->paintbox.y0 = 0.0F;
shape->paintbox.x1 = shape->paintbox.y1 = 256.0F;
- shape->ctm.set_identity();
+ shape->ctm.setIdentity();
shape->fill_painter = NULL;
shape->stroke_painter = NULL;
shape->cached_fill = NULL;
shape->approx_bbox.x0 = shape->approx_bbox.y0 = 0;
shape->approx_bbox.x1 = shape->approx_bbox.y1 = 0;
- shape->cached_fctm.set_identity();
- shape->cached_sctm.set_identity();
+ shape->cached_fctm.setIdentity();
+ shape->cached_sctm.setIdentity();
shape->markers = NULL;
@@ -227,7 +229,7 @@ nr_arena_shape_set_child_position(NRArenaItem *item, NRArenaItem *child, NRArena
void nr_arena_shape_update_stroke(NRArenaShape *shape, NRGC* gc, NRRectL *area);
void nr_arena_shape_update_fill(NRArenaShape *shape, NRGC *gc, NRRectL *area, bool force_shape = false);
-void nr_arena_shape_add_bboxes(NRArenaShape* shape, Geom::Rect &bbox);
+void nr_arena_shape_add_bboxes(NRArenaShape* shape, Geom::OptRect &bbox);
/**
* Updates the arena shape 'item' and all of its children, including the markers.
static guint
nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, guint reset)
{
- Geom::Rect boundingbox;
+ Geom::OptRect boundingbox;
NRArenaShape *shape = NR_ARENA_SHAPE(item);
@@ -252,11 +254,16 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g
shape->ctm = gc->transform;
if (state & NR_ARENA_ITEM_STATE_BBOX) {
if (shape->curve) {
- boundingbox = bounds_exact_transformed(shape->curve->get_pathvector(), to_2geom(gc->transform));
- item->bbox.x0 = (gint32)(boundingbox[0][0] - 1.0F);
- item->bbox.y0 = (gint32)(boundingbox[1][0] - 1.0F);
- item->bbox.x1 = (gint32)(boundingbox[0][1] + 1.9999F);
- item->bbox.y1 = (gint32)(boundingbox[1][1] + 1.9999F);
+ boundingbox = bounds_exact_transformed(shape->curve->get_pathvector(), gc->transform);
+ /// \todo just write item->bbox = boundingbox
+ if (boundingbox) {
+ item->bbox.x0 = (gint32)((*boundingbox)[0][0] - 1.0F);
+ item->bbox.y0 = (gint32)((*boundingbox)[1][0] - 1.0F);
+ item->bbox.x1 = (gint32)((*boundingbox)[0][1] + 1.9999F);
+ item->bbox.y1 = (gint32)((*boundingbox)[1][1] + 1.9999F);
+ } else {
+ item->bbox = NR_RECT_L_EMPTY;
+ }
}
if (beststate & NR_ARENA_ITEM_STATE_BBOX) {
for (NRArenaItem *child = shape->markers; child != NULL; child = child->next) {
@@ -269,43 +276,44 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g
shape->delayed_shp=true;
shape->ctm = gc->transform;
- boundingbox[0][0] = boundingbox[1][0] = NR_HUGE;
- boundingbox[0][1] = boundingbox[1][1] = -NR_HUGE;
+ boundingbox = Geom::OptRect();
bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == Inkscape::RENDERMODE_OUTLINE);
if (shape->curve) {
- boundingbox = bounds_exact_transformed(shape->curve->get_pathvector(), to_2geom(gc->transform));
+ boundingbox = bounds_exact_transformed(shape->curve->get_pathvector(), gc->transform);
- if (shape->_stroke.paint.type() != NRArenaShape::Paint::NONE || outline) {
+ if (boundingbox && (shape->_stroke.paint.type() != NRArenaShape::Paint::NONE || outline)) {
float width, scale;
- scale = NR::expansion(gc->transform);
+ scale = gc->transform.descrim();
width = MAX(0.125, shape->_stroke.width * scale);
if ( fabs(shape->_stroke.width * scale) > 0.01 ) { // sinon c'est 0=oon veut pas de bord
- boundingbox.expandBy(width);
+ boundingbox->expandBy(width);
}
// those pesky miters, now
float miterMax=width*shape->_stroke.mitre_limit;
if ( miterMax > 0.01 ) {
// grunt mode. we should compute the various miters instead (one for each point on the curve)
- boundingbox.expandBy(miterMax);
+ boundingbox->expandBy(miterMax);
}
}
+ }
+
+ /// \todo just write item->bbox = boundingbox
+ if (boundingbox) {
+ shape->approx_bbox.x0 = (gint32)((*boundingbox)[0][0] - 1.0F);
+ shape->approx_bbox.y0 = (gint32)((*boundingbox)[1][0] - 1.0F);
+ shape->approx_bbox.x1 = (gint32)((*boundingbox)[0][1] + 1.9999F);
+ shape->approx_bbox.y1 = (gint32)((*boundingbox)[1][1] + 1.9999F);
} else {
+ shape->approx_bbox = NR_RECT_L_EMPTY;
}
- shape->approx_bbox.x0 = (gint32)(boundingbox[0][0] - 1.0F);
- shape->approx_bbox.y0 = (gint32)(boundingbox[1][0] - 1.0F);
- shape->approx_bbox.x1 = (gint32)(boundingbox[0][1] + 1.9999F);
- shape->approx_bbox.y1 = (gint32)(boundingbox[1][1] + 1.9999F);
- if ( area && nr_rect_l_test_intersect(area, &shape->approx_bbox) ) shape->delayed_shp=false;
+ if ( area && nr_rect_l_test_intersect_ptr(area, &shape->approx_bbox) ) shape->delayed_shp=false;
/* Release state data */
- if (TRUE || !NR::transform_equalp(gc->transform, shape->ctm, NR_EPSILON)) {
- /* Concept test */
- if (shape->fill_shp) {
- delete shape->fill_shp;
- shape->fill_shp = NULL;
- }
+ if (shape->fill_shp) {
+ delete shape->fill_shp;
+ shape->fill_shp = NULL;
}
if (shape->stroke_shp) {
delete shape->stroke_shp;
@@ -337,23 +345,28 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g
nr_arena_shape_update_stroke(shape, gc, area);
nr_arena_shape_update_fill(shape, gc, area);
- boundingbox[0][0] = boundingbox[0][1] = boundingbox[1][0] = boundingbox[1][1] = 0.0;
+ boundingbox = Geom::OptRect();
nr_arena_shape_add_bboxes(shape, boundingbox);
- shape->approx_bbox.x0 = (gint32)(boundingbox[0][0] - 1.0F);
- shape->approx_bbox.y0 = (gint32)(boundingbox[1][0] - 1.0F);
- shape->approx_bbox.x1 = (gint32)(boundingbox[0][1] + 1.9999F);
- shape->approx_bbox.y1 = (gint32)(boundingbox[1][1] + 1.9999F);
+ /// \todo just write shape->approx_bbox = boundingbox
+ if (boundingbox) {
+ shape->approx_bbox.x0 = (gint32)((*boundingbox)[0][0] - 1.0F);
+ shape->approx_bbox.y0 = (gint32)((*boundingbox)[1][0] - 1.0F);
+ shape->approx_bbox.x1 = (gint32)((*boundingbox)[0][1] + 1.9999F);
+ shape->approx_bbox.y1 = (gint32)((*boundingbox)[1][1] + 1.9999F);
+ } else {
+ shape->approx_bbox = NR_RECT_L_EMPTY;
+ }
}
- if (boundingbox.isEmpty())
+ if (!boundingbox)
return NR_ARENA_ITEM_STATE_ALL;
- item->bbox.x0 = (gint32)(boundingbox[0][0] - 1.0F);
- item->bbox.y0 = (gint32)(boundingbox[1][0] - 1.0F);
- item->bbox.x1 = (gint32)(boundingbox[0][1] + 1.0F);
- item->bbox.y1 = (gint32)(boundingbox[1][1] + 1.0F);
- nr_arena_request_render_rect(item->arena, &item->bbox);
+ /// \todo just write item->bbox = boundingbox
+ item->bbox.x0 = (gint32)((*boundingbox)[0][0] - 1.0F);
+ item->bbox.y0 = (gint32)((*boundingbox)[1][0] - 1.0F);
+ item->bbox.x1 = (gint32)((*boundingbox)[0][1] + 1.0F);
+ item->bbox.y1 = (gint32)((*boundingbox)[1][1] + 1.0F);
item->render_opacity = TRUE;
if ( shape->_fill.paint.type() == NRArenaShape::Paint::SERVER ) {
@@ -390,8 +403,8 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g
return NR_ARENA_ITEM_STATE_ALL;
}
-int matrix_is_isometry(NR::Matrix p) {
- NR::Matrix tp;
+int matrix_is_isometry(Geom::Matrix p) {
+ Geom::Matrix tp;
// transposition
tp[0]=p[0];
tp[1]=p[2];
tp[3]=p[3];
for (int i = 4; i < 6; i++) // shut valgrind up :)
tp[i] = p[i] = 0;
- NR::Matrix isom = tp*p; // A^T * A = adjunct?
+ Geom::Matrix isom = tp*p; // A^T * A = adjunct?
// Is the adjunct nearly an identity function?
- if (isom.is_translation(0.01)) {
+ if (isom.isTranslation(0.01)) {
// the transformation is an isometry -> no need to recompute
// the uncrossed polygon
if ( p.det() < 0 )
if ( (pv.size() == 1) && (pv.front().size() <= 1) ) {
// vector has only one path with only one segment, see if that's a non-curve segment: that would mean no internal region
- Geom::Curve const & c = pv.front().front();
- if ( typeid(c) == typeid(Geom::LineSegment) )
- return false;
- if ( typeid(c) == typeid(Geom::HLineSegment) )
- return false;
- if ( typeid(c) == typeid(Geom::VLineSegment) )
+ if ( is_straight_curve(pv.front().front()) )
+ {
return false;
+ }
}
return true; //too costly to see if it has region to be filled, so return true.
nr_arena_shape_update_fill(NRArenaShape *shape, NRGC *gc, NRRectL *area, bool force_shape)
{
if ((shape->_fill.paint.type() != NRArenaShape::Paint::NONE || force_shape) &&
-// ((shape->curve->get_length() > 2) || (SP_CURVE_BPATH(shape->curve)[1].code == NR_CURVETO)) ) { // <-- this used to be the old code, i think it has to determine that the path has a sort of 'internal region' where fill would occur
has_inner_area(shape->curve->get_pathvector()) ) {
- if (TRUE || !shape->fill_shp) {
- NR::Matrix cached_to_new = NR::identity();
+
+ Geom::Matrix cached_to_new = Geom::identity();
int isometry = 0;
if ( shape->cached_fill ) {
if (shape->cached_fctm == gc->transform) {
@@ -465,7 +474,7 @@ nr_arena_shape_update_fill(NRArenaShape *shape, NRGC *gc, NRRectL *area, bool fo
Path* thePath=new Path;
Shape* theShape=new Shape;
{
- Geom::Matrix tempMat(to_2geom(gc->transform));
+ Geom::Matrix tempMat(gc->transform);
thePath->LoadPathVector(shape->curve->get_pathvector(), tempMat, true);
}
@@ -508,7 +517,7 @@ nr_arena_shape_update_fill(NRArenaShape *shape, NRGC *gc, NRRectL *area, bool fo
shape->fill_shp->Reset(shape->cached_fill->numberOfPoints(),
shape->cached_fill->numberOfEdges());
for (int i = 0; i < shape->cached_fill->numberOfPoints(); i++)
- shape->fill_shp->AddPoint(shape->cached_fill->getPoint(i).x * cached_to_new);
+ shape->fill_shp->AddPoint(to_2geom(shape->cached_fill->getPoint(i).x) * cached_to_new);
if ( isometry == 1 ) {
for (int i = 0; i < shape->cached_fill->numberOfEdges(); i++)
shape->fill_shp->AddEdge(shape->cached_fill->getEdge(i).st,
@@ -523,7 +532,6 @@ nr_arena_shape_update_fill(NRArenaShape *shape, NRGC *gc, NRRectL *area, bool fo
shape->fill_shp->needEdgesSorting();
}
shape->delayed_shp |= shape->cached_fpartialy;
- }
}
}
{
SPStyle* style = shape->style;
- float const scale = NR::expansion(gc->transform);
+ float const scale = gc->transform.descrim();
bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == Inkscape::RENDERMODE_OUTLINE);
width = style_width;
}
- NR::Matrix cached_to_new = NR::identity();
+ Geom::Matrix cached_to_new = Geom::identity();
int isometry = 0;
if ( shape->cached_stroke ) {
Path* thePath = new Path;
Shape* theShape = new Shape;
{
- Geom::Matrix tempMat( to_2geom(gc->transform) );
+ Geom::Matrix tempMat( gc->transform );
thePath->LoadPathVector(shape->curve->get_pathvector(), tempMat, true);
}
shape->stroke_shp=new Shape;
shape->stroke_shp->Reset(shape->cached_stroke->numberOfPoints(), shape->cached_stroke->numberOfEdges());
for (int i = 0; i < shape->cached_stroke->numberOfPoints(); i++)
- shape->stroke_shp->AddPoint(shape->cached_stroke->getPoint(i).x * cached_to_new);
+ shape->stroke_shp->AddPoint(to_2geom(shape->cached_stroke->getPoint(i).x) * cached_to_new);
if ( isometry == 1 ) {
for (int i = 0; i < shape->cached_stroke->numberOfEdges(); i++)
shape->stroke_shp->AddEdge(shape->cached_stroke->getEdge(i).st,
void
-nr_arena_shape_add_bboxes(NRArenaShape* shape, Geom::Rect &bbox)
+nr_arena_shape_add_bboxes(NRArenaShape* shape, Geom::OptRect &bbox)
{
/* TODO: are these two if's mutually exclusive? ( i.e. "shape->stroke_shp <=> !shape->fill_shp" )
* if so, then this can be written much more compact ! */
// cairo outline rendering:
static unsigned int
-cairo_arena_shape_render_outline(cairo_t *ct, NRArenaItem *item, NR::Maybe<NR::Rect> area)
+cairo_arena_shape_render_outline(cairo_t *ct, NRArenaItem *item, Geom::OptRect area)
{
NRArenaShape *shape = NR_ARENA_SHAPE(item);
@@ -732,7 +740,7 @@ cairo_arena_shape_render_outline(cairo_t *ct, NRArenaItem *item, NR::Maybe<NR::R
cairo_set_tolerance(ct, 1.25); // low quality, but good enough for outline mode
cairo_new_path(ct);
- feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), to_2geom(shape->ctm), area, true, 0);
+ feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), shape->ctm, area, true, 0);
cairo_stroke(ct);
@@ -748,7 +756,7 @@ cairo_arena_shape_render_stroke(NRArenaItem *item, NRRectL *area, NRPixBlock *pb
NRArenaShape *shape = NR_ARENA_SHAPE(item);
SPStyle const *style = shape->style;
- float const scale = NR::expansion(shape->ctm);
+ float const scale = shape->ctm.descrim();
if (fabs(shape->_stroke.width * scale) < 0.01)
return;
@@ -813,7 +821,7 @@ cairo_arena_shape_render_stroke(NRArenaItem *item, NRRectL *area, NRPixBlock *pb
cairo_set_tolerance(ct, 0.1);
cairo_new_path(ct);
- feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), to_2geom(shape->ctm), area->upgrade(), true, style_width);
+ feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), shape->ctm, to_2geom(area->upgrade()), true, style_width);
cairo_stroke(ct);
@@ -838,17 +846,18 @@ nr_arena_shape_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock
if (!shape->style) return item->state;
bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == Inkscape::RENDERMODE_OUTLINE);
+ bool print_colors = (NR_ARENA_ITEM(shape)->arena->rendermode == Inkscape::RENDERMODE_PRINT_COLORS_PREVIEW);
if (outline) { // cairo outline rendering
pb->empty = FALSE;
- unsigned int ret = cairo_arena_shape_render_outline (ct, item, (&pb->area)->upgrade());
+ unsigned int ret = cairo_arena_shape_render_outline (ct, item, to_2geom((&pb->area)->upgrade()));
if (ret & NR_ARENA_ITEM_STATE_INVALID) return ret;
} else {
if ( shape->delayed_shp ) {
- if ( nr_rect_l_test_intersect(area, &item->bbox) ) {
+ if ( nr_rect_l_test_intersect_ptr(area, &item->bbox) ) {
NRGC tempGC(NULL);
tempGC.transform=shape->ctm;
shape->delayed_shp = false;
@@ -867,7 +876,22 @@ nr_arena_shape_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock
}
}
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+
SPStyle const *style = shape->style;
+ bool render_cyan = prefs->getBool("/options/printcolorspreview/cyan", true);
+ bool render_magenta = prefs->getBool("/options/printcolorspreview/magenta", true);
+ bool render_yellow = prefs->getBool("/options/printcolorspreview/yellow", true);
+ bool render_black = prefs->getBool("/options/printcolorspreview/black", true);
+
+ float rgb_v[3];
+ float cmyk_v[4];
+#define FLOAT_TO_UINT8(f) (int(f*255))
+#define RGBA_R(v) ((v) >> 24)
+#define RGBA_G(v) (((v) >> 16) & 0xff)
+#define RGBA_B(v) (((v) >> 8) & 0xff)
+#define RGBA_A(v) ((v) & 0xff)
+
if (shape->fill_shp) {
NRPixBlock m;
guint32 rgba;
@@ -887,12 +911,24 @@ nr_arena_shape_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock
if (shape->_fill.paint.type() == NRArenaShape::Paint::NONE) {
// do not render fill in any way
} else if (shape->_fill.paint.type() == NRArenaShape::Paint::COLOR) {
+
+ const SPColor* fill_color = &shape->_fill.paint.color();
if ( item->render_opacity ) {
- rgba = shape->_fill.paint.color().toRGBA32( shape->_fill.opacity *
- SP_SCALE24_TO_FLOAT(style->opacity.value) );
+ rgba = fill_color->toRGBA32( shape->_fill.opacity *
+ SP_SCALE24_TO_FLOAT(style->opacity.value) );
} else {
- rgba = shape->_fill.paint.color().toRGBA32( shape->_fill.opacity );
+ rgba = fill_color->toRGBA32( shape->_fill.opacity );
+ }
+
+ if (print_colors){
+ sp_color_rgb_to_cmyk_floatv (cmyk_v, RGBA_R(rgba)/256.0, RGBA_G(rgba)/256.0, RGBA_B(rgba)/256.0);
+ sp_color_cmyk_to_rgb_floatv (rgb_v, render_cyan ? cmyk_v[0] : 0,
+ render_magenta ? cmyk_v[1] : 0,
+ render_yellow ? cmyk_v[2] : 0,
+ render_black ? cmyk_v[3] : 0);
+ rgba = (FLOAT_TO_UINT8(rgb_v[0])<<24) + (FLOAT_TO_UINT8(rgb_v[1])<<16) + (FLOAT_TO_UINT8(rgb_v[2])<<8) + 0xff;
}
+
nr_blit_pixblock_mask_rgba32(pb, &m, rgba);
pb->empty = FALSE;
} else if (shape->_fill.paint.type() == NRArenaShape::Paint::SERVER) {
@@ -923,14 +959,25 @@ nr_arena_shape_render(cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock
nr_pixblock_render_shape_mask_or(m, shape->stroke_shp);
m.empty = FALSE;
- if ( item->render_opacity ) {
- rgba = shape->_stroke.paint.color().toRGBA32( shape->_stroke.opacity *
- SP_SCALE24_TO_FLOAT(style->opacity.value) );
- } else {
- rgba = shape->_stroke.paint.color().toRGBA32( shape->_stroke.opacity );
- }
- nr_blit_pixblock_mask_rgba32(pb, &m, rgba);
- pb->empty = FALSE;
+ const SPColor* stroke_color = &shape->_stroke.paint.color();
+ if ( item->render_opacity ) {
+ rgba = stroke_color->toRGBA32( shape->_stroke.opacity *
+ SP_SCALE24_TO_FLOAT(style->opacity.value) );
+ } else {
+ rgba = stroke_color->toRGBA32( shape->_stroke.opacity );
+ }
+
+ if (print_colors){
+ sp_color_rgb_to_cmyk_floatv (cmyk_v, RGBA_R(rgba)/256.0, RGBA_G(rgba)/256.0, RGBA_B(rgba)/256.0);
+ sp_color_cmyk_to_rgb_floatv (rgb_v, render_cyan ? cmyk_v[0] : 0,
+ render_magenta ? cmyk_v[1] : 0,
+ render_yellow ? cmyk_v[2] : 0,
+ render_black ? cmyk_v[3] : 0);
+ rgba = (FLOAT_TO_UINT8(rgb_v[0])<<24) + (FLOAT_TO_UINT8(rgb_v[1])<<16) + (FLOAT_TO_UINT8(rgb_v[2])<<8) + 0xff;
+ }
+
+ nr_blit_pixblock_mask_rgba32(pb, &m, rgba);
+ pb->empty = FALSE;
nr_pixblock_release(&m);
cairo_new_path(ct);
- feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), to_2geom(shape->ctm), (area)->upgrade(), false, 0);
+ feed_pathvector_to_cairo (ct, shape->curve->get_pathvector(), shape->ctm, (area)->upgrade(), false, 0);
cairo_fill(ct);
if (!shape->curve) return item->state;
if ( shape->delayed_shp || shape->fill_shp == NULL) { // we need a fill shape no matter what
- if ( nr_rect_l_test_intersect(area, &item->bbox) ) {
+ if ( nr_rect_l_test_intersect_ptr(area, &item->bbox) ) {
NRGC tempGC(NULL);
tempGC.transform=shape->ctm;
shape->delayed_shp = false;
}
static NRArenaItem *
-nr_arena_shape_pick(NRArenaItem *item, NR::Point p, double delta, unsigned int /*sticky*/)
+nr_arena_shape_pick(NRArenaItem *item, Geom::Point p, double delta, unsigned int /*sticky*/)
{
NRArenaShape *shape = NR_ARENA_SHAPE(item);
@@ -1082,7 +1129,7 @@ nr_arena_shape_pick(NRArenaItem *item, NR::Point p, double delta, unsigned int /
if (outline) {
width = 0.5;
} else if (shape->_stroke.paint.type() != NRArenaShape::Paint::NONE && shape->_stroke.opacity > 1e-3) {
- float const scale = NR::expansion(shape->ctm);
+ float const scale = shape->ctm.descrim();
width = MAX(0.125, shape->_stroke.width * scale) / 2;
} else {
width = 0;
@@ -1094,11 +1141,11 @@ nr_arena_shape_pick(NRArenaItem *item, NR::Point p, double delta, unsigned int /
&& shape->_fill.opacity > 1e-3 && !outline);
if (item->arena->canvasarena) {
- Geom::Rect viewbox = to_2geom(item->arena->canvasarena->item.canvas->getViewbox());
+ Geom::Rect viewbox = item->arena->canvasarena->item.canvas->getViewbox();
viewbox.expandBy (width);
- pathv_matrix_point_bbox_wind_distance(shape->curve->get_pathvector(), to_2geom(shape->ctm), to_2geom(p), NULL, needfill? &wind : NULL, &dist, 0.5, &viewbox);
+ pathv_matrix_point_bbox_wind_distance(shape->curve->get_pathvector(), shape->ctm, p, NULL, needfill? &wind : NULL, &dist, 0.5, &viewbox);
} else {
- pathv_matrix_point_bbox_wind_distance(shape->curve->get_pathvector(), to_2geom(shape->ctm), to_2geom(p), NULL, needfill? &wind : NULL, &dist, 0.5, NULL);
+ pathv_matrix_point_bbox_wind_distance(shape->curve->get_pathvector(), shape->ctm, p, NULL, needfill? &wind : NULL, &dist, 0.5, NULL);
}
g_get_current_time (&tfinish);
if (style->filter.set && style->getFilter()) {
if (!shape->filter) {
int primitives = sp_filter_primitive_count(SP_FILTER(style->getFilter()));
- shape->filter = new NR::Filter(primitives);
+ shape->filter = new Inkscape::Filters::Filter(primitives);
}
sp_filter_build_renderer(SP_FILTER(style->getFilter()), shape->filter);
} else {
nr_arena_item_request_update(shape, NR_ARENA_ITEM_STATE_ALL, FALSE);
}
-void NRArenaShape::setPaintBox(NR::Rect const &pbox)
+void NRArenaShape::setPaintBox(Geom::Rect const &pbox)
{
- paintbox.x0 = pbox.min()[NR::X];
- paintbox.y0 = pbox.min()[NR::Y];
- paintbox.x1 = pbox.max()[NR::X];
- paintbox.y1 = pbox.max()[NR::Y];
+ paintbox.x0 = pbox.min()[Geom::X];
+ paintbox.y0 = pbox.min()[Geom::Y];
+ paintbox.x1 = pbox.max()[Geom::X];
+ paintbox.y1 = pbox.max()[Geom::Y];
nr_arena_item_request_update(this, NR_ARENA_ITEM_STATE_ALL, FALSE);
}