From 66bf9cc8470a5df6dec7a39508b79ce7c3864f24 Mon Sep 17 00:00:00 2001 From: Ryan Lucia Date: Thu, 8 Oct 2026 13:25:50 -0700 Subject: [PATCH] Fix LayoutResY when resampling with vertical borders When adding or removing borders on a script that has a LayoutRes, the new LayoutResY was scaled by the top and bottom margins relative to the source width instead of the source height, giving the wrong LayoutResY whenever the margins were vertical. Introduced in 9f984395f. Co-Authored-By: Claude Opus 5.5 --- src/resolution_resampler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resolution_resampler.cpp b/src/resolution_resampler.cpp index 9382f764d9..9036bae2b5 100644 --- a/src/resolution_resampler.cpp +++ b/src/resolution_resampler.cpp @@ -241,7 +241,7 @@ void ResampleResolution(AssFile *ass, ResampleSettings settings) { ass->GetLayoutResolution(lrx, lry); if (lrx != 0 && lry != 0) { - new_lry = lry + std::round(lry * (settings.margin[TOP] + settings.margin[BOTTOM]) / double(settings.source_x)); + new_lry = lry + std::round(lry * (settings.margin[TOP] + settings.margin[BOTTOM]) / double(settings.source_y)); new_lrx = std::round(lrx * (double(new_lry) / double(lry)) * (double(settings.dest_x) / double(settings.dest_y)) / (double(settings.source_x) / double(settings.source_y))); }