drm_hwcomposer: implement the safe handling of layers

This is a sweeping change to discard our usage of struct hwc_layer_t outside
hwcomposer.cpp. That was a dangerous struct that was a source of many of our
errors. Replacing it with safer RAII-style classes reduces the amount and
complexity of our code.

Change-Id: I580cafdf89bd1e7e6583f3073858b8e78e6018ba
diff --git a/seperate_rects.h b/seperate_rects.h
index 9bf95a3..540a5e8 100644
--- a/seperate_rects.h
+++ b/seperate_rects.h
@@ -43,11 +43,19 @@
       : x1(xx1), y1(yy1), x2(xx2), y2(yy2) {
   }
 
-  Rect(const Rect &rhs) {
+  template <typename T>
+  Rect(const Rect<T> &rhs) {
     for (int i = 0; i < 4; i++)
       bounds[i] = rhs.bounds[i];
   }
 
+  template <typename T>
+  Rect<TFloat> &operator=(const Rect<T> &rhs) {
+    for (int i = 0; i < 4; i++)
+      bounds[i] = rhs.bounds[i];
+    return *this;
+  }
+
   bool operator==(const Rect &rhs) const {
     for (int i = 0; i < 4; i++) {
       if (bounds[i] != rhs.bounds[i])