Index: tools/viewer/Viewer.cpp |
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp |
index 7dd265e6e2183cd75c4e726410be8a845aa12d41..49fc6dccebf5b78fb11e5383cca54418a05ae4af 100644 |
--- a/tools/viewer/Viewer.cpp |
+++ b/tools/viewer/Viewer.cpp |
@@ -112,7 +112,6 @@ Viewer::Viewer(int argc, char** argv, void* platformData) |
// set up first frame |
fCurrentSlide = 0; |
setupCurrentSlide(-1); |
- updateMatrix(); |
fWindow->show(); |
} |
@@ -205,10 +204,9 @@ void Viewer::changeZoomLevel(float delta) { |
} else { |
fZoomScale = SK_Scalar1; |
} |
- this->updateMatrix(); |
} |
-void Viewer::updateMatrix(){ |
+SkMatrix Viewer::computeMatrix() { |
SkMatrix m; |
m.reset(); |
@@ -224,12 +222,10 @@ void Viewer::updateMatrix(){ |
m.postTranslate(cx, cy); |
} |
- // TODO: add gesture support |
- // Apply any gesture matrix |
- //m.preConcat(fGesture.localM()); |
- //m.preConcat(fGesture.globalM()); |
+ m.preConcat(fWindow->getGestureLocalM()); |
+ m.preConcat(fWindow->getGestureGlobalM()); |
- fLocalMatrix = m; |
+ return m; |
} |
void Viewer::onPaint(SkCanvas* canvas) { |
@@ -251,7 +247,7 @@ void Viewer::onPaint(SkCanvas* canvas) { |
matrix.setRectToRect(slideBounds, contentRect, SkMatrix::kCenter_ScaleToFit); |
canvas->concat(matrix); |
} |
- canvas->concat(fLocalMatrix); |
+ canvas->concat(computeMatrix()); |
fSlides[fCurrentSlide]->draw(canvas); |
canvas->restoreToCount(count); |