improved waveform drawing code for high and very high detail when zoomed in