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

Unified Diff: samplecode/SampleApp.cpp

Issue 1288473002: Add high resolution WallTimer to SampleApp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 2d12bfd67293bbaccc9107befbdb11d3ad6e317a..956669a8246f46289464c41753aeca02b5a03eda 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -1311,8 +1311,9 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
}
// Do this after presentGL and other finishing, rather than in afterChild
- if (fMeasureFPS && fMeasureFPS_StartTime) {
- fMeasureFPS_Time += SkTime::GetMSecs() - fMeasureFPS_StartTime;
+ if (fMeasureFPS) {
+ fTimer.end();
+ fMeasureFPS_Time += fTimer.fWall;
}
}
@@ -1349,9 +1350,8 @@ void SampleWindow::beforeChild(SkView* child, SkCanvas* canvas) {
}
if (fMeasureFPS) {
- if (SampleView::SetRepeatDraw(child, FPS_REPEAT_COUNT)) {
- fMeasureFPS_StartTime = SkTime::GetMSecs();
- }
+ (void)SampleView::SetRepeatDraw(child, FPS_REPEAT_COUNT);
+ fTimer.start();
} else {
(void)SampleView::SetRepeatDraw(child, 1);
}
@@ -1933,7 +1933,7 @@ void SampleWindow::updateTitle() {
}
if (fMeasureFPS) {
- title.appendf(" %8.3f ms", fMeasureFPS_Time / (float)FPS_REPEAT_COUNT);
+ title.appendf(" %8.4f ms", fMeasureFPS_Time / (float)FPS_REPEAT_COUNT);
}
SkView* view = curr_view(this);
« 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