add SampleCode::GetAnimTime() so slides go through a central location for
animation timing. This allows us to "freeze" time in order to do things like
draw multiple times to test clipping.
git-svn-id: http://skia.googlecode.com/svn/trunk@444 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/SampleLineClipper.cpp b/samplecode/SampleLineClipper.cpp
index 09606f6..8e2d620 100644
--- a/samplecode/SampleLineClipper.cpp
+++ b/samplecode/SampleLineClipper.cpp
@@ -147,6 +147,7 @@
};
class LineClipperView : public SkView {
+ SkMSec fNow;
int fCounter;
int fProcIndex;
SkRect fClip;
@@ -196,7 +197,14 @@
virtual void onDraw(SkCanvas* canvas) {
this->drawBG(canvas);
-
+
+ SkMSec now = SampleCode::GetAnimTime();
+ if (fNow != now) {
+ fNow = now;
+ this->randPts();
+ this->inval(NULL);
+ }
+
// fProcIndex = test0(fPts, &fClip);
SkPaint paint, paint1;
@@ -219,11 +227,6 @@
paint1.setColor(SK_ColorRED);
paint1.setStyle(SkPaint::kStroke_Style);
gProcs[fProcIndex](fPts, fClip, canvas, paint, paint1);
-
- if (AUTO_ANIMATE) {
- this->randPts();
- this->inval(NULL);
- }
}
virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {