Add a layer (FBO) cache.

The cache is used to draw layers so that a new
texture does not have to be recreated every time
a call to saveLayer() happens.

The FBO cache used a KeyedVector, which is a bad
idea. The cache should be able to store several
FBOs of the same size (this happens a lot during
scrolling with fading edges for instance.) This
will be changed in a future CL.

Change-Id: Ic316189e625f0dbcf0d273a71cc981a433d48726
diff --git a/libs/hwui/Snapshot.h b/libs/hwui/Snapshot.h
index d1809f3..17ca440 100644
--- a/libs/hwui/Snapshot.h
+++ b/libs/hwui/Snapshot.h
@@ -20,10 +20,9 @@
 #include <GLES2/gl2.h>
 #include <GLES2/gl2ext.h>
 
-#include <SkXfermode.h>
-
 #include <utils/RefBase.h>
 
+#include "Layer.h"
 #include "Matrix.h"
 #include "Rect.h"
 
@@ -41,8 +40,7 @@
  */
 class Snapshot: public LightRefBase<Snapshot> {
 public:
-    Snapshot() {
-    }
+    Snapshot(): layer(NULL), fbo(0) { }
 
     /**
      * Copies the specified snapshot. Only the transform and clip rectangle
@@ -56,10 +54,8 @@
             clipRect(s->clipRect),
             flags(kFlagDirtyTransform),
             previous(s),
-            layer(0.0f, 0.0f, 0.0f, 0.0f),
-            texture(0),
-            fbo(0),
-            alpha(255) {
+            layer(NULL),
+            fbo(s->fbo) {
     }
 
     /**
@@ -126,30 +122,10 @@
     sp<Snapshot> previous;
 
     /**
-     * Coordinates of the layer corresponding to this snapshot.
      * Only set when the flag kFlagIsLayer is set.
      */
-    Rect layer;
-    /**
-     * Name of the texture used to render the layer.
-     * Only set when the flag kFlagIsLayer is set.
-     */
-    GLuint texture;
-    /**
-     * Name of the FBO used to render the layer.
-     * Only set when the flag kFlagIsLayer is set.
-     */
+    Layer* layer;
     GLuint fbo;
-    /**
-     * Opacity of the layer.
-     * Only set when the flag kFlagIsLayer is set.
-     */
-    float alpha;
-    /**
-     * Blending mode of the layer.
-     * Only set when the flag kFlagIsLayer is set.
-     */
-    SkXfermode::Mode mode;
 
     /**
      * Contains the previous ortho matrix.