Add visual profiling feature

When profiling is enabled with debug.hwui.profile set to true,
setting debug.hwui.profile_visualizer to true will display the
profiling data directly on screen.

Change-Id: I3d5fe3f0347090815087b1cbfce66b8e76d9347b
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index 7a38b40..747856c 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -64,6 +64,7 @@
     "DrawTextOnPath",
     "DrawPosText",
     "DrawText",
+    "DrawRects",
     "ResetShader",
     "SetupShader",
     "ResetColorFilter",
@@ -633,6 +634,13 @@
                         text.text(), text.length(), count, paint);
             }
             break;
+            case DrawRects: {
+                int32_t count = 0;
+                float* rects = getFloats(count);
+                SkPaint* paint = getPaint(renderer);
+                ALOGD("%s%s %d, %p", (char*) indent, OP_NAMES[op], count / 4, paint);
+            }
+            break;
             case ResetShader: {
                 ALOGD("%s%s", (char*) indent, OP_NAMES[op]);
             }
@@ -1277,6 +1285,14 @@
                         x, y, positions, paint, length);
             }
             break;
+            case DrawRects: {
+                int32_t count = 0;
+                float* rects = getFloats(count);
+                SkPaint* paint = getPaint(renderer);
+                DISPLAY_LIST_LOGD("%s%s %d, %p", (char*) indent, OP_NAMES[op], count, paint);
+                drawGlStatus |= renderer.drawRects(rects, count / 4, paint);
+            }
+            break;
             case ResetShader: {
                 DISPLAY_LIST_LOGD("%s%s", (char*) indent, OP_NAMES[op]);
                 renderer.resetShader();
@@ -1814,6 +1830,15 @@
     return DrawGlInfo::kStatusDone;
 }
 
+status_t DisplayListRenderer::drawRects(const float* rects, int count, SkPaint* paint) {
+    if (count <= 0) return DrawGlInfo::kStatusDone;
+
+    addOp(DisplayList::DrawRects);
+    addFloats(rects, count * 4);
+    addPaint(paint);
+    return DrawGlInfo::kStatusDone;
+}
+
 void DisplayListRenderer::resetShader() {
     addOp(DisplayList::ResetShader);
 }