drawVerticalLine enhancement request


#1

I just discovered Graphics::drawVerticalLine() asserts if the first y coordinate is greater than the second.

Thus:
g.drawVerticalLine(theRight, theTop, theTop + theOffset); //fine
g.drawVerticalLine(theRight, theTop+theOffset, theTop); //crash

This is because
LowLevelGraphicsSoftwareRenderer::clippedDrawVerticalLine() has the assert
jassert (top <= bottom);

It’s not a biggie, but it might be nice if drawVerticalLine would check, and flip the endpoints if needed.


#2

Adding that extra branching in drawVerticalLine may be small but WILL slow things down for code that does not need to flip. There may be an argument for an extra function (e.g., drawVerticalLineChecked…?) but flipping it mannually is pretty trivial.


#3

Yeah, the method is designed for drawing things like waveforms, so needs to go as fast as possible, which is why it’s the caller’s responsibility to provide valid input. But I will double-check that the comments make it clear about those requirements…