From 940ad69884b42d496170b261bd388d6bbd58760c Mon Sep 17 00:00:00 2001 From: Robert Flack Date: Sun, 14 Apr 2024 11:10:51 -0400 Subject: [PATCH] Increase overdraw amount used by SDL_RenderCopyF Increasing the overdraw amount seems to help eliminate those single pixel gaps between adjacent tiles. Fixes #2403. --- CorsixTH/Src/th_gfx_sdl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CorsixTH/Src/th_gfx_sdl.cpp b/CorsixTH/Src/th_gfx_sdl.cpp index 7d3561797..6a7ffdc42 100644 --- a/CorsixTH/Src/th_gfx_sdl.cpp +++ b/CorsixTH/Src/th_gfx_sdl.cpp @@ -43,7 +43,7 @@ SOFTWARE. #if SDL_VERSION_ATLEAST(2, 0, 10) //! How much to overdraw scaled sprites to ensure no gaps are visible. -const float frect_overdraw = 0.002f; +const float frect_overdraw = 0.01f; #define SDL_FRECT_UNIT float #else @@ -183,8 +183,8 @@ void getScaleRect(const SDL_Rect* rect, double scale_factor, // on scaled rendering. dst_rect->x = static_cast(rect->x * scale_factor) - frect_overdraw; dst_rect->y = static_cast(rect->y * scale_factor) - frect_overdraw; - dst_rect->w = static_cast(rect->w * scale_factor) + frect_overdraw; - dst_rect->h = static_cast(rect->h * scale_factor) + frect_overdraw; + dst_rect->w = static_cast(rect->w * scale_factor) + 2 * frect_overdraw; + dst_rect->h = static_cast(rect->h * scale_factor) + 2 * frect_overdraw; #else // Prior to SDL 2.0.10, fallback to using the enclosing integer SDL_Rect for // scaled rendering.