rect.position.x = std::max(first.position.x, second.position.x);
rect.position.y = std::max(first.position.y, second.position.y);
- rect.size.width = std::min(first.position.x + first.size.width, second.position.x + second.size.width) - rect.position.x;
- rect.size.height = std::min(first.position.y + first.size.height, second.position.y + second.size.height) - rect.position.y;
+ rect.size.width = std::max(rect.position.x, std::min(first.position.x + first.size.width, second.position.x + second.size.width)) - rect.position.x;
+ rect.size.height = std::max(rect.position.y, std::min(first.position.y + first.size.height, second.position.y + second.size.height)) - rect.position.y;
return rect;
}
+Rectangle Rectangle::sum(const Rectangle first, const Rectangle second)
+{
+ Rectangle rect;
+
+ rect.position.x = std::min(first.position.x, second.position.x);
+ rect.position.y = std::min(first.position.y, second.position.y);
+
+ rect.size.width = std::max(first.position.x + first.size.width, second.position.x + second.size.width) - rect.position.x;
+ rect.size.height = std::max(first.position.y + first.size.height, second.position.y + second.size.height) - rect.position.y;
+
+ return rect;
+}
namespace
{
Size size;
static Rectangle intersect(const Rectangle first, const Rectangle second);
+ static Rectangle sum(const Rectangle first, const Rectangle second);
};
namespace evas