Fix: VSE waveform drawing slightly outside strips #123515

Merged
Pablo Vazquez merged 1 commits from aras_p/blender:vse_waveform_tweak into blender-v4.2-release 2024-06-20 22:10:15 +02:00

View File

@ -475,19 +475,20 @@ static void draw_seq_waveform_overlay(TimelineDrawContext *timeline_ctx,
const float frames_per_pixel = BLI_rctf_size_x(&v2d->cur) / timeline_ctx->region->winx;
const float samples_per_frame = SOUND_WAVE_SAMPLES_PER_SECOND / FPS;
const float samples_per_pixel = samples_per_frame * frames_per_pixel;
const float bottom = strip_ctx->bottom + timeline_ctx->pixely * 2.0f;
const float top = strip_ctx->strip_content_top;
/* The y coordinate of signal level zero. */
const float y_zero = half_style ? strip_ctx->bottom :
(strip_ctx->bottom + strip_ctx->strip_content_top) / 2.0f;
const float y_zero = half_style ? bottom : (bottom + top) / 2.0f;
/* The y range of unit signal level. */
const float y_scale = half_style ? strip_ctx->strip_content_top - strip_ctx->bottom :
(strip_ctx->strip_content_top - strip_ctx->bottom) / 2.0f;
const float y_scale = half_style ? top - bottom : (top - bottom) / 2.0f;
/* Align strip start with nearest pixel to prevent waveform flickering. */
const float strip_start_aligned = align_frame_with_pixel(strip_ctx->left_handle,
frames_per_pixel);
const float strip_start_aligned = align_frame_with_pixel(
strip_ctx->left_handle + timeline_ctx->pixelx * 3.0f, frames_per_pixel);
/* Offset x1 and x2 values, to match view min/max, if strip is out of bounds. */
const float draw_start_frame = max_ff(v2d->cur.xmin, strip_start_aligned);
const float draw_end_frame = min_ff(v2d->cur.xmax, strip_ctx->right_handle);
const float draw_end_frame = min_ff(v2d->cur.xmax,
strip_ctx->right_handle - timeline_ctx->pixelx * 3.0f);
/* Offset must be also aligned, otherwise waveform flickers when moving left handle. */
float sample_start_frame = draw_start_frame + seq->sound->offset_time / FPS;