comparison layer/TimeValueLayer.cpp @ 736:88a16eed3338

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:36 +0000
parents 084f65094203
children b6dc57688c72
comparison
equal deleted inserted replaced
729:25b3d5802e6e 736:88a16eed3338
1175 label = lc; 1175 label = lc;
1176 italic = true; 1176 italic = true;
1177 } 1177 }
1178 1178
1179 if (label != "") { 1179 if (label != "") {
1180 bool haveRoom = nx > x + 6 + paint.fontMetrics().width(label); 1180 // Quick test for 20px before we do the slower test using metrics
1181 bool haveRoom = (nx > x + 20);
1182 haveRoom = (haveRoom &&
1183 (nx > x + 6 + paint.fontMetrics().width(label)));
1181 if (haveRoom || 1184 if (haveRoom ||
1182 (!haveNext && 1185 (!haveNext &&
1183 (pointCount == 0 || !italic))) { 1186 (pointCount == 0 || !italic))) {
1184 v->drawVisibleText(paint, x + 5, textY, label, 1187 v->drawVisibleText(paint, x + 5, textY, label,
1185 italic ? 1188 italic ?