Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Unified Diff: samplecode/SampleApp.cpp

Issue 2142033002: Factor code to rotate a canvas about a point. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: samplecode/SampleApp.cpp
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index ffa507bc17d519d15c7b31f3c872b5ae22004da3..a5d386516ca85b9c585ea37c15867c79d5055bee 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -1372,9 +1372,7 @@ void SampleWindow::beforeChild(SkView* child, SkCanvas* canvas) {
if (fRotate) {
SkScalar cx = this->width() / 2;
SkScalar cy = this->height() / 2;
- canvas->translate(cx, cy);
- canvas->rotate(gAnimTimer.scaled(10));
- canvas->translate(-cx, -cy);
+ sk_tool_utils::rotate_about(canvas, gAnimTimer.scaled(10), cx, cy);
}
if (fPerspAnim) {
« gm/strokes.cpp ('K') | « gm/typeface.cpp ('k') | samplecode/SampleCircle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698