summaryrefslogtreecommitdiff
path: root/include/mbgl/util/rect.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/util/rect.hpp')
-rw-r--r--include/mbgl/util/rect.hpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/mbgl/util/rect.hpp b/include/mbgl/util/rect.hpp
new file mode 100644
index 0000000000..a216b8e145
--- /dev/null
+++ b/include/mbgl/util/rect.hpp
@@ -0,0 +1,21 @@
+#ifndef MBGL_UTIL_RECT
+#define MBGL_UTIL_RECT
+
+namespace mbgl {
+
+template <typename T>
+struct Rect {
+ explicit Rect(T x, T y, T w, T h) : x(x), y(y), w(w), h(h) {}
+ T x = 0, y = 0;
+ T w = 0, h = 0;
+
+ template <typename Number>
+ Rect operator *(Number value) const {
+ return Rect(x * value, y * value, w * value, h * value);
+ }
+
+ operator bool() const { return w == 0 || h == 0; }
+};
+}
+
+#endif