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/PatchCache.cpp b/libs/hwui/PatchCache.cpp
index c23e991..dc69d7f 100644
--- a/libs/hwui/PatchCache.cpp
+++ b/libs/hwui/PatchCache.cpp
@@ -118,10 +118,10 @@
 
         if (entry) {
             vertices = newMesh->createMesh(bitmapWidth, bitmapHeight,
-                    0.0f, 0.0f, pixelWidth, pixelHeight, entry->uvMapper, patch);
+                    pixelWidth, pixelHeight, entry->uvMapper, patch);
         } else {
             vertices = newMesh->createMesh(bitmapWidth, bitmapHeight,
-                    0.0f, 0.0f, pixelWidth, pixelHeight, patch);
+                    pixelWidth, pixelHeight, patch);
         }
 
         if (vertices) {
@@ -141,8 +141,6 @@
             mSize += size;
 
             glBufferSubData(GL_ARRAY_BUFFER, newMesh->offset, size, vertices);
-
-            delete[] vertices;
         }
 
         mCache.put(description, newMesh);