Add 'u' to zoom stats display on high DPI devices

Still need to connect this to ImGui, but this is already useful

Bug: skia:
Change-Id: I925c7a9d6236cb2d865d45d6a68a5709bf2e3df7
Reviewed-on: https://skia-review.googlesource.com/143158
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/tools/viewer/StatsLayer.cpp b/tools/viewer/StatsLayer.cpp
index 50faf9c..6573dfd 100644
--- a/tools/viewer/StatsLayer.cpp
+++ b/tools/viewer/StatsLayer.cpp
@@ -14,7 +14,8 @@
 StatsLayer::StatsLayer()
     : fCurrentMeasurement(0)
     , fCumulativeMeasurementTime(0)
-    , fCumulativeMeasurementCount(0) {}
+    , fCumulativeMeasurementCount(0)
+    , fDisplayScale(1.0f) {}
 
 void StatsLayer::resetMeasurements() {
     for (int i = 0; i < fTimers.count(); ++i) {
@@ -64,7 +65,7 @@
     // Scale up the stats overlay on Android devices
     static constexpr SkScalar kScale = 1.5;
 #else
-    static constexpr SkScalar kScale = 1;
+    SkScalar kScale = fDisplayScale;
 #endif
 
     // Now draw everything
diff --git a/tools/viewer/StatsLayer.h b/tools/viewer/StatsLayer.h
index a99bd43..b888517 100644
--- a/tools/viewer/StatsLayer.h
+++ b/tools/viewer/StatsLayer.h
@@ -26,6 +26,8 @@
 
     void onPaint(SkCanvas* canvas) override;
 
+    void setDisplayScale(float scale) { fDisplayScale = scale; }
+
 private:
     static const int kMeasurementCount = 1 << 6;  // should be power of 2 for fast mod
     struct TimerData {
@@ -38,6 +40,7 @@
     int fCurrentMeasurement;
     double fCumulativeMeasurementTime;
     int fCumulativeMeasurementCount;
+    float fDisplayScale;
 };
 
 #endif
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 8f1d7bb..b5a9084 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -183,6 +183,7 @@
     , fZoomWindowFixed(false)
     , fZoomWindowLocation{0.0f, 0.0f}
     , fLastImage(nullptr)
+    , fZoomUI(false)
     , fBackendType(sk_app::Window::kNativeGL_BackendType)
     , fColorMode(ColorMode::kLegacy)
     , fColorSpacePrimaries(gSrgbPrimaries)
@@ -480,6 +481,11 @@
         this->updateTitle();
         fWindow->inval();
     });
+    fCommands.addCommand('u', "GUI", "Zoom UI", [this]() {
+        fZoomUI = !fZoomUI;
+        fStatsLayer.setDisplayScale(fZoomUI ? 2.0f : 1.0f);
+        fWindow->inval();
+    });
 
     // set up slides
     this->initSlides();
diff --git a/tools/viewer/Viewer.h b/tools/viewer/Viewer.h
index f1ecaf4..6d03b3b 100644
--- a/tools/viewer/Viewer.h
+++ b/tools/viewer/Viewer.h
@@ -131,6 +131,7 @@
     bool                   fZoomWindowFixed;
     SkPoint                fZoomWindowLocation;
     sk_sp<SkImage>         fLastImage;
+    bool                   fZoomUI;
 
     sk_app::Window::BackendType fBackendType;