Timeline: Drop TimelineItemsGeometry::allocatedVertices

Change-Id: Ibb4757cb159856c81c0c7f5f6a8138a61899b06f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Ulf Hermann
2016-05-04 16:24:00 +02:00
parent 9e66ce48e4
commit 26659b48ba

View File

@@ -61,18 +61,15 @@ struct TimelineItemsGeometry {
// Alternating nodes with with 7 and 4 vertices; and vertex indices are 16bit // Alternating nodes with with 7 and 4 vertices; and vertex indices are 16bit
static const int maxEventsPerNode = 0xffff * 2 / (7 + 4); static const int maxEventsPerNode = 0xffff * 2 / (7 + 4);
TimelineItemsGeometry() : allocatedVertices(0), usedVertices(0), node(0) { TimelineItemsGeometry() : usedVertices(0), node(0)
{
prevNode.set(0, TimelineModel::defaultRowHeight(), 0, 0, 0, 0, 0, 0); prevNode.set(0, TimelineModel::defaultRowHeight(), 0, 0, 0, 0, 0, 0);
} }
uint allocatedVertices;
uint usedVertices; uint usedVertices;
OpaqueColoredPoint2DWithSize prevNode; OpaqueColoredPoint2DWithSize prevNode;
QSGGeometryNode *node; QSGGeometryNode *node;
void allocate(QSGMaterial *material); void allocate(QSGMaterial *material);
void addVertices(float itemTop); void addVertices(float itemTop);
void addEvent(float itemLeft, float itemTop, float itemWidth, float selectionId, uchar red, void addEvent(float itemLeft, float itemTop, float itemWidth, float selectionId, uchar red,
@@ -167,7 +164,6 @@ void TimelineItemsGeometry::allocate(QSGMaterial *material)
node->setGeometry(geometry); node->setGeometry(geometry);
node->setFlag(QSGNode::OwnsGeometry, true); node->setFlag(QSGNode::OwnsGeometry, true);
node->setMaterial(material); node->setMaterial(material);
allocatedVertices = usedVertices;
usedVertices = 0; usedVertices = 0;
prevNode.set(0, TimelineModel::defaultRowHeight(), 0, 0, 0, 0, 0, 0); prevNode.set(0, TimelineModel::defaultRowHeight(), 0, 0, 0, 0, 0, 0);
} }
@@ -211,8 +207,7 @@ static void updateNodes(int from, int to, const TimelineModel *model,
for (int i = 0; i < model->expandedRowCount(); ++i) { for (int i = 0; i < model->expandedRowCount(); ++i) {
TimelineItemsGeometry &row = expandedPerRow[i]; TimelineItemsGeometry &row = expandedPerRow[i];
if (row.usedVertices > 0) { if (row.usedVertices > 0) {
row.allocate(&static_cast<TimelineExpandedRowNode *>( row.allocate(&static_cast<TimelineExpandedRowNode *>(state->expandedRow(i))->material);
state->expandedRow(i))->material);
state->expandedRow(i)->appendChildNode(row.node); state->expandedRow(i)->appendChildNode(row.node);
} }
} }