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

Unified Diff: samplecode/SampleApp.cpp

Issue 18948002: Make 'rotate' animate in SampleApp. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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
« no previous file with comments | « samplecode/SampleApp.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleApp.cpp
===================================================================
--- samplecode/SampleApp.cpp (revision 9798)
+++ samplecode/SampleApp.cpp (working copy)
@@ -782,6 +782,7 @@
fNClip = false;
fAnimating = false;
fRotate = false;
+ fRotateAnimTime = 0;
fPerspAnim = false;
fPerspAnimTime = 0;
fRequestGrabImage = false;
@@ -1409,12 +1410,15 @@
void SampleWindow::beforeChild(SkView* child, SkCanvas* canvas) {
if (fRotate) {
+ fRotateAnimTime += SampleCode::GetAnimSecondsDelta();
+
SkScalar cx = this->width() / 2;
SkScalar cy = this->height() / 2;
canvas->translate(cx, cy);
- canvas->rotate(SkIntToScalar(30));
+ canvas->rotate(fRotateAnimTime * 10);
canvas->translate(-cx, -cy);
}
+
if (fPerspAnim) {
fPerspAnimTime += SampleCode::GetAnimSecondsDelta();
@@ -1441,7 +1445,7 @@
} else {
(void)SampleView::SetRepeatDraw(child, 1);
}
- if (fPerspAnim) {
+ if (fPerspAnim || fRotate) {
this->inval(NULL);
}
}
@@ -1764,6 +1768,7 @@
break;
case 'r':
fRotate = !fRotate;
+ fRotateAnimTime = 0;
this->inval(NULL);
this->updateTitle();
return true;
« no previous file with comments | « samplecode/SampleApp.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698