diff options
Diffstat (limited to 'src/mbgl/util/rect.hpp')
-rw-r--r-- | src/mbgl/util/rect.hpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mbgl/util/rect.hpp b/src/mbgl/util/rect.hpp new file mode 100644 index 0000000000..f5c77f93d1 --- /dev/null +++ b/src/mbgl/util/rect.hpp @@ -0,0 +1,22 @@ +#ifndef MBGL_UTIL_RECT +#define MBGL_UTIL_RECT + +namespace mbgl { + +template <typename T> +struct Rect { + inline Rect() {} + inline 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 |