mirror of https://github.com/mgba-emu/mgba.git
Qt: Better fps non-zero division check
This commit is contained in:
parent
f45b4e3ef0
commit
001135ef91
|
@ -1138,14 +1138,14 @@ void Window::recordFrame() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::showFPS() {
|
void Window::showFPS() {
|
||||||
if (m_frameList.isEmpty()) {
|
|
||||||
updateTitle();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
qint64 total = 0;
|
qint64 total = 0;
|
||||||
for (qint64 t : m_frameList) {
|
for (qint64 t : m_frameList) {
|
||||||
total += t;
|
total += t;
|
||||||
}
|
}
|
||||||
|
if (!total) {
|
||||||
|
updateTitle();
|
||||||
|
return;
|
||||||
|
}
|
||||||
double fps = (m_frameList.size() * 1e10) / total;
|
double fps = (m_frameList.size() * 1e10) / total;
|
||||||
m_frameList.clear();
|
m_frameList.clear();
|
||||||
fps = round(fps) / 10.f;
|
fps = round(fps) / 10.f;
|
||||||
|
|
Loading…
Reference in New Issue