[viewer] Avoid per-frame json UI updates

The reason we push Json updates for every frame is to support the
Android FPS meter - which happens to require the native FPS meter for
updates.

Instead of supporting two meters:

1) scale up the native FPS widget on Android (1.5x)

2) remove the Android widget

3) stop calling updateUIState() from onPaint()

Change-Id: Ica8109869035b2f885743a7e38b50688b69fa5e4
Reviewed-on: https://skia-review.googlesource.com/126621
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
diff --git a/tools/viewer/StatsLayer.cpp b/tools/viewer/StatsLayer.cpp
index 75226fd..50faf9c 100644
--- a/tools/viewer/StatsLayer.cpp
+++ b/tools/viewer/StatsLayer.cpp
@@ -60,6 +60,13 @@
         fTimers[i].fTimes[fCurrentMeasurement] = 0;
     }
 
+#ifdef SK_BUILD_FOR_ANDROID
+    // Scale up the stats overlay on Android devices
+    static constexpr SkScalar kScale = 1.5;
+#else
+    static constexpr SkScalar kScale = 1;
+#endif
+
     // Now draw everything
     static const float kPixelPerMS = 2.0f;
     static const int kDisplayWidth = 192;
@@ -77,6 +84,14 @@
     SkPaint paint;
     canvas->save();
 
+    // Scale the canvas while keeping the right edge in place.
+    canvas->concat(SkMatrix::MakeRectToRect(SkRect::Make(canvasSize),
+                                            SkRect::MakeXYWH(canvasSize.width()  * (1 - kScale),
+                                                             0,
+                                                             canvasSize.width()  * kScale,
+                                                             canvasSize.height() * kScale),
+                                            SkMatrix::kFill_ScaleToFit));
+
     paint.setColor(SK_ColorBLACK);
     canvas->drawRect(rect, paint);
     // draw the 16ms line