drm_hwcomposer: small feature/style enhancements for seperate_rects
With C++11, we can condense the double angle brackets.
This commit also includes an integer version of seperate_rects and some
convenience functions for rectangles.
Change-Id: Ide2a6b930cdf30c0f7a58d4199e02c06df492776
diff --git a/seperate_rects.h b/seperate_rects.h
index 540a5e8..1e0a267 100644
--- a/seperate_rects.h
+++ b/seperate_rects.h
@@ -64,6 +64,18 @@
return true;
}
+
+ TFloat width() const {
+ return bounds[2] - bounds[0];
+ }
+
+ TFloat height() const {
+ return bounds[3] - bounds[1];
+ }
+
+ TFloat area() const {
+ return width() * height();
+ }
};
template <typename TUInt>
@@ -140,8 +152,10 @@
// rectangle indices that overlap the output rectangle encoded in a bitset. For
// example, an output rectangle that overlaps input rectangles in[0], in[1], and
// in[4], the bitset would be (ommitting leading zeroes) 10011.
-void seperate_frects_64(const std::vector<Rect<float> > &in,
- std::vector<RectSet<uint64_t, float> > *out);
+void seperate_frects_64(const std::vector<Rect<float>> &in,
+ std::vector<RectSet<uint64_t, float>> *out);
+void seperate_rects_64(const std::vector<Rect<int>> &in,
+ std::vector<RectSet<uint64_t, int>> *out);
} // namespace seperate_rects