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 <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
Ben Wagner 2019-03-21 16:50:22 -04:00 committed by Skia Commit-Bot
parent 24341cdd9c
commit cc8eb86c37

View File

@ -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);