summaryrefslogtreecommitdiff
path: root/include/mbgl
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-04-03 17:07:17 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-04-10 18:01:28 +0300
commite5aa4d70cd7b39302ddf1ec4df240a14accfb474 (patch)
tree8e8595f32fa4f30316e68f533ee4dd289adf11fb /include/mbgl
parent76edc6ee69ec9a8aaa0b0207aed06f257ff5fd83 (diff)
downloadqtlocation-mapboxgl-e5aa4d70cd7b39302ddf1ec4df240a14accfb474.tar.gz
[core] Updated Size::isEmpty and TransformState::valid checks
Diffstat (limited to 'include/mbgl')
-rw-r--r--include/mbgl/util/image.hpp2
-rw-r--r--include/mbgl/util/size.hpp11
2 files changed, 6 insertions, 7 deletions
diff --git a/include/mbgl/util/image.hpp b/include/mbgl/util/image.hpp
index 5d1462e7c4..c019bb949c 100644
--- a/include/mbgl/util/image.hpp
+++ b/include/mbgl/util/image.hpp
@@ -58,7 +58,7 @@ public:
}
bool valid() const {
- return size && data.get() != nullptr;
+ return !size.isEmpty() && data.get() != nullptr;
}
template <typename T = Image>
diff --git a/include/mbgl/util/size.hpp b/include/mbgl/util/size.hpp
index 79679a92fb..45c303969c 100644
--- a/include/mbgl/util/size.hpp
+++ b/include/mbgl/util/size.hpp
@@ -7,8 +7,7 @@ namespace mbgl {
class Size {
public:
- constexpr Size() : width(0), height(0) {
- }
+ constexpr Size() = default;
constexpr Size(const uint32_t width_, const uint32_t height_) : width(width_), height(height_) {
}
@@ -17,12 +16,12 @@ public:
return width * height;
}
- constexpr explicit operator bool() const {
- return width > 0 && height > 0;
+ constexpr bool isEmpty() const {
+ return width == 0 || height == 0;
}
- uint32_t width;
- uint32_t height;
+ uint32_t width = 0;
+ uint32_t height = 0;
};
constexpr inline bool operator==(const Size& a, const Size& b) {