aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2018-04-26 16:22:42 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-26 20:52:43 +0000
commitbdaf97bdb8c671ba380b12169b369bb2a23bb171 (patch)
tree4e9e332b55826f2b97660f535809b46baf25d0a9 /tools
parent011b35c31b02306b5c8e67c2e9a6f5174a7567f1 (diff)
Rotate about the slide center, and before perspective
This causes rotation to happen in the perspective plane, which is more (?) interesting/useful. Change-Id: If57a81de6662591be67cb68f0278f71038ac8d40 Reviewed-on: https://skia-review.googlesource.com/124160 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/viewer/Viewer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 3411e5684b..566ab80cc2 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -882,7 +882,9 @@ SkMatrix Viewer::computePreTouchMatrix() {
SkScalar zoomScale = (fZoomLevel < 0) ? SK_Scalar1 / (SK_Scalar1 - fZoomLevel)
: SK_Scalar1 + fZoomLevel;
m.preScale(zoomScale, zoomScale);
- m.preRotate(fRotation);
+
+ const SkISize slideSize = fSlides[fCurrentSlide]->getDimensions();
+ m.preRotate(fRotation, slideSize.width() * 0.5f, slideSize.height() * 0.5f);
if (fPerspective) {
SkScalar w = fWindow->width(), h = fWindow->height();
@@ -895,7 +897,7 @@ SkMatrix Viewer::computePreTouchMatrix() {
};
SkMatrix persp;
persp.setPolyToPoly(orthoPts, perspPts, 4);
- m.preConcat(persp);
+ m.postConcat(persp);
}
return m;