Ignore:
Timestamp:
Mar 8, 2010, 12:52:58 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.2 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/tools/qttracereplay/main.cpp

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    5353
    5454    void paintEvent(QPaintEvent *event);
     55    void resizeEvent(QResizeEvent *event);
    5556
    5657public slots:
     
    6566    QTime timer;
    6667
     68    QList<uint> visibleUpdates;
    6769    QList<uint> iterationTimes;
    6870    QString filename;
     
    7173void ReplayWidget::updateRect()
    7274{
    73     if (!updates.isEmpty())
    74         update(updates.at(currentFrame));
     75    if (!visibleUpdates.isEmpty())
     76        update(updates.at(visibleUpdates.at(currentFrame)));
    7577}
    7678
     
    8183//    p.setClipRegion(frames.at(currentFrame).updateRegion);
    8284
    83     buffer.draw(&p, currentFrame);
     85    buffer.draw(&p, visibleUpdates.at(currentFrame));
    8486
    8587    ++currentFrame;
    86     if (currentFrame >= buffer.numFrames()) {
     88    if (currentFrame >= visibleUpdates.size()) {
    8789        currentFrame = 0;
    8890        ++currentIteration;
     
    120122                if (iterationTimes.size() >= 10 || stddev < 4) {
    121123                    printf("%s, iterations: %d, frames: %d, min(ms): %d, median(ms): %d, stddev: %f %%, max(fps): %f\n", qPrintable(filename),
    122                             iterationTimes.size(), updates.size(), min, median, stddev, 1000. * updates.size() / min);
     124                            iterationTimes.size(), visibleUpdates.size(), min, median, stddev, 1000. * visibleUpdates.size() / min);
    123125                    deleteLater();
    124126                    return;
     
    131133}
    132134
     135void ReplayWidget::resizeEvent(QResizeEvent *event)
     136{
     137    visibleUpdates.clear();
     138
     139    QRect bounds = rect();
     140    for (int i = 0; i < updates.size(); ++i) {
     141        if (updates.at(i).intersects(bounds))
     142            visibleUpdates << i;
     143    }
     144
     145    if (visibleUpdates.size() != updates.size())
     146        printf("Warning: skipped %d frames due to limited resolution\n", updates.size() - visibleUpdates.size());
     147
     148}
     149
    133150ReplayWidget::ReplayWidget(const QString &filename_)
    134151    : currentFrame(0)
     
    139156    QFile file(filename);
    140157
    141     QRect bounds;
    142158    if (!file.open(QIODevice::ReadOnly)) {
    143159        printf("Failed to load input file '%s'\n", qPrintable(filename_));
Note: See TracChangeset for help on using the changeset viewer.