diff options
| -rw-r--r-- | src/attributes.cpp | 1 | ||||
| -rw-r--r-- | src/attributes.h | 1 | ||||
| -rw-r--r-- | src/desktop.cpp | 2 | ||||
| -rw-r--r-- | src/display/drawing-group.cpp | 17 | ||||
| -rw-r--r-- | src/display/drawing-group.h | 2 | ||||
| -rw-r--r-- | src/display/drawing-item.cpp | 30 | ||||
| -rw-r--r-- | src/display/drawing-item.h | 2 | ||||
| -rw-r--r-- | src/sp-item.cpp | 1 | ||||
| -rw-r--r-- | src/sp-namedview.cpp | 6 | ||||
| -rw-r--r-- | src/sp-namedview.h | 1 | ||||
| -rw-r--r-- | src/sp-root.cpp | 10 | ||||
| -rw-r--r-- | src/sp-root.h | 2 | ||||
| -rw-r--r-- | src/style.cpp | 10 | ||||
| -rw-r--r-- | src/ui/dialog/document-properties.cpp | 8 | ||||
| -rw-r--r-- | src/ui/widget/registered-widget.cpp | 6 | ||||
| -rw-r--r-- | src/ui/widget/registered-widget.h | 8 |
16 files changed, 55 insertions, 52 deletions
diff --git a/src/attributes.cpp b/src/attributes.cpp index 1c62ea841..ee2a80fd3 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -117,7 +117,6 @@ static SPStyleProp const props[] = { {SP_ATTR_INKSCAPE_DOCUMENT_UNITS, "inkscape:document-units"}, {SP_ATTR_UNITS, "units"}, {SP_ATTR_INKSCAPE_CONNECTOR_SPACING, "inkscape:connector-spacing"}, - {SP_ATTR_INKSCAPE_ANTIALIASING, "inkscape:antialiasing"}, /* SPColorProfile */ {SP_ATTR_LOCAL, "local"}, {SP_ATTR_NAME, "name"}, diff --git a/src/attributes.h b/src/attributes.h index 530c9d11a..b8843fcb7 100644 --- a/src/attributes.h +++ b/src/attributes.h @@ -118,7 +118,6 @@ enum SPAttributeEnum { SP_ATTR_INKSCAPE_DOCUMENT_UNITS, SP_ATTR_UNITS, SP_ATTR_INKSCAPE_CONNECTOR_SPACING, - SP_ATTR_INKSCAPE_ANTIALIASING, /* SPColorProfile */ SP_ATTR_LOCAL, SP_ATTR_NAME, diff --git a/src/desktop.cpp b/src/desktop.cpp index 234831e69..a02baeac8 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -1736,8 +1736,6 @@ static void _namedview_modified (SPObject *obj, guint flags, SPDesktop *desktop) if (flags & SP_OBJECT_MODIFIED_FLAG) { - desktop->getDocument()->getRoot()->setAntialiasing(nv->antialiasing); - /* Show/hide page background */ if (nv->pagecolor | (0xff != 0xffffffff)) { sp_canvas_item_show (desktop->table); 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; diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 9c8b28559..b10aae1c6 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -599,6 +599,7 @@ void SPItem::update(SPCtx* /*ctx*/, guint flags) { if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = item->display; v != NULL; v = v->next) { v->arenaitem->setOpacity(SP_SCALE24_TO_FLOAT(object->style->opacity.value)); + v->arenaitem->setAntialiasing(object->style->shape_rendering.computed != SP_CSS_SHAPE_RENDERING_CRISPEDGES); v->arenaitem->setIsolation( object->style->isolation.value ); v->arenaitem->setBlendMode( object->style->blend_mode.value ); v->arenaitem->setVisible(!item->isHidden()); diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 03c124117..a01ba891e 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -90,7 +90,6 @@ SPNamedView::SPNamedView() : SPObjectGroup(), snap_manager(this) { this->grids_visible = false; this->showborder = TRUE; this->showpageshadow = TRUE; - this->antialiasing = TRUE; this->guides = NULL; this->viewcount = 0; @@ -249,7 +248,6 @@ void SPNamedView::build(SPDocument *document, Inkscape::XML::Node *repr) { this->readAttr( "inkscape:snap-page" ); this->readAttr( "inkscape:current-layer" ); this->readAttr( "inkscape:connector-spacing" ); - this->readAttr( "inkscape:antialiasing" ); /* Construct guideline list */ for (SPObject *o = this->firstChild() ; o; o = o->getNext() ) { @@ -605,10 +603,6 @@ void SPNamedView::set(unsigned int key, const gchar* value) { this->requestModified(SP_OBJECT_MODIFIED_FLAG); break; } - case SP_ATTR_INKSCAPE_ANTIALIASING: - this->antialiasing = value ? sp_str_to_bool(value) : TRUE; - this->requestModified(SP_OBJECT_MODIFIED_FLAG); - break; default: SPObjectGroup::set(key, value); break; diff --git a/src/sp-namedview.h b/src/sp-namedview.h index b6e32206e..05cbcc398 100644 --- a/src/sp-namedview.h +++ b/src/sp-namedview.h @@ -44,7 +44,6 @@ public: unsigned int showborder : 1; unsigned int showpageshadow : 1; unsigned int borderlayer : 2; - unsigned int antialiasing : 1; double zoom; double cx; diff --git a/src/sp-root.cpp b/src/sp-root.cpp index 12ac1bad4..12570e03e 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -25,7 +25,6 @@ #include "document.h" #include "inkscape-version.h" #include "sp-defs.h" -#include "sp-namedview.h" #include "sp-root.h" #include "display/drawing-group.h" #include "svg/stringstream.h" @@ -308,7 +307,6 @@ void SPRoot::update(SPCtx *ctx, guint flags) for (SPItemView *v = this->display; v != NULL; v = v->next) { Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); g->setChildTransform(this->c2p); - g->setAntialiasing(sp_document_namedview(this->document, NULL)->antialiasing); } } @@ -375,7 +373,6 @@ Inkscape::DrawingItem *SPRoot::show(Inkscape::Drawing &drawing, unsigned int key if (ai) { Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(ai); g->setChildTransform(this->c2p); - g->setAntialiasing(sp_document_namedview(this->document, NULL)->antialiasing); } return ai; @@ -394,13 +391,6 @@ const char *SPRoot::displayName() const { return "SVG"; // Do not translate } -void SPRoot::setAntialiasing(bool s) { - for (SPItemView *v = this->display; v != NULL; v = v->next) { - Inkscape::DrawingGroup *g = dynamic_cast<Inkscape::DrawingGroup *>(v->arenaitem); - g->setAntialiasing(s); - } -} - /* Local Variables: mode:c++ diff --git a/src/sp-root.h b/src/sp-root.h index a1954c42f..a25e8030c 100644 --- a/src/sp-root.h +++ b/src/sp-root.h @@ -50,8 +50,6 @@ public: */ SPDefs *defs; - void setAntialiasing(bool a); - virtual void build(SPDocument *document, Inkscape::XML::Node *repr); virtual void release(); virtual void set(unsigned int key, gchar const* value); diff --git a/src/style.cpp b/src/style.cpp index de5b23854..132972164 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -1936,7 +1936,15 @@ sp_style_merge_from_parent(SPStyle *const style, SPStyle const *const parent) if (!style->color_rendering.set || style->color_rendering.inherit) { style->color_rendering.computed = parent->color_rendering.computed; } - + if (!style->image_rendering.set || style->image_rendering.inherit) { + style->image_rendering.computed = parent->image_rendering.computed; + } + if (!style->shape_rendering.set || style->shape_rendering.inherit) { + style->shape_rendering.computed = parent->shape_rendering.computed; + } + if (!style->text_rendering.set || style->text_rendering.inherit) { + style->text_rendering.computed = parent->text_rendering.computed; + } } template <typename T> diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index ef7c9ee1d..a31ab1a09 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -35,6 +35,7 @@ #include "sp-namedview.h" #include "sp-root.h" #include "sp-script.h" +#include "style.h" #include "svg/stringstream.h" #include "tools-switch.h" #include "ui/widget/color-picker.h" @@ -106,7 +107,7 @@ DocumentProperties::DocumentProperties() _page_metadata1(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), _page_metadata2(Gtk::manage(new UI::Widget::NotebookPage(1, 1))), //--------------------------------------------------------------- - _rcb_antialias(_("Use antialiasing"), _("If unset, no antialiasing will be done on the drawing"), "inkscape:antialiasing", _wr, false), + _rcb_antialias(_("Use antialiasing"), _("If unset, no antialiasing will be done on the drawing"), "shape-rendering", _wr, false, NULL, NULL, NULL, "crispEdges"), _rcb_canb(_("Show page _border"), _("If set, rectangular page border is shown"), "showborder", _wr, false), _rcb_bord(_("Border on _top of drawing"), _("If set, border is always on top of the drawing"), "borderlayer", _wr, false), _rcb_shad(_("_Show border shadow"), _("If set, page border shows a shadow on its right and lower side"), "inkscape:showpageshadow", _wr, false), @@ -1474,7 +1475,10 @@ void DocumentProperties::update() _rcb_bord.setActive (nv->borderlayer == SP_BORDER_LAYER_TOP); _rcp_bord.setRgba32 (nv->bordercolor); _rcb_shad.setActive (nv->showpageshadow); - _rcb_antialias.setActive(nv->antialiasing); + + SPRoot *root = dt->getDocument()->getRoot(); + _rcb_antialias.set_xml_target(root->getRepr(), dt->getDocument()); + _rcb_antialias.setActive(root->style->shape_rendering.computed != SP_CSS_SHAPE_RENDERING_CRISPEDGES); if (nv->doc_units) { _rum_deflt.setUnit (nv->doc_units->abbr); diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index ae6a7d1e0..175f6471c 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -49,8 +49,10 @@ RegisteredCheckButton::~RegisteredCheckButton() _toggled_connection.disconnect(); } -RegisteredCheckButton::RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in) +RegisteredCheckButton::RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right, Inkscape::XML::Node* repr_in, SPDocument *doc_in, char const *active_str, char const *inactive_str) : RegisteredWidget<Gtk::CheckButton>() + , _active_str(active_str) + , _inactive_str(inactive_str) { init_parent(key, wr, repr_in, doc_in); @@ -88,7 +90,7 @@ RegisteredCheckButton::on_toggled() return; _wr->setUpdating (true); - write_to_xml(get_active() ? "true" : "false"); + write_to_xml(get_active() ? _active_str : _inactive_str); //The slave button is greyed out if the master button is unchecked for (std::list<Gtk::Widget*>::const_iterator i = _slavewidgets.begin(); i != _slavewidgets.end(); ++i) { (*i)->set_sensitive(get_active()); diff --git a/src/ui/widget/registered-widget.h b/src/ui/widget/registered-widget.h index 883a9e1a2..d64c09c16 100644 --- a/src/ui/widget/registered-widget.h +++ b/src/ui/widget/registered-widget.h @@ -55,6 +55,11 @@ public: event_description = _event_description; write_undo = true; } + void set_xml_target(Inkscape::XML::Node *xml_node, SPDocument *document) + { + repr = xml_node; + doc = document; + } bool is_updating() {if (_wr) return _wr->isUpdating(); else return false;} @@ -136,7 +141,7 @@ private: class RegisteredCheckButton : public RegisteredWidget<Gtk::CheckButton> { public: virtual ~RegisteredCheckButton(); - RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL); + RegisteredCheckButton (const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Registry& wr, bool right=true, Inkscape::XML::Node* repr_in=NULL, SPDocument *doc_in=NULL, char const *active_str = "true", char const *inactive_str = "false"); void setActive (bool); @@ -153,6 +158,7 @@ public: // if a callback checks it, it must reset it back to false protected: + char const *_active_str, *_inactive_str; sigc::connection _toggled_connection; void on_toggled(); }; |
