Code

Fix self-snapping when dragging the transformation center of a selection containing...
[inkscape.git] / src / display / nr-filter-primitive.cpp
index 6bdbf9a41a3d5ccb7e0340e72ac473831cc7c0d7..b70ae57fe9764da53478b7448b655f6978648783 100644 (file)
 #include "libnr/nr-pixblock.h"
 #include "svg/svg-length.h"
 
-namespace NR {
+namespace Inkscape {
+namespace Filters {
 
 FilterPrimitive::FilterPrimitive()
 {
     _input = NR_FILTER_SLOT_NOT_SET;
     _output = NR_FILTER_SLOT_NOT_SET;
 
+    // These defaults are according to SVG standard.
+    // NB: SVGLength.set takes prescaled percent values: 1 means 100%
     _region_x.set(SVGLength::PERCENT, 0, 0);
     _region_y.set(SVGLength::PERCENT, 0, 0);
-    _region_width.set(SVGLength::PERCENT, 100, 0);
-    _region_height.set(SVGLength::PERCENT, 100, 0);
+    _region_width.set(SVGLength::PERCENT, 1, 0);
+    _region_height.set(SVGLength::PERCENT, 1, 0);
 }
 
-int FilterPrimitive::render(NRPixBlock **pb, NRMatrix const *trans) {
-    if(trans) {
-        return this->render(pb, *trans);
-    } else {
-        Matrix tmp;
-        tmp.set_identity();
-        return this->render(pb, tmp);
-    }
+FilterPrimitive::~FilterPrimitive()
+{
+    // Nothing to do here
 }
 
-int FilterPrimitive::get_enlarge(Matrix const &m)
+void FilterPrimitive::area_enlarge(NRRectL &/*area*/, Geom::Matrix const &/*m*/)
 {
-    return 0;
+    // This doesn't need to do anything by default
 }
 
 void FilterPrimitive::set_input(int slot) {
@@ -49,14 +47,19 @@ void FilterPrimitive::set_input(int slot) {
 }
 
 void FilterPrimitive::set_input(int input, int slot) {
-    if (slot == 0) _input = slot;
+    if (input == 0) _input = slot;
 }
 
 void FilterPrimitive::set_output(int slot) {
     if (slot >= 0) _output = slot;
 }
 
-} /* namespace NR */
+FilterTraits FilterPrimitive::get_input_traits() {
+    return TRAIT_ANYTHING;
+}
+
+} /* namespace Filters */
+} /* namespace Inkscape */
 
 /*
   Local Variables: