From 70357a65bf06a25b7ba98c846ee258ac5eccd88b Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 27 Nov 2023 13:29:06 -0800 Subject: [PATCH] Fix regression: Warp BG lerps in reverse direction This fixes a regression caused by PR #923 (the PR that moved rendering to be GPU-based) where the interpolation of the horizontal and vertical warp backgrounds (in over-30-FPS mode) was in the wrong direction, which makes them look blurry. This happens because the arguments to the `lerp` function were in the wrong, reverse order. On the VVVVVV Discord server, Ally raised the argument that they were in the same order before she made the changes; therefore the previous code was also incorrect and it wasn't her fault. However, this argument is incorrect, because in that case, the reverse order _is_ the correct order. The reason that it's now the wrong order is because the output of `lerp` is now being used as the argument to a source rectangle. Previously, the output of `lerp` was being used as the offset argument to `ScrollSurface`, which is analogous to being a destination rectangle. Fixes #1038. --- desktop_version/src/Graphics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index b49bc2af..15992ec0 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -2443,7 +2443,7 @@ void Graphics::drawbackground( int t ) { clear(); - const int offset = (int) lerp(0, -3); + const int offset = (int) lerp(-3, 0); const SDL_Rect srcRect = {8 + offset, 0, SCREEN_WIDTH_PIXELS, SCREEN_HEIGHT_PIXELS}; copy_texture(backgroundTexture, &srcRect, NULL); @@ -2453,7 +2453,7 @@ void Graphics::drawbackground( int t ) { clear(); - const int offset = (int) lerp(0, -3); + const int offset = (int) lerp(-3, 0); const SDL_Rect srcRect = {0, 8 + offset, SCREEN_WIDTH_PIXELS, SCREEN_HEIGHT_PIXELS}; copy_texture(backgroundTexture, &srcRect, NULL);