summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-03-14 13:32:07 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-03-14 13:32:07 +0000
commitfd0ca31309d9fb4ffa8da11dee80f935ebc4c0fb (patch)
tree54686ce820bd72a2081aec10d9638946937ae824 /src/display
parentcommit Vinícius code (diff)
parentAdd a few font related tests. (diff)
downloadinkscape-fd0ca31309d9fb4ffa8da11dee80f935ebc4c0fb.tar.gz
inkscape-fd0ca31309d9fb4ffa8da11dee80f935ebc4c0fb.zip
update to trunk
(bzr r11950.1.295)
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/drawing-item.cpp30
-rw-r--r--src/display/drawing-item.h2
4 files changed, 28 insertions, 23 deletions
diff --git a/src/display/drawing-group.cpp b/src/display/drawing-group.cpp
index c03e0f3ba..38ace001f 100644
--- a/src/display/drawing-group.cpp
+++ b/src/display/drawing-group.cpp
@@ -22,7 +22,6 @@ DrawingGroup::DrawingGroup(Drawing &drawing)
: DrawingItem(drawing)
, _style(NULL)
, _child_transform(NULL)
- , _uses_antialiasing(true)
{}
DrawingGroup::~DrawingGroup()
@@ -48,15 +47,6 @@ 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
@@ -110,13 +100,6 @@ 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 c7f1c70ce..651e9d8af 100644
--- a/src/display/drawing-group.h
+++ b/src/display/drawing-group.h
@@ -30,7 +30,6 @@ 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,
@@ -43,7 +42,6 @@ protected:
SPStyle *_style;
Geom::Affine *_child_transform;
- bool _uses_antialiasing;
};
bool is_drawing_group(DrawingItem *item);
diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp
index 13e7b61eb..ccf905e81 100644
--- a/src/display/drawing-item.cpp
+++ b/src/display/drawing-item.cpp
@@ -127,6 +127,7 @@ DrawingItem::DrawingItem(Drawing &drawing)
, _propagate(0)
// , _renders_opacity(0)
, _pick_children(0)
+ , _antialias(1)
, _isolation(SP_CSS_ISOLATION_AUTO)
, _blend_mode(SP_CSS_BLEND_NORMAL)
{}
@@ -229,6 +230,8 @@ DrawingItem::prependChild(DrawingItem *item)
void
DrawingItem::clearChildren()
{
+ if (_children.empty()) return;
+
_markForRendering();
// prevent children from referencing the parent during deletion
// this way, children won't try to remove themselves from a list
@@ -266,8 +269,19 @@ DrawingItem::setTransform(Geom::Affine const &new_trans)
void
DrawingItem::setOpacity(float opacity)
{
- _opacity = opacity;
- _markForRendering();
+ if (_opacity != opacity) {
+ _opacity = opacity;
+ _markForRendering();
+ }
+}
+
+void
+DrawingItem::setAntialiasing(bool a)
+{
+ if (_antialias != a) {
+ _antialias = a;
+ _markForRendering();
+ }
}
void
@@ -289,8 +303,10 @@ DrawingItem::setBlendMode(unsigned blend_mode)
void
DrawingItem::setVisible(bool v)
{
- _visible = v;
- _markForRendering();
+ if (_visible != v) {
+ _visible = v;
+ _markForRendering();
+ }
}
/// This is currently unused
@@ -568,6 +584,12 @@ 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);
+ }
+
// render from cache if possible
if (_cached) {
if (_cache) {
diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h
index 913706021..db803cf60 100644
--- a/src/display/drawing-item.h
+++ b/src/display/drawing-item.h
@@ -108,6 +108,7 @@ public:
void setCached(bool c, bool persistent = false);
void setOpacity(float opacity);
+ void setAntialiasing(bool a);
void setIsolation(unsigned isolation); // CSS Compositing and Blending
void setBlendMode(unsigned blend_mode);
void setTransform(Geom::Affine const &trans);
@@ -205,6 +206,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 _isolation : 1;
unsigned _blend_mode : 4;