summaryrefslogtreecommitdiffstats
path: root/src/display/drawing-shape.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2011-08-14 07:08:30 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2011-08-14 07:08:30 +0000
commit01913a7cb9e1f9190fd3f9d2d047cbb88b9aa4ff (patch)
treeaf9e01438861e743a436e7ebbf17127c50de6d64 /src/display/drawing-shape.cpp
parentMore generic handling of child type in DrawingItem. (diff)
downloadinkscape-01913a7cb9e1f9190fd3f9d2d047cbb88b9aa4ff.tar.gz
inkscape-01913a7cb9e1f9190fd3f9d2d047cbb88b9aa4ff.zip
Correctly invalidate cache of objects with background-accessing filters
(bzr r10347.1.32)
Diffstat (limited to 'src/display/drawing-shape.cpp')
-rw-r--r--src/display/drawing-shape.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/display/drawing-shape.cpp b/src/display/drawing-shape.cpp
index b333b50f8..1b201927f 100644
--- a/src/display/drawing-shape.cpp
+++ b/src/display/drawing-shape.cpp
@@ -244,8 +244,9 @@ DrawingShape::_pickItem(Geom::Point const &p, double delta, unsigned flags)
if (!_style) return NULL;
bool outline = _drawing.outline();
+ bool pick_as_clip = flags & PICK_AS_CLIP;
- if (SP_SCALE24_TO_FLOAT(_style->opacity.value) == 0 && !outline)
+ if (SP_SCALE24_TO_FLOAT(_style->opacity.value) == 0 && !outline && !pick_as_clip)
// fully transparent, no pick unless outline mode
return NULL;
@@ -253,9 +254,14 @@ DrawingShape::_pickItem(Geom::Point const &p, double delta, unsigned flags)
g_get_current_time (&tstart);
double width;
- if (outline) {
- width = 0.5;
+ if (pick_as_clip) {
+ width = 0; // no width should be applied to clip picking
+ // this overrides display mode and stroke style considerations
+ } else if (outline) {
+ width = 0.5; // in outline mode, everything is stroked with the same 0.5px line width
} else if (_nrstyle.stroke.type != NRStyle::PAINT_NONE && _nrstyle.stroke.opacity > 1e-3) {
+ // for normal picking calculate the distance corresponding top the stroke width
+ // FIXME BUG: this is incorrect for transformed strokes
float const scale = _ctm.descrim();
width = std::max(0.125f, _nrstyle.stroke_width * scale) / 2;
} else {
@@ -264,10 +270,12 @@ DrawingShape::_pickItem(Geom::Point const &p, double delta, unsigned flags)
double dist = Geom::infinity();
int wind = 0;
- bool needfill = (flags & PICK_AS_CLIP) || (_nrstyle.fill.type != NRStyle::PAINT_NONE
- && _nrstyle.fill.opacity > 1e-3 && !outline);
- bool wind_evenodd = (flags & PICK_AS_CLIP) ? (_style->clip_rule.computed == SP_WIND_RULE_EVENODD) : (_style->fill_rule.computed == SP_WIND_RULE_EVENODD);
+ bool needfill = pick_as_clip || (_nrstyle.fill.type != NRStyle::PAINT_NONE &&
+ _nrstyle.fill.opacity > 1e-3 && !outline);
+ bool wind_evenodd = pick_as_clip ? (_style->clip_rule.computed == SP_WIND_RULE_EVENODD) :
+ (_style->fill_rule.computed == SP_WIND_RULE_EVENODD);
+ // actual shape picking
if (_drawing.arena()) {
Geom::Rect viewbox = _drawing.arena()->item.canvas->getViewbox();
viewbox.expandBy (width);