forked from qt-creator/qt-creator
Boost small paint events a little when no scale is shown
Like this you can see if the frame rate is low, even if there aren't many animations. Change-Id: Ib9c759278d4c5e7e4bff94737e2ced87791f2e4b Task-number: QTCREATORBUG-12589 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -32,8 +32,6 @@
|
||||
|
||||
namespace QmlProfiler {
|
||||
|
||||
static const int DefaultRowHeight = 30;
|
||||
|
||||
AbstractTimelineModel::AbstractTimelineModel(AbstractTimelineModelPrivate *dd,
|
||||
const QString &name, const QString &label, QmlDebug::Message message,
|
||||
QmlDebug::RangeType rangeType, QObject *parent) :
|
||||
|
||||
@@ -101,6 +101,8 @@ signals:
|
||||
void rowHeightChanged();
|
||||
|
||||
protected:
|
||||
static const int DefaultRowHeight = 30;
|
||||
|
||||
enum BoxColorProperties {
|
||||
EventHueMultiplier = 25,
|
||||
FractionHueMultiplier = 96,
|
||||
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
int maxGuiThreadAnimations;
|
||||
int maxRenderThreadAnimations;
|
||||
bool seenForeignPaintEvent;
|
||||
int rowFromThreadId(QmlDebug::AnimationThread threadId) const;
|
||||
|
||||
private:
|
||||
Q_DECLARE_PUBLIC(PaintEventsModelProxy)
|
||||
@@ -160,11 +161,16 @@ int PaintEventsModelProxy::rowCount() const
|
||||
return (d->maxGuiThreadAnimations == 0 || d->maxRenderThreadAnimations == 0) ? 2 : 3;
|
||||
}
|
||||
|
||||
int PaintEventsModelProxy::PaintEventsModelProxyPrivate::rowFromThreadId(
|
||||
QmlDebug::AnimationThread threadId) const
|
||||
{
|
||||
return (threadId == QmlDebug::GuiThread || maxGuiThreadAnimations == 0) ? 1 : 2;
|
||||
}
|
||||
|
||||
int PaintEventsModelProxy::getEventRow(int index) const
|
||||
{
|
||||
Q_D(const PaintEventsModelProxy);
|
||||
QmlDebug::AnimationThread threadId = d->range(index).threadId;
|
||||
return (threadId == QmlDebug::GuiThread || d->maxGuiThreadAnimations == 0) ? 1 : 2;
|
||||
return d->rowFromThreadId(d->range(index).threadId);
|
||||
}
|
||||
|
||||
int PaintEventsModelProxy::rowMaxValue(int rowNumber) const
|
||||
@@ -202,8 +208,15 @@ float PaintEventsModelProxy::getHeight(int index) const
|
||||
{
|
||||
Q_D(const PaintEventsModelProxy);
|
||||
const PaintEventsModelProxyPrivate::Range &range = d->range(index);
|
||||
return (float)range.animationcount / (float)(range.threadId == QmlDebug::GuiThread ?
|
||||
d->maxGuiThreadAnimations : d->maxRenderThreadAnimations);
|
||||
|
||||
// Add some height to the events if we're far from the scale threshold of 2 * DefaultRowHeight.
|
||||
// Like that you can see the smaller events more easily.
|
||||
int scaleThreshold = 2 * DefaultRowHeight - rowHeight(d->rowFromThreadId(range.threadId));
|
||||
float boost = scaleThreshold > 0 ? (0.15 * scaleThreshold / DefaultRowHeight) : 0;
|
||||
|
||||
return boost + (1.0 - boost) * (float)range.animationcount /
|
||||
(float)(range.threadId == QmlDebug::GuiThread ? d->maxGuiThreadAnimations :
|
||||
d->maxRenderThreadAnimations);
|
||||
}
|
||||
|
||||
const QVariantList PaintEventsModelProxy::getLabels() const
|
||||
|
||||
Reference in New Issue
Block a user