Fix INVALID_OPERATION error with layers rendering.

This change is a workaround for a driver bug that causes an INVALID_OPERATION
to be thrown on every glCopyTexSubImage() call. This change also adds a new
test for gradients local matrices.

Change-Id: I41b7437481026702d0a3a9677f099b4557c0a84e
diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h
index 60523db..a0cc5d6 100644
--- a/libs/hwui/Layer.h
+++ b/libs/hwui/Layer.h
@@ -44,7 +44,7 @@
     uint32_t id;
 
     bool operator<(const LayerSize& rhs) const {
-        if (id != 0 && rhs.id != 0) {
+        if (id != 0 && rhs.id != 0 && id != rhs.id) {
             return id < rhs.id;
         }
         if (width == rhs.width) {
@@ -54,7 +54,7 @@
     }
 
     bool operator==(const LayerSize& rhs) const {
-        return width == rhs.width && height == rhs.height;
+        return id == rhs.id && width == rhs.width && height == rhs.height;
     }
 }; // struct LayerSize
 
@@ -83,7 +83,7 @@
      */
     bool blend;
     /**
-     * Indicates that this layer has never been used before.
+     * Indicates whether this layer has been used already.
      */
     bool empty;
 }; // struct Layer