Add plumbing for better text scaling

Fonts are now described by a transform matrix. This lead to switching
from a vector to a hashmap. This change therefore adds new comparators
and hash computations to Font.

Change-Id: I2daffa7d6287c18554c606b8bfa06640d28b4530
diff --git a/libs/hwui/LayerCache.h b/libs/hwui/LayerCache.h
index fd698e2..fc2cd91 100644
--- a/libs/hwui/LayerCache.h
+++ b/libs/hwui/LayerCache.h
@@ -102,9 +102,6 @@
      */
     void dump();
 
-private:
-    void deleteLayer(Layer* layer);
-
     struct LayerEntry {
         LayerEntry():
             mLayer(NULL), mWidth(0), mHeight(0) {
@@ -119,15 +116,14 @@
             mLayer(layer), mWidth(layer->getWidth()), mHeight(layer->getHeight()) {
         }
 
-        bool operator<(const LayerEntry& rhs) const {
-            if (mWidth == rhs.mWidth) {
-                return mHeight < rhs.mHeight;
-            }
-            return mWidth < rhs.mWidth;
+        static int compare(const LayerEntry& lhs, const LayerEntry& rhs);
+
+        bool operator==(const LayerEntry& other) const {
+            return compare(*this, other) == 0;
         }
 
-        bool operator==(const LayerEntry& rhs) const {
-            return mWidth == rhs.mWidth && mHeight == rhs.mHeight;
+        bool operator!=(const LayerEntry& other) const {
+            return compare(*this, other) != 0;
         }
 
         Layer* mLayer;
@@ -135,12 +131,24 @@
         uint32_t mHeight;
     }; // struct LayerEntry
 
+private:
+    void deleteLayer(Layer* layer);
+
     SortedList<LayerEntry> mCache;
 
     uint32_t mSize;
     uint32_t mMaxSize;
 }; // class LayerCache
 
+inline int strictly_order_type(const LayerCache::LayerEntry& lhs,
+        const LayerCache::LayerEntry& rhs) {
+    return LayerCache::LayerEntry::compare(lhs, rhs) < 0;
+}
+
+inline int compare_type(const LayerCache::LayerEntry& lhs, const LayerCache::LayerEntry& rhs) {
+    return LayerCache::LayerEntry::compare(lhs, rhs);
+}
+
 }; // namespace uirenderer
 }; // namespace android