diff --git a/src/util/Rectangle.cpp b/src/util/Rectangle.cpp index 3ff46cb7..9cf1be5c 100644 --- a/src/util/Rectangle.cpp +++ b/src/util/Rectangle.cpp @@ -8,23 +8,15 @@ Rectangle::Rectangle() } Rectangle::Rectangle(double x, double y, double width, double height) + : x(x), y(y), width(width), height(height) { XOJ_INIT_TYPE(Rectangle); - - this->x = x; - this->y = y; - this->width = width; - this->height = height; } -Rectangle::Rectangle(Range& rect) +Rectangle::Rectangle(const Range& rect) + : x(rect.getX()), y(rect.getY()), width(rect.getWidth()), height(rect.getHeight()) { XOJ_INIT_TYPE(Rectangle); - - this->x = rect.getX(); - this->y = rect.getY(); - this->width = rect.getWidth(); - this->height = rect.getHeight(); } Rectangle::~Rectangle() diff --git a/src/util/Rectangle.h b/src/util/Rectangle.h index 08ea2444..43aad9e4 100644 --- a/src/util/Rectangle.h +++ b/src/util/Rectangle.h @@ -19,7 +19,7 @@ class Rectangle { public: Rectangle(); - Rectangle(Range& rect); + explicit Rectangle(const Range& rect); Rectangle(double x, double y, double width, double height); virtual ~Rectangle();