From cc8eb86c3772307d178974b0c046d5fa8233816a Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Thu, 21 Mar 2019 16:50:22 -0400 Subject: [PATCH] Make zoom in viewer exponential. The previous linear zoom fits into about -2 to 2 in the new system. By keeping the old linear values (instead of making the slider exponential) the up and down keys can still be used to get away from and back to no zoom. The new zoom allows for a much larger range of zoom, allowing more issues to be seen. Change-Id: I9ba8cf2c3c8d610a21a8c8598e0f5150eeb04ad8 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202940 Reviewed-by: Brian Osman Commit-Queue: Ben Wagner --- tools/viewer/Viewer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp index 66bd6c27c9..9550c369be 100644 --- a/tools/viewer/Viewer.cpp +++ b/tools/viewer/Viewer.cpp @@ -999,8 +999,8 @@ SkMatrix Viewer::computePerspectiveMatrix() { SkMatrix Viewer::computePreTouchMatrix() { SkMatrix m = fDefaultMatrix; - SkScalar zoomScale = (fZoomLevel < 0) ? SK_Scalar1 / (SK_Scalar1 - fZoomLevel) - : SK_Scalar1 + fZoomLevel; + + SkScalar zoomScale = exp(fZoomLevel); m.preTranslate((fOffset.x() - 0.5f) * 2.0f, (fOffset.y() - 0.5f) * 2.0f); m.preScale(zoomScale, zoomScale);