diff --git a/Device/Mask/Rectangle.cpp b/Device/Mask/Rectangle.cpp
index 0fa048b17cd68d4971114228d4701bf7727725eb..4d4e29fe34042d38cb435dc1202b9859454f4d3f 100644
--- a/Device/Mask/Rectangle.cpp
+++ b/Device/Mask/Rectangle.cpp
@@ -55,7 +55,8 @@ bool Rectangle::contains(double x, double y) const
 
 bool Rectangle::contains(const Bin1D& binx, const Bin1D& biny) const
 {
-    return contains(binx.center(), biny.center());
+    return m_inverted ^ (binx.upperBound() > m_xlow && binx.lowerBound() < m_xup &&
+			 biny.upperBound() > m_ylow && biny.lowerBound() < m_yup);
 }
 
 double Rectangle::getArea() const