aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/timeline/timelineitemsrenderpass.cpp
diff options
context:
space:
mode:
authorUlf Hermann <[email protected]>2016-11-08 18:11:36 +0100
committerUlf Hermann <[email protected]>2016-11-09 11:55:02 +0000
commitfaf77fd0e55bbb7a6ef0b36b82023eed587c3b2b (patch)
tree0742c06475a35ebfb294fc5429535fd7e4d97348 /src/libs/timeline/timelineitemsrenderpass.cpp
parentaaca50f705ac8f41f44991478fe11f9eb37fe0bd (diff)
Timeline: Use QRgb and a lookup table for colors
It makes no sense to return a QColor as the only things we are using are the red, green, and blue components. Furthermore, colorFromHue() can only generate 360 different colors which we can easily cache instead of recalculating them on each request. This significantly reduces the time it takes to update the timeline render nodes. Change-Id: I7961014364a1bec5b089285148b2e6c141a6dc7d Reviewed-by: Christian Kandeler <[email protected]>
Diffstat (limited to 'src/libs/timeline/timelineitemsrenderpass.cpp')
-rw-r--r--src/libs/timeline/timelineitemsrenderpass.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libs/timeline/timelineitemsrenderpass.cpp b/src/libs/timeline/timelineitemsrenderpass.cpp
index 32a9af32360..fdcd9ecfc43 100644
--- a/src/libs/timeline/timelineitemsrenderpass.cpp
+++ b/src/libs/timeline/timelineitemsrenderpass.cpp
@@ -707,10 +707,10 @@ int NodeUpdater::updateNodes(const int from, const int to) const
if (start > end)
continue;
- QColor color = m_model->color(i);
- item.red = color.red();
- item.green = color.green();
- item.blue = color.blue();
+ QRgb color = m_model->color(i);
+ item.red = qRed(color);
+ item.green = qGreen(color);
+ item.blue = qBlue(color);
item.width = end > start ? (end - start) * m_parentState->scale() :
std::numeric_limits<float>::min();