comparison layer/TimeValueLayer.cpp @ 735:1640a7c753cc tonioni

Short-circuit test for enough space for label -- drastically reduces lag on os/x with qt4
author Chris Cannam
date Thu, 06 Mar 2014 09:43:18 +0000
parents 15b5c679b909
children 56ba2b03508e
comparison
equal deleted inserted replaced
734:4ce1dbeaf9ab 735:1640a7c753cc
1182 label = lc; 1182 label = lc;
1183 italic = true; 1183 italic = true;
1184 } 1184 }
1185 1185
1186 if (label != "") { 1186 if (label != "") {
1187 bool haveRoom = nx > x + 6 + paint.fontMetrics().width(label); 1187 // Quick test for 20px before we do the slower test using metrics
1188 bool haveRoom = (nx > x + 20);
1189 haveRoom = (haveRoom &&
1190 (nx > x + 6 + paint.fontMetrics().width(label)));
1188 if (haveRoom || 1191 if (haveRoom ||
1189 (!haveNext && 1192 (!haveNext &&
1190 (pointCount == 0 || !italic))) { 1193 (pointCount == 0 || !italic))) {
1191 v->drawVisibleText(paint, x + 5, textY, label, 1194 v->drawVisibleText(paint, x + 5, textY, label,
1192 italic ? 1195 italic ?