Batch 9-patches in a single mesh whenever possible

This change also fixes the way batched bitmaps were handled
inside a layer. The layer is now correctly dirtied to minimize
the amount of pixels to blend.

Fix alpha, mode and opaque computations for DrawPatchOp.

Change-Id: I1b6cd581c0f0db66c1002bb4fb1a9811e55bfa78
diff --git a/libs/hwui/Patch.h b/libs/hwui/Patch.h
index 448cf60..246ba66 100644
--- a/libs/hwui/Patch.h
+++ b/libs/hwui/Patch.h
@@ -45,6 +45,7 @@
      */
     uint32_t getSize() const;
 
+    TextureVertex* vertices;
     uint32_t verticesCount;
     uint32_t indexCount;
     bool hasEmptyQuads;
@@ -54,11 +55,9 @@
     GLintptr textureOffset;
 
     TextureVertex* createMesh(const float bitmapWidth, const float bitmapHeight,
-            float left, float top, float right, float bottom,
-            const Res_png_9patch* patch);
+            float width, float height, const Res_png_9patch* patch);
     TextureVertex* createMesh(const float bitmapWidth, const float bitmapHeight,
-            float left, float top, float right, float bottom,
-            const UvMapper& mapper, const Res_png_9patch* patch);
+            float width, float height, const UvMapper& mapper, const Res_png_9patch* patch);
 
 private:
     void generateRow(const int32_t* xDivs, uint32_t xCount, TextureVertex*& vertex,