forked from qt-creator/qt-creator
QmlProfiler: Fix rounding error for items starting outside the screen
Change-Id: I132b7058de9e51f6a1d958594917fc926039a585 Task-number: QTCREATORBUG-12648 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -93,8 +93,12 @@ inline void TimelineRenderer::getItemXExtent(int modelIndex, int i, int ¤t
|
||||
m_spacing, m_spacedDuration)));
|
||||
} else {
|
||||
currentX = -OutOfScreenMargin;
|
||||
itemWidth = qMax(1.0, (qMin((m_profilerModelProxy->getDuration(modelIndex, i) + start) *
|
||||
m_spacing + OutOfScreenMargin, m_spacedDuration)));
|
||||
// Explicitly round the "start" part down, away from 0, to match the implicit rounding of
|
||||
// currentX in the > 0 case. If we don't do that we get glitches where a pixel is added if
|
||||
// the element starts outside the screen and subtracted if it starts inside the screen.
|
||||
itemWidth = qMax(1.0, (qMin(m_profilerModelProxy->getDuration(modelIndex, i) * m_spacing +
|
||||
floor(start * m_spacing) + OutOfScreenMargin,
|
||||
m_spacedDuration)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user