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/SampleMipMap.cpp b/samplecode/SampleMipMap.cpp
index 5885591..07227e5 100644
--- a/samplecode/SampleMipMap.cpp
+++ b/samplecode/SampleMipMap.cpp
@@ -38,7 +38,6 @@
fBitmap = createBitmap(N);
fWidth = N;
- fDW = -1;
}
protected:
@@ -97,15 +96,13 @@
SkBitmap bitmap(fBitmap);
bitmap.buildMipMap();
drawN2(canvas, bitmap);
-
- fWidth += fDW;
- if (fDW > 0 && fWidth > N) {
- fDW = -fDW;
- fWidth = N;
- } else if (fDW < 0 && fWidth < 8) {
- fDW = -fDW;
- fWidth = 8;
+
+ SkScalar time = SampleCode::GetAnimScalar(SkIntToScalar(1)/4,
+ SkIntToScalar(2));
+ if (time >= SK_Scalar1) {
+ time = SkIntToScalar(2) - time;
}
+ fWidth = 8 + SkScalarRound(N * time);
SkRect dst;
dst.set(0, 0, SkIntToScalar(fWidth), SkIntToScalar(fWidth));
@@ -140,7 +137,7 @@
}
private:
- int fWidth, fDW;
+ int fWidth;
typedef SkView INHERITED;
};