Optimize calls to glCopyTexImage2D().

Change-Id: I34ee87bd4472864f440916e03a2894fae24bbe4a
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index e7f933f..12ec276 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -29,6 +29,7 @@
 
 #include <utils/RefBase.h>
 #include <utils/ResourceTypes.h>
+#include <utils/Vector.h>
 
 #include "Extensions.h"
 #include "Matrix.h"
@@ -156,6 +157,12 @@
             int alpha, SkXfermode::Mode mode, int flags);
 
     /**
+     * Clears all the regions corresponding to the current list of layers.
+     * This method MUST be invoked before any drawing operation.
+     */
+    void clearLayerRegions();
+
+    /**
      * Draws a colored rectangle with the specified color. The specified coordinates
      * are transformed by the current snapshot's transform matrix.
      *
@@ -385,6 +392,10 @@
 
     // Various caches
     Caches& mCaches;
+
+    // List of rectangles to clear due to calls to saveLayer()
+    Vector<Rect*> mLayers;
+
 }; // class OpenGLRenderer
 
 }; // namespace uirenderer