diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-01 13:57:38 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-01 13:57:38 (GMT) |
commit | 5067683704580fcfedef4e68f19acedb133936e8 (patch) | |
tree | 9ed5acfa397b093fd726742ae3c478c2f21223bc /tools/qttracereplay | |
parent | 1b4bb02fcb3da77ddfa6281365ba3210aab9daad (diff) | |
parent | 11d2c8f96697adc93ccd82e3db1de6ecde025eff (diff) | |
download | Qt-5067683704580fcfedef4e68f19acedb133936e8.zip Qt-5067683704580fcfedef4e68f19acedb133936e8.tar.gz Qt-5067683704580fcfedef4e68f19acedb133936e8.tar.bz2 |
Merge branch 'qt-master-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration into master-integration
* 'qt-master-from-4.6' of scm.dev.nokia.troll.no:qt/qt-integration: (160 commits)
audiodevices example: no devices available
Assistant: Fix unintended tr context change.
Add QFontMetrics benchmark.
Fixed `make test' for xmlpatternsxqts.
Doc: Put the correct images with the D-Bus and Embedded Linux sections.
Call cheaper clear() instead of assigning new QString()
Fix a regression: icons with slightly wrong ICO header did not load.
Fix some foreach usage to use const refs
Designer: Fix source code scanning issues.
googlesuggest example: Add newline to end of file
Core classes, examples, demos: Some changes from string to char
Fix header labels on mac with rtl
Fixed an endless loop if printing web pages.
doc: Fixed the last qdoc errors.
don't build unneeded QtDesigner parts on Windows CE
doc: Document the "Type" enum value as a const in variable.
Add additional text and painting benchmarks.
Better support for user-generated binary shaders
don't falsely complain about mismatched codecfortr
Fix QSettings default paths not being initialized when setPath() is called
...
Diffstat (limited to 'tools/qttracereplay')
-rw-r--r-- | tools/qttracereplay/main.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/tools/qttracereplay/main.cpp b/tools/qttracereplay/main.cpp index 85e9b12..a932d72 100644 --- a/tools/qttracereplay/main.cpp +++ b/tools/qttracereplay/main.cpp @@ -52,6 +52,7 @@ public: ReplayWidget(const QString &filename); void paintEvent(QPaintEvent *event); + void resizeEvent(QResizeEvent *event); public slots: void updateRect(); @@ -64,14 +65,15 @@ public: int currentIteration; QTime timer; + QList<uint> visibleUpdates; QList<uint> iterationTimes; QString filename; }; void ReplayWidget::updateRect() { - if (!updates.isEmpty()) - update(updates.at(currentFrame)); + if (!visibleUpdates.isEmpty()) + update(updates.at(visibleUpdates.at(currentFrame))); } void ReplayWidget::paintEvent(QPaintEvent *) @@ -80,10 +82,10 @@ void ReplayWidget::paintEvent(QPaintEvent *) // p.setClipRegion(frames.at(currentFrame).updateRegion); - buffer.draw(&p, currentFrame); + buffer.draw(&p, visibleUpdates.at(currentFrame)); ++currentFrame; - if (currentFrame >= buffer.numFrames()) { + if (currentFrame >= visibleUpdates.size()) { currentFrame = 0; ++currentIteration; @@ -119,7 +121,7 @@ void ReplayWidget::paintEvent(QPaintEvent *) if (iterationTimes.size() >= 10 || stddev < 4) { printf("%s, iterations: %d, frames: %d, min(ms): %d, median(ms): %d, stddev: %f %%, max(fps): %f\n", qPrintable(filename), - iterationTimes.size(), updates.size(), min, median, stddev, 1000. * updates.size() / min); + iterationTimes.size(), visibleUpdates.size(), min, median, stddev, 1000. * visibleUpdates.size() / min); deleteLater(); return; } @@ -130,6 +132,21 @@ void ReplayWidget::paintEvent(QPaintEvent *) QTimer::singleShot(0, this, SLOT(updateRect())); } +void ReplayWidget::resizeEvent(QResizeEvent *event) +{ + visibleUpdates.clear(); + + QRect bounds = rect(); + for (int i = 0; i < updates.size(); ++i) { + if (updates.at(i).intersects(bounds)) + visibleUpdates << i; + } + + if (visibleUpdates.size() != updates.size()) + printf("Warning: skipped %d frames due to limited resolution\n", updates.size() - visibleUpdates.size()); + +} + ReplayWidget::ReplayWidget(const QString &filename_) : currentFrame(0) , currentIteration(0) @@ -138,7 +155,6 @@ ReplayWidget::ReplayWidget(const QString &filename_) setWindowTitle(filename); QFile file(filename); - QRect bounds; if (!file.open(QIODevice::ReadOnly)) { printf("Failed to load input file '%s'\n", qPrintable(filename_)); return; |