# HG changeset patch # User Chris Cannam # Date 1394099016 0 # Node ID 88a16eed33387f5a85b904a0f3ad92f19557cc19 # Parent 25b3d5802e6ed0003a5353623543b1eec67d1367 Short-circuit test for enough space for label -- drastically reduces lag on os/x with qt4 diff -r 25b3d5802e6e -r 88a16eed3338 layer/TimeValueLayer.cpp --- a/layer/TimeValueLayer.cpp Tue Mar 04 15:32:28 2014 +0000 +++ b/layer/TimeValueLayer.cpp Thu Mar 06 09:43:36 2014 +0000 @@ -1177,7 +1177,10 @@ } if (label != "") { - bool haveRoom = nx > x + 6 + paint.fontMetrics().width(label); + // Quick test for 20px before we do the slower test using metrics + bool haveRoom = (nx > x + 20); + haveRoom = (haveRoom && + (nx > x + 6 + paint.fontMetrics().width(label))); if (haveRoom || (!haveNext && (pointCount == 0 || !italic))) {