QmlProfiler: fix issues with animations in the timeline

Change-Id: Ief2351cf7d19f580c08cc557ffa0f5975e918e56
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Christiaan Janssen
2012-01-10 17:31:04 +01:00
parent fea23ff5a1
commit 2ddf2a1d81
2 changed files with 7 additions and 3 deletions

View File

@@ -1360,6 +1360,8 @@ void QmlProfilerEventList::load()
rangedEvent.frameRate = attributes.value("framerate").toString().toInt(); rangedEvent.frameRate = attributes.value("framerate").toString().toInt();
if (attributes.hasAttribute("animationcount")) if (attributes.hasAttribute("animationcount"))
rangedEvent.animationCount = attributes.value("animationcount").toString().toInt(); rangedEvent.animationCount = attributes.value("animationcount").toString().toInt();
else
rangedEvent.animationCount = -1;
if (attributes.hasAttribute("eventIndex")) { if (attributes.hasAttribute("eventIndex")) {
int ndx = attributes.value("eventIndex").toString().toInt(); int ndx = attributes.value("eventIndex").toString().toInt();
if (!descriptionBuffer.value(ndx)) if (!descriptionBuffer.value(ndx))

View File

@@ -145,9 +145,11 @@ void TimelineView::drawItemsToPainter(QPainter *p, int fromIndex, int toIndex)
// special: animations // special: animations
if (eventType == 0 && m_eventList->getAnimationCount(i) >= 0) { if (eventType == 0 && m_eventList->getAnimationCount(i) >= 0) {
double scale = m_eventList->getMaximumAnimationCount() - m_eventList->getMinimumAnimationCount(); double scale = m_eventList->getMaximumAnimationCount() - m_eventList->getMinimumAnimationCount();
if (scale < 1) double fraction;
scale = 1; if (scale > 1)
double fraction = (double)(m_eventList->getAnimationCount(i) - m_eventList->getMinimumAnimationCount()) / scale; fraction = (double)(m_eventList->getAnimationCount(i) - m_eventList->getMinimumAnimationCount()) / scale;
else
fraction = 1.0;
height = DefaultRowHeight * (fraction * 0.85 + 0.15); height = DefaultRowHeight * (fraction * 0.85 + 0.15);
y += DefaultRowHeight - height; y += DefaultRowHeight - height;