summaryrefslogtreecommitdiff
path: root/src/mbgl
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-05-06 12:41:56 +0200
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-05-12 20:46:56 -0700
commit40b604448fa1388d3917e2cfb5db0b63555000ee (patch)
treebc4a5eff58f381f3f5e3065a579f146c387bf320 /src/mbgl
parent8dd6da5b5e8c4246b130da9eb1bd967606ae98df (diff)
downloadqtlocation-mapboxgl-40b604448fa1388d3917e2cfb5db0b63555000ee.tar.gz
add BinPack test
Diffstat (limited to 'src/mbgl')
-rw-r--r--src/mbgl/geometry/binpack.hpp4
-rw-r--r--src/mbgl/util/rect.hpp7
2 files changed, 10 insertions, 1 deletions
diff --git a/src/mbgl/geometry/binpack.hpp b/src/mbgl/geometry/binpack.hpp
index 9aadaa202c..504417f452 100644
--- a/src/mbgl/geometry/binpack.hpp
+++ b/src/mbgl/geometry/binpack.hpp
@@ -23,7 +23,11 @@ public:
if (width <= ref.w && height <= ref.h) {
if (smallest == free.end() || (ref.y <= rect.y && ref.x <= rect.x)) {
smallest = it;
+ } else {
+ // Our current "smallest" rect is already closer to 0/0.
}
+ } else {
+ // The rect in the free list is not big enough.
}
}
diff --git a/src/mbgl/util/rect.hpp b/src/mbgl/util/rect.hpp
index b5f07eb23d..f4eb0679c4 100644
--- a/src/mbgl/util/rect.hpp
+++ b/src/mbgl/util/rect.hpp
@@ -12,10 +12,15 @@ struct Rect {
T originalW = 0, originalH = 0;
template <typename Number>
- Rect operator *(Number value) const {
+ inline Rect operator *(Number value) const {
return Rect(x * value, y * value, w * value, h * value);
}
+ template <typename R>
+ inline bool operator==(const R& r) const {
+ return x == r.x && y == r.y && w == r.w && h == r.h;
+ }
+
inline bool hasArea() const { return w != 0 && h != 0; }
};
}