mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-23 07:58:05 +02:00
Bug1152: fix crash caused by inconsistent criterion for deciding to draw samples
This commit is contained in:
parent
ce07211424
commit
375dea0c36
@ -1795,21 +1795,6 @@ void TrackArtist::DrawClipWaveform(WaveTrack *track,
|
||||
|
||||
const double pps =
|
||||
averagePixelsPerSample * rate;
|
||||
if (!params.showIndividualSamples) {
|
||||
// The WaveClip class handles the details of computing the shape
|
||||
// of the waveform. The only way GetWaveDisplay will fail is if
|
||||
// there's a serious error, like some of the waveform data can't
|
||||
// be loaded. So if the function returns false, we can just exit.
|
||||
|
||||
// Note that we compute the full width display even if there is a
|
||||
// fisheye hiding part of it, because of the caching. If the
|
||||
// fisheye moves over the background, there is then less to do when
|
||||
// redrawing.
|
||||
|
||||
if (!clip->GetWaveDisplay(display,
|
||||
t0, pps, isLoadingOD))
|
||||
return;
|
||||
}
|
||||
|
||||
// For each portion separately, we will decide to draw
|
||||
// it as min/max/rms or as individual samples.
|
||||
@ -1821,6 +1806,32 @@ void TrackArtist::DrawClipWaveform(WaveTrack *track,
|
||||
const double threshold1 = 0.5 * rate;
|
||||
// Require at least 3 pixels per sample for drawing the draggable points.
|
||||
const double threshold2 = 3 * rate;
|
||||
|
||||
{
|
||||
bool showIndividualSamples = false;
|
||||
for (unsigned ii = 0; !showIndividualSamples && ii < nPortions; ++ii) {
|
||||
const WavePortion &portion = portions[ii];
|
||||
showIndividualSamples =
|
||||
!portion.inFisheye && portion.averageZoom > threshold1;
|
||||
}
|
||||
|
||||
if (!showIndividualSamples) {
|
||||
// The WaveClip class handles the details of computing the shape
|
||||
// of the waveform. The only way GetWaveDisplay will fail is if
|
||||
// there's a serious error, like some of the waveform data can't
|
||||
// be loaded. So if the function returns false, we can just exit.
|
||||
|
||||
// Note that we compute the full width display even if there is a
|
||||
// fisheye hiding part of it, because of the caching. If the
|
||||
// fisheye moves over the background, there is then less to do when
|
||||
// redrawing.
|
||||
|
||||
if (!clip->GetWaveDisplay(display,
|
||||
t0, pps, isLoadingOD))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned ii = 0; ii < nPortions; ++ii) {
|
||||
WavePortion &portion = portions[ii];
|
||||
const bool showIndividualSamples = portion.averageZoom > threshold1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user