summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2014-03-13 04:45:38 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2014-03-13 04:45:38 +0000
commite7a3f5b74d1f5a95390ee95b06371d184c1812f7 (patch)
tree78f665a8013ebba1d57b3114744734730e4fa8b4 /src/display
parentRender zero-width PDF lines as 1px lines compensated for current transform. (diff)
downloadinkscape-e7a3f5b74d1f5a95390ee95b06371d184c1812f7.tar.gz
inkscape-e7a3f5b74d1f5a95390ee95b06371d184c1812f7.zip
Provide a toggle in the document properties to optionally turn off
antialiasing for display and export. Fixes a nearly 10 year old bug #170356 Fixed bugs: - https://launchpad.net/bugs/170356 (bzr r13144)
Diffstat (limited to 'src/display')
-rw-r--r--src/display/drawing-group.cpp17
-rw-r--r--src/display/drawing-group.h2
-rw-r--r--src/display/sp-canvas.cpp1
3 files changed, 19 insertions, 1 deletions
diff --git a/src/display/drawing-group.cpp b/src/display/drawing-group.cpp
index 38ace001f..c03e0f3ba 100644
--- a/src/display/drawing-group.cpp
+++ b/src/display/drawing-group.cpp
@@ -22,6 +22,7 @@ DrawingGroup::DrawingGroup(Drawing &drawing)
: DrawingItem(drawing)
, _style(NULL)
, _child_transform(NULL)
+ , _uses_antialiasing(true)
{}
DrawingGroup::~DrawingGroup()
@@ -47,6 +48,15 @@ DrawingGroup::setStyle(SPStyle *style)
_setStyleCommon(_style, style);
}
+void
+DrawingGroup::setAntialiasing(bool a)
+{
+ if (_uses_antialiasing != a) {
+ _uses_antialiasing = a;
+ _markForUpdate(STATE_ALL, true);
+ }
+}
+
/**
* Set additional transform for the group.
* This is applied after the normal transform and mainly useful for
@@ -100,6 +110,13 @@ DrawingGroup::_updateItem(Geom::IntRect const &area, UpdateContext const &ctx, u
unsigned
DrawingGroup::_renderItem(DrawingContext &dc, Geom::IntRect const &area, unsigned flags, DrawingItem *stop_at)
{
+ DrawingContext::Save aa_save;
+
+ if (!_uses_antialiasing) {
+ aa_save.save(dc);
+ cairo_set_antialias(dc.raw(), CAIRO_ANTIALIAS_NONE);
+ }
+
if (stop_at == NULL) {
// normal rendering
for (ChildrenList::iterator i = _children.begin(); i != _children.end(); ++i) {
diff --git a/src/display/drawing-group.h b/src/display/drawing-group.h
index 651e9d8af..c7f1c70ce 100644
--- a/src/display/drawing-group.h
+++ b/src/display/drawing-group.h
@@ -30,6 +30,7 @@ public:
void setStyle(SPStyle *style);
void setChildTransform(Geom::Affine const &new_trans);
+ void setAntialiasing(bool a);
protected:
virtual unsigned _updateItem(Geom::IntRect const &area, UpdateContext const &ctx,
@@ -42,6 +43,7 @@ protected:
SPStyle *_style;
Geom::Affine *_child_transform;
+ bool _uses_antialiasing;
};
bool is_drawing_group(DrawingItem *item);
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index c502daf64..6d903867b 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -35,7 +35,6 @@
#include "display/cairo-utils.h"
#include "debug/gdk-event-latency-tracker.h"
#include "desktop.h"
-#include "sp-namedview.h"
using Inkscape::Debug::GdkEventLatencyTracker;