mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile/profile: add elapsed time reporting for profile rendering
In verbose mode we log how long it took us to render the profile. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f277b525c3
commit
31afa976f3
1 changed files with 7 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
||||||
#include "core/metrics.h"
|
#include "core/metrics.h"
|
||||||
#include <QTransform>
|
#include <QTransform>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
QMLProfile::QMLProfile(QQuickItem *parent) :
|
QMLProfile::QMLProfile(QQuickItem *parent) :
|
||||||
QQuickPaintedItem(parent),
|
QQuickPaintedItem(parent),
|
||||||
|
@ -23,6 +24,10 @@ QMLProfile::QMLProfile(QQuickItem *parent) :
|
||||||
|
|
||||||
void QMLProfile::paint(QPainter *painter)
|
void QMLProfile::paint(QPainter *painter)
|
||||||
{
|
{
|
||||||
|
QElapsedTimer timer;
|
||||||
|
if (verbose)
|
||||||
|
timer.start();
|
||||||
|
|
||||||
// let's look at the intended size of the content and scale our scene accordingly
|
// let's look at the intended size of the content and scale our scene accordingly
|
||||||
QRect painterRect = painter->viewport();
|
QRect painterRect = painter->viewport();
|
||||||
QRect profileRect = m_profileWidget->viewport()->rect();
|
QRect profileRect = m_profileWidget->viewport()->rect();
|
||||||
|
@ -73,6 +78,8 @@ void QMLProfile::paint(QPainter *painter)
|
||||||
|
|
||||||
// finally, render the profile
|
// finally, render the profile
|
||||||
m_profileWidget->render(painter);
|
m_profileWidget->render(painter);
|
||||||
|
if (verbose)
|
||||||
|
qDebug() << "finished rendering profile in" << timer.elapsed() << "ms";
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMLProfile::setMargin(int margin)
|
void QMLProfile::setMargin(int margin)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue