# HG changeset patch # User Chris Cannam # Date 1394098998 0 # Node ID 1640a7c753cc8e85eea64286d7f5d218b6795d21 # Parent 4ce1dbeaf9ab7a3c42604f8ba33a87ff4702409c Short-circuit test for enough space for label -- drastically reduces lag on os/x with qt4 diff -r 4ce1dbeaf9ab -r 1640a7c753cc layer/TimeValueLayer.cpp --- a/layer/TimeValueLayer.cpp Wed Mar 05 18:10:33 2014 +0000 +++ b/layer/TimeValueLayer.cpp Thu Mar 06 09:43:18 2014 +0000 @@ -1184,7 +1184,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))) {