Print measure info before closeWindow

The closeWindow function does not guarantee the calling of
~SampleWindow (in Windows and Mac). So we print the info earlier.

Bug: skia:
Change-Id: Ib8b11cac4fb2fc7b62a02c7fb7f3aaaa48df2da6
Reviewed-on: https://skia-review.googlesource.com/63140
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Yuqian Li <liyuqian@google.com>
This commit is contained in:
Yuqian Li 2017-10-23 17:00:52 -04:00 committed by Skia Commit-Bot
parent bb67b7338d
commit 3c31281c32

View File

@ -1065,10 +1065,6 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev
} }
SampleWindow::~SampleWindow() { SampleWindow::~SampleWindow() {
if (fMeasureFPS) {
SkDebugf("Average frame time of the last slide: %.4f ms\n",
fCumulativeFPS_Time / (float)SkTMax(1, fCumulativeFPS_Count));
}
SkSafeUnref(fDevManager); SkSafeUnref(fDevManager);
} }
@ -2289,6 +2285,8 @@ bool SampleWindow::getRawTitle(SkString* title) {
void SampleWindow::updateTitle() { void SampleWindow::updateTitle() {
if (fMeasureMS > 0 && (int)gAnimTimer.msec() > fMeasureMS) { if (fMeasureMS > 0 && (int)gAnimTimer.msec() > fMeasureMS) {
SkDebugf("Average frame time of the last slide: %.4f ms\n",
fCumulativeFPS_Time / (float)SkTMax(1, fCumulativeFPS_Count));
this->closeWindow(); this->closeWindow();
} }