13
0

Fix random off-by-one issue when vertically zooming a waveform

To mitigate concurrent rendering, the waveform cache adds a random
range of pixels centered around the visible waveform.

Alignment is using integer half_width = width_samples / 2;
This always aligns the left-edge to the left-most cairo-pixel.

This fixes an issue with moving moiree patterns in waveforms when
zooming vertically (which invalidates the cache and uses a
different random number of pixels),
This commit is contained in:
Robin Gareus 2019-07-29 03:55:31 +02:00
parent a582b24fcd
commit 7b92f54929
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 3 additions and 3 deletions

View File

@ -1159,8 +1159,8 @@ WaveView::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) cons
double x = self.x0 + image_origin_in_self_coordinates;
double y = self.y0;
context->user_to_device (x, y);
x = round (x);
y = round (y);
x = floor (x);
y = floor (y);
context->device_to_user (x, y);
/* the coordinates specify where in "user coordinates" (i.e. what we

View File

@ -140,7 +140,7 @@ public: // methods
return sample_end - sample_start;
}
samplepos_t get_center_sample ()
samplepos_t get_center_sample () const
{
return sample_start + (get_length_samples() / 2);
}