|
Lines 37-47
a/WebKitTools/QtTestBrowser/fpstimer.cpp_sec1
|
| 37 |
#define FPS_MEASURE_INTERVAL 1000 / 60 |
37 |
#define FPS_MEASURE_INTERVAL 1000 / 60 |
| 38 |
|
38 |
|
| 39 |
FpsTimer::FpsTimer(QObject* parent) |
39 |
FpsTimer::FpsTimer(QObject* parent) |
| 40 |
: QObject(parent) |
40 |
: QObject(parent) |
|
|
41 |
, m_timer(0) |
| 41 |
{ |
42 |
{ |
| 42 |
} |
43 |
} |
| 43 |
|
44 |
|
| 44 |
int FpsTimer::numFrames(int spanMillis) |
45 |
int FpsTimer::numFrames(int spanMillis) const |
| 45 |
{ |
46 |
{ |
| 46 |
const QTime now = QTime::currentTime(); |
47 |
const QTime now = QTime::currentTime(); |
| 47 |
|
48 |
|
|
Lines 63-75
void FpsTimer::start()
a/WebKitTools/QtTestBrowser/fpstimer.cpp_sec2
|
| 63 |
|
64 |
|
| 64 |
void FpsTimer::stop() |
65 |
void FpsTimer::stop() |
| 65 |
{ |
66 |
{ |
|
|
67 |
if (!m_timer) |
| 68 |
return; |
| 66 |
killTimer(m_timer); |
69 |
killTimer(m_timer); |
| 67 |
m_frames.clear(); |
70 |
m_frames.clear(); |
| 68 |
} |
71 |
} |
| 69 |
|
72 |
|
| 70 |
void FpsTimer::timerEvent(QTimerEvent* event) |
73 |
void FpsTimer::timerEvent(QTimerEvent* event) |
| 71 |
{ |
74 |
{ |
| 72 |
if (event->timerId() != m_timer) |
75 |
if (event->timerId() != m_timer) |
| 73 |
return; |
76 |
return; |
| 74 |
m_frames.append(QTime::currentTime()); |
77 |
m_frames.append(QTime::currentTime()); |
| 75 |
if (m_frames.length() > MAX_FRAMES_SAVED) |
78 |
if (m_frames.length() > MAX_FRAMES_SAVED) |