From ff510c54c5fcc4088c7a770604c4d74d37d485d2 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 6 Aug 2021 22:40:32 +0200 Subject: [PATCH] Fixed tiled NinePatches missing pixels with some scales --- CHANGELOG.md | 1 + MLEM/Textures/NinePatch.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bca1a6a..00357fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ Improvements Fixes - Set default values for InputHandler held and pressed keys to avoid an exception if buttons are held in the very first frame - Fixed GenericFont MeasureString using incorrect width for Zwsp and OneEmSpace +- Fixed tiled NinePatches missing pixels with some scales ### MLEM.Ui Additions diff --git a/MLEM/Textures/NinePatch.cs b/MLEM/Textures/NinePatch.cs index d08e4c9..18c8645 100644 --- a/MLEM/Textures/NinePatch.cs +++ b/MLEM/Textures/NinePatch.cs @@ -166,7 +166,7 @@ namespace MLEM.Textures { for (var x = 0F; x < rect.Width; x += width) { for (var y = 0F; y < rect.Height; y += height) { var size = new Vector2(Math.Min(rect.Width - x, width), Math.Min(rect.Height - y, height)); - batch.Draw(texture.Region.Texture, new RectangleF(rect.Location + new Vector2(x, y), size), new Rectangle(src.Location, (size / patchScale).ToPoint()), color, rotation, origin, effects, layerDepth); + batch.Draw(texture.Region.Texture, new RectangleF(rect.Location + new Vector2(x, y), size), new Rectangle(src.Location, (size / patchScale).CeilCopy().ToPoint()), color, rotation, origin, effects, layerDepth); } } break;