Commit dcb14c4b authored by Ulf Hermann's avatar Ulf Hermann
Browse files

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: default avatarKai Koehne <kai.koehne@digia.com>
parent 342cb69d
...@@ -32,8 +32,6 @@ ...@@ -32,8 +32,6 @@
namespace QmlProfiler { namespace QmlProfiler {
static const int DefaultRowHeight = 30;
AbstractTimelineModel::AbstractTimelineModel(AbstractTimelineModelPrivate *dd, AbstractTimelineModel::AbstractTimelineModel(AbstractTimelineModelPrivate *dd,
const QString &name, const QString &label, QmlDebug::Message message, const QString &name, const QString &label, QmlDebug::Message message,
QmlDebug::RangeType rangeType, QObject *parent) : QmlDebug::RangeType rangeType, QObject *parent) :
......
...@@ -101,6 +101,8 @@ signals: ...@@ -101,6 +101,8 @@ signals:
void rowHeightChanged(); void rowHeightChanged();
protected: protected:
static const int DefaultRowHeight = 30;
enum BoxColorProperties { enum BoxColorProperties {
EventHueMultiplier = 25, EventHueMultiplier = 25,
FractionHueMultiplier = 96, FractionHueMultiplier = 96,
......
...@@ -55,6 +55,7 @@ public: ...@@ -55,6 +55,7 @@ public:
int maxGuiThreadAnimations; int maxGuiThreadAnimations;
int maxRenderThreadAnimations; int maxRenderThreadAnimations;
bool seenForeignPaintEvent; bool seenForeignPaintEvent;
int rowFromThreadId(QmlDebug::AnimationThread threadId) const;
private: private:
Q_DECLARE_PUBLIC(PaintEventsModelProxy) Q_DECLARE_PUBLIC(PaintEventsModelProxy)
...@@ -160,11 +161,16 @@ int PaintEventsModelProxy::rowCount() const ...@@ -160,11 +161,16 @@ int PaintEventsModelProxy::rowCount() const
return (d->maxGuiThreadAnimations == 0 || d->maxRenderThreadAnimations == 0) ? 2 : 3; 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 int PaintEventsModelProxy::getEventRow(int index) const
{ {
Q_D(const PaintEventsModelProxy); Q_D(const PaintEventsModelProxy);
QmlDebug::AnimationThread threadId = d->range(index).threadId; return d->rowFromThreadId(d->range(index).threadId);
return (threadId == QmlDebug::GuiThread || d->maxGuiThreadAnimations == 0) ? 1 : 2;
} }
int PaintEventsModelProxy::rowMaxValue(int rowNumber) const int PaintEventsModelProxy::rowMaxValue(int rowNumber) const
...@@ -202,8 +208,15 @@ float PaintEventsModelProxy::getHeight(int index) const ...@@ -202,8 +208,15 @@ float PaintEventsModelProxy::getHeight(int index) const
{ {
Q_D(const PaintEventsModelProxy); Q_D(const PaintEventsModelProxy);
const PaintEventsModelProxyPrivate::Range &range = d->range(index); 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 const QVariantList PaintEventsModelProxy::getLabels() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment