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