huge optimization to timeline header drawing

This commit is contained in:
itsmattkc
2019-01-21 12:19:37 +11:00
parent d00ad46f26
commit 22791f16ba
+3 -2
View File
@@ -320,7 +320,6 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
int textWidth = 0;
int lastTextBoundary = INT_MIN;
int i = 0;
int lastLineX = INT_MIN;
int sublineCount = 1;
@@ -337,6 +336,9 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
int text_x, fullTextWidth;
QString timecode;
// find where to start drawing lines (lineX algorithm reversed if lineX = 0)
int i = qFloor(double(scroll)/zoom/interval);
while (true) {
long frame = qRound(interval*i);
int lineX = qRound(frame*zoom) - scroll;
@@ -375,7 +377,6 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
lastLineX = lineX;
}
// TODO wastes cycles here, could just bring it up to 0
i++;
}