Add support for drawBitmapMesh().

Change-Id: Ic77f9c534bb90dc7b9458299544bd50b8b6ae6a5
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index a74a95f..bdf056c 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -100,6 +100,7 @@
     "DrawBitmap",
     "DrawBitmapMatrix",
     "DrawBitmapRect",
+    "DrawBitmapMesh",
     "DrawPatch",
     "DrawColor",
     "DrawRect",
@@ -308,6 +309,19 @@
                         getFloat(), getFloat(), getFloat(), getFloat(), getPaint());
             }
             break;
+            case DrawBitmapMesh: {
+                int verticesCount = 0;
+                uint32_t colorsCount = 0;
+
+                SkBitmap* bitmap = getBitmap();
+                uint32_t meshWidth = getInt();
+                uint32_t meshHeight = getInt();
+                float* vertices = getFloats(verticesCount);
+                bool hasColors = getInt();
+                int* colors = hasColors ? getInts(colorsCount) : NULL;
+
+                renderer.drawBitmapMesh(bitmap, meshWidth, meshHeight, vertices, colors, getPaint());
+            }
             case DrawPatch: {
                 int32_t* xDivs = NULL;
                 int32_t* yDivs = NULL;
@@ -587,6 +601,22 @@
     addPaint(paint);
 }
 
+void DisplayListRenderer::drawBitmapMesh(SkBitmap* bitmap, int meshWidth, int meshHeight,
+        float* vertices, int* colors, SkPaint* paint) {
+    addOp(DisplayList::DrawBitmapMesh);
+    addBitmap(bitmap);
+    addInt(meshWidth);
+    addInt(meshHeight);
+    addFloats(vertices, (meshWidth + 1) * (meshHeight + 1) * 2);
+    if (colors) {
+        addInt(1);
+        addInts(colors, (meshWidth + 1) * (meshHeight + 1));
+    } else {
+        addInt(0);
+    }
+    addPaint(paint);
+}
+
 void DisplayListRenderer::drawPatch(SkBitmap* bitmap, const int32_t* xDivs, const int32_t* yDivs,
         const uint32_t* colors, uint32_t width, uint32_t height, int8_t numColors,
         float left, float top, float right, float bottom, SkPaint* paint) {