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

Unified Diff: samplecode/SampleClipDrawMatch.cpp

Issue 1811613004: Change SkTime::GetMSecs to double; ensure values stored in SkMSec do not overflow. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Rebase. Created 4 years, 9 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 | « include/views/SkTouchGesture.h ('k') | src/animator/SkAnimateMaker.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleClipDrawMatch.cpp
diff --git a/samplecode/SampleClipDrawMatch.cpp b/samplecode/SampleClipDrawMatch.cpp
index 502f34946b710c295ff4da9d411f4986234798ea..45663b501878e93c237c79b363cd962afa53fc31 100644
--- a/samplecode/SampleClipDrawMatch.cpp
+++ b/samplecode/SampleClipDrawMatch.cpp
@@ -121,15 +121,15 @@ public:
fTrans.setRepeatCount(999);
values[0] = values[1] = 0;
- fTrans.setKeyFrame(0, SkTime::GetMSecs() + 1000, values);
+ fTrans.setKeyFrame(0, GetMSecs() + 1000, values);
values[1] = 1;
- fTrans.setKeyFrame(1, SkTime::GetMSecs() + 2000, values);
+ fTrans.setKeyFrame(1, GetMSecs() + 2000, values);
values[0] = values[1] = 1;
- fTrans.setKeyFrame(2, SkTime::GetMSecs() + 3000, values);
+ fTrans.setKeyFrame(2, GetMSecs() + 3000, values);
values[1] = 0;
- fTrans.setKeyFrame(3, SkTime::GetMSecs() + 4000, values);
+ fTrans.setKeyFrame(3, GetMSecs() + 4000, values);
values[0] = 0;
- fTrans.setKeyFrame(4, SkTime::GetMSecs() + 5000, values);
+ fTrans.setKeyFrame(4, GetMSecs() + 5000, values);
}
protected:
@@ -231,7 +231,7 @@ protected:
void onDrawContent(SkCanvas* canvas) override {
SkScalar trans[2];
- fTrans.timeToValues(SkTime::GetMSecs(), trans);
+ fTrans.timeToValues(GetMSecs(), trans);
SkPoint offset;
offset.set(trans[0], trans[1]);
@@ -243,11 +243,16 @@ protected:
this->inval(nullptr);
}
+ SkMSec GetMSecs() const {
+ return static_cast<SkMSec>(SkTime::GetMSecs() - fStart);
+ }
+
private:
SkInterpolator fTrans;
Geometry fGeom;
bool fClipFirst;
int fSign;
+ const double fStart = SkTime::GetMSecs();
typedef SampleView INHERITED;
};
« no previous file with comments | « include/views/SkTouchGesture.h ('k') | src/animator/SkAnimateMaker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698