summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2017-01-21 23:03:48 +0000
committerJabiertxof <jtx@jtx>2017-01-21 23:03:48 +0000
commit29a2125fbad631e51c4286adf831279a7779e693 (patch)
treecc2749bd7eaa82b6cc23aede773ba7cf9a5f7a3c /src/display
parentRelay LPE on widgets and optionaly write on text inputs (diff)
parentFix "swap fill and stroke" for multiple objects in selection (diff)
downloadinkscape-29a2125fbad631e51c4286adf831279a7779e693.tar.gz
inkscape-29a2125fbad631e51c4286adf831279a7779e693.zip
Update to trunk
(bzr r15356.1.14)
Diffstat (limited to 'src/display')
-rw-r--r--src/display/cairo-utils.cpp2
-rw-r--r--src/display/drawing-group.cpp3
-rw-r--r--src/display/drawing-item.cpp23
-rw-r--r--src/display/drawing-item.h4
-rw-r--r--src/display/drawing-text.cpp2
-rw-r--r--src/display/drawing.cpp6
-rw-r--r--src/display/drawing.h2
-rw-r--r--src/display/snap-indicator.cpp4
8 files changed, 32 insertions, 14 deletions
diff --git a/src/display/cairo-utils.cpp b/src/display/cairo-utils.cpp
index 01b0d807c..8045007e7 100644
--- a/src/display/cairo-utils.cpp
+++ b/src/display/cairo-utils.cpp
@@ -290,7 +290,7 @@ Pixbuf *Pixbuf::create_from_file(std::string const &fn)
if (!g_file_test(fn.c_str(), G_FILE_TEST_EXISTS)) {
return NULL;
}
- struct stat stdir;
+ GStatBuf stdir;
int val = g_stat(fn.c_str(), &stdir);
if (val == 0 && stdir.st_mode & S_IFDIR){
return NULL;
diff --git a/src/display/drawing-group.cpp b/src/display/drawing-group.cpp
index 1a9cbfdcc..018f23e74 100644
--- a/src/display/drawing-group.cpp
+++ b/src/display/drawing-group.cpp
@@ -95,6 +95,7 @@ DrawingGroup::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigne
if (stop_at == NULL) {
// normal rendering
for (ChildrenList::iterator i = _children.begin(); i != _children.end(); ++i) {
+ i->setAntialiasing(_antialias);
i->render(dc, area, flags, stop_at);
}
} else {
@@ -103,10 +104,12 @@ DrawingGroup::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigne
if (&*i == stop_at) return RENDER_OK; // do not render the stop_at item at all
if (i->isAncestorOf(stop_at)) {
// render its ancestors without masks, opacity or filters
+ i->setAntialiasing(_antialias);
i->render(dc, area, flags | RENDER_FILTER_BACKGROUND, stop_at);
// stop further rendering
return RENDER_OK;
} else {
+ i->setAntialiasing(_antialias);
i->render(dc, area, flags, stop_at);
}
}
diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp
index 89ca66dc4..c4af81efc 100644
--- a/src/display/drawing-item.cpp
+++ b/src/display/drawing-item.cpp
@@ -132,7 +132,7 @@ DrawingItem::DrawingItem(Drawing &drawing)
, _propagate(0)
// , _renders_opacity(0)
, _pick_children(0)
- , _antialias(1)
+ , _antialias(2)
, _isolation(SP_CSS_ISOLATION_AUTO)
, _mix_blend_mode(SP_CSS_BLEND_NORMAL)
{}
@@ -291,7 +291,7 @@ DrawingItem::setOpacity(float opacity)
}
void
-DrawingItem::setAntialiasing(bool a)
+DrawingItem::setAntialiasing(unsigned a)
{
if (_antialias != a) {
_antialias = a;
@@ -699,10 +699,21 @@ DrawingItem::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flag
Geom::OptIntRect carea = Geom::intersect(area, _drawbox);
if (!carea) return RENDER_OK;
- if (_antialias) {
- cairo_set_antialias(dc.raw(), CAIRO_ANTIALIAS_DEFAULT);
- } else {
- cairo_set_antialias(dc.raw(), CAIRO_ANTIALIAS_NONE);
+ switch(_antialias){
+ case 0:
+ cairo_set_antialias(dc.raw(), CAIRO_ANTIALIAS_NONE);
+ break;
+ case 1:
+ cairo_set_antialias(dc.raw(), CAIRO_ANTIALIAS_FAST);
+ break;
+ case 2:
+ cairo_set_antialias(dc.raw(), CAIRO_ANTIALIAS_GOOD);
+ break;
+ case 3:
+ cairo_set_antialias(dc.raw(), CAIRO_ANTIALIAS_BEST);
+ break;
+ default: // should not happen
+ g_assert_not_reached();
}
// render from cache if possible
diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h
index 3c593ceaa..21f6ffacc 100644
--- a/src/display/drawing-item.h
+++ b/src/display/drawing-item.h
@@ -115,7 +115,7 @@ public:
virtual void setStyle(SPStyle *style, SPStyle *context_style = NULL);
virtual void setChildrenStyle(SPStyle *context_style);
void setOpacity(float opacity);
- void setAntialiasing(bool a);
+ void setAntialiasing(unsigned a);
void setIsolation(unsigned isolation); // CSS Compositing and Blending
void setBlendMode(unsigned blend_mode);
void setTransform(Geom::Affine const &trans);
@@ -222,7 +222,7 @@ protected:
//unsigned _renders_opacity : 1; ///< Whether object needs temporary surface for opacity
unsigned _pick_children : 1; ///< For groups: if true, children are returned from pick(),
/// otherwise the group is returned
- unsigned _antialias : 1; ///< Whether to use antialiasing
+ unsigned _antialias : 2; ///< antialiasing level (NONE/FAST/GOOD(DEFAULT)/BEST)
unsigned _isolation : 1;
unsigned _mix_blend_mode : 4;
diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp
index 1280a2db9..21af7b200 100644
--- a/src/display/drawing-text.cpp
+++ b/src/display/drawing-text.cpp
@@ -599,7 +599,7 @@ unsigned DrawingText::_renderItem(DrawingContext &dc, Geom::IntRect const &/*are
}
{
Inkscape::DrawingContext::Save save(dc);
- if (!_style || ! _style->vector_effect.computed == SP_VECTOR_EFFECT_NON_SCALING_STROKE) {
+ if (!_style || !(_style->vector_effect.computed == SP_VECTOR_EFFECT_NON_SCALING_STROKE)) {
dc.transform(_ctm);
}
if (has_stroke) {
diff --git a/src/display/drawing.cpp b/src/display/drawing.cpp
index eadd7e528..71fb94be0 100644
--- a/src/display/drawing.cpp
+++ b/src/display/drawing.cpp
@@ -167,10 +167,14 @@ Drawing::update(Geom::IntRect const &area, UpdateContext const &ctx, unsigned fl
}
void
-Drawing::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flags)
+Drawing::render(DrawingContext &dc, Geom::IntRect const &area, unsigned flags, int antialiasing)
{
if (_root) {
+ int prev_a = _root->_antialias;
+ if(antialiasing >= 0)
+ _root->setAntialiasing(antialiasing);
_root->render(dc, area, flags);
+ _root->setAntialiasing(prev_a);
}
if (colorMode() == COLORMODE_GRAYSCALE) {
diff --git a/src/display/drawing.h b/src/display/drawing.h
index 0c12b1510..e472c8f5b 100644
--- a/src/display/drawing.h
+++ b/src/display/drawing.h
@@ -68,7 +68,7 @@ public:
void setGrayscaleMatrix(double value_matrix[20]);
void update(Geom::IntRect const &area = Geom::IntRect::infinite(), UpdateContext const &ctx = UpdateContext(), unsigned flags = DrawingItem::STATE_ALL, unsigned reset = 0);
- void render(DrawingContext &dc, Geom::IntRect const &area, unsigned flags = 0);
+ void render(DrawingContext &dc, Geom::IntRect const &area, unsigned flags = 0, int antialiasing = -1);
DrawingItem *pick(Geom::Point const &p, double delta, unsigned flags);
sigc::signal<void, DrawingItem *> signal_request_update;
diff --git a/src/display/snap-indicator.cpp b/src/display/snap-indicator.cpp
index 17deea16d..f2271e0c6 100644
--- a/src/display/snap-indicator.cpp
+++ b/src/display/snap-indicator.cpp
@@ -287,7 +287,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap
} else if (p.getSource() != SNAPSOURCE_UNDEFINED) {
tooltip_str = g_strdup(source_name);
}
- double fontsize = prefs->getInt("/tools/measure/fontsize");
+ double fontsize = prefs->getDouble("/tools/measure/fontsize", 10.0);
if (tooltip_str) {
Geom::Point tooltip_pos = p.getPoint();
@@ -327,7 +327,7 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap
SP_CTRLRECT(box)->setDashed(true);
SP_CTRLRECT(box)->pickable = false; // See the extensive comment above
sp_canvas_item_move_to_z(box, 0);
- _snaptarget_bbox = _desktop->add_temporary_canvasitem(box, timeout_val);
+ _snaptarget_bbox = _desktop->add_temporary_canvasitem(box, timeout_val*1000.0);
}
}
}