While working on a piano roll application, I noticed that dashed line drawing is making repaints very slow, confirmed on both Linux and Windows, software/OpenGL renderer.
To give a bit more context, the application draws a bunch of vertical dashed lines at a fixed interval to mark every 1/8 of a beat; and when maximized the window holds about up to 300 such dashed lines. Scrolling becomes noticeably slow when it goes above somewhere around 100 lines.
Using drawLine instead of drawDashedLine significantly improves the performance, though that’s not precisely the kind of effect I want. So I spent a bit of time digging into the JUCE codes and found that drawDashLine actually breaks each dashed line down into some a hundred mini drawLines.
I wonder if there’s any smarter/faster way to draw dashed lines?