}
void windowSizeChanged(SampleWindow* win) override {
+ win->resetFPS();
#if SK_SUPPORT_GPU
if (fCurContext) {
AttachmentInfo attachmentInfo;
orig->flush();
fTimer.end();
fMeasureFPS_Time += fTimer.fWall;
+ fCumulativeFPS_Time += fTimer.fWall;
+ fCumulativeFPS_Count += FPS_REPEAT_COUNT;
}
}
this->inval(nullptr);
}
bool SampleWindow::previousSample() {
+ this->resetFPS();
fCurrIndex = (fCurrIndex - 1 + fSamples.count()) % fSamples.count();
this->loadView((*fSamples[fCurrIndex])());
return true;
#include "SkResourceCache.h"
#include "SkGlyphCache.h"
bool SampleWindow::nextSample() {
+ this->resetFPS();
fCurrIndex = (fCurrIndex + 1) % fSamples.count();
this->loadView((*fSamples[fCurrIndex])());
}
bool SampleWindow::goToSample(int i) {
+ this->resetFPS();
fCurrIndex = (i) % fSamples.count();
this->loadView((*fSamples[fCurrIndex])());
return true;
this->inval(nullptr);
}
break;
+ case '0':
+ this->resetFPS();
+ break;
case 'A':
if (gSkUseAnalyticAA.load() && !gSkForceAnalyticAA.load()) {
gSkForceAnalyticAA = true;
this->inval(nullptr);
}
+void SampleWindow::resetFPS() {
+ fCumulativeFPS_Time = 0;
+ fCumulativeFPS_Count = 0;
+}
+
void SampleWindow::toggleDistanceFieldFonts() {
// reset backend
fDevManager->tearDownBackend(this);
if (fMeasureFPS) {
title.appendf(" %8.4f ms", fMeasureFPS_Time / (float)FPS_REPEAT_COUNT);
+ title.appendf(" -> %4.4f ms", fCumulativeFPS_Time / (float)SkTMax(1, fCumulativeFPS_Count));
}
#if SK_SUPPORT_GPU