summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 20c5124)
raw | patch | inline | side by side (parent: 20c5124)
author | kiirala <kiirala@users.sourceforge.net> | |
Fri, 29 May 2009 07:25:08 +0000 (07:25 +0000) | ||
committer | kiirala <kiirala@users.sourceforge.net> | |
Fri, 29 May 2009 07:25:08 +0000 (07:25 +0000) |
index 8915c88b183218936da514186f8d99cd2d156e9c..0fe4c5947fd6c8bbf28e4e12611c41f61380f8d2 100644 (file)
@@ -168,6 +168,19 @@ int FilterDiffuseLighting::render(FilterSlot &slot, FilterUnits const &units) {
return 0;
}
+void FilterDiffuseLighting::area_enlarge(NRRectL &area, Geom::Matrix const &trans)
+{
+ // TODO: support kernelUnitLength
+ double scalex = std::fabs(trans[0]) + std::fabs(trans[1]);
+ double scaley = std::fabs(trans[2]) + std::fabs(trans[3]);
+
+ //FIXME: no +2 should be there!... (noticable only for big scales at big zoom factor)
+ area.x0 -= (int)(scalex) + 2;
+ area.x1 += (int)(scalex) + 2;
+ area.y0 -= (int)(scaley) + 2;
+ area.y1 += (int)(scaley) + 2;
+}
+
FilterTraits FilterDiffuseLighting::get_input_traits() {
return TRAIT_PARALLER;
}
index a1c6964cb8bf2afc5447b4f986b8e1efcde417ae..708c7a0a224fe50f08d4ec711e38fdf27e93d954 100644 (file)
static FilterPrimitive *create();
virtual ~FilterDiffuseLighting();
virtual int render(FilterSlot &slot, FilterUnits const &units);
+ virtual void area_enlarge(NRRectL &area, Geom::Matrix const &trans);
virtual FilterTraits get_input_traits();
private:
index fb51099d5d4396816a408657cfeea6ed6524b829..2df3ff807433a204186e4c3dfa741af1765d72eb 100644 (file)
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#include <cmath>
#include "display/nr-filter-morphology.h"
#include "display/nr-filter-units.h"
#include "libnr/nr-blit.h"
void FilterMorphology::area_enlarge(NRRectL &area, Geom::Matrix const &trans)
{
- int const enlarge_x = (int)round(this->xradius * trans.expansionX());
- int const enlarge_y = (int)round(this->yradius * trans.expansionY());
+ int const enlarge_x = (int)std::ceil(this->xradius * (std::fabs(trans[0]) + std::fabs(trans[1])));
+ int const enlarge_y = (int)std::ceil(this->yradius * (std::fabs(trans[2]) + std::fabs(trans[3])));
area.x0 -= enlarge_x;
area.x1 += enlarge_x;
diff --git a/src/display/nr-filter-specularlighting.cpp b/src/display/nr-filter-specularlighting.cpp
index b096ee49d2691c319567c75cde3853a90b0852de..6a6ce38a8199284dcd40ef6f27991b094d725e1b 100644 (file)
@@ -188,6 +188,19 @@ int FilterSpecularLighting::render(FilterSlot &slot, FilterUnits const &units) {
return 0;
}
+void FilterSpecularLighting::area_enlarge(NRRectL &area, Geom::Matrix const &trans)
+{
+ // TODO: support kernelUnitLength
+ double scalex = std::fabs(trans[0]) + std::fabs(trans[1]);
+ double scaley = std::fabs(trans[2]) + std::fabs(trans[3]);
+
+ //FIXME: no +2 should be there!... (noticable only for big scales at big zoom factor)
+ area.x0 -= (int)(scalex) + 2;
+ area.x1 += (int)(scalex) + 2;
+ area.y0 -= (int)(scaley) + 2;
+ area.y1 += (int)(scaley) + 2;
+}
+
FilterTraits FilterSpecularLighting::get_input_traits() {
return TRAIT_PARALLER;
}
index e141f8f1ff9d165dbf781a171a244791cea517fa..0f9e6dfe94efdb03ee07cdb23c17a8ce23a3fbe2 100644 (file)
static FilterPrimitive *create();
virtual ~FilterSpecularLighting();
virtual int render(FilterSlot &slot, FilterUnits const &units);
+ virtual void area_enlarge(NRRectL &area, Geom::Matrix const &trans);
virtual FilterTraits get_input_traits();
private: