From 02b1fedeb12a1280abfa25b55db62fdeb0507da1 Mon Sep 17 00:00:00 2001 From: Misa Date: Fri, 3 Sep 2021 15:04:25 -0700 Subject: [PATCH] drawpixeltextbox: Draw remaining horz/vert tile if non-multiple-8 This draws the remaining horizontal/vertical tile just beside the final corner if the width/height is not a multiple of 8. (It'd be wasteful to draw it if the width/height was a perfect multiple of 8, and result in double-drawing translucent pixels if there were any.) This has an advantage over the previous system of shifting the horizontal/vertical tiling, in that custom corner textures don't look weird due to overlapping like this. Now, custom horizontal/vertical tiles _can_ look weird if they don't completely tile correctly (or if they have translucent pixels), but that's better than mucking up the corners. --- desktop_version/src/Graphics.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index cc1658a3..af435973 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -1302,12 +1302,24 @@ void Graphics::drawpixeltextbox( int x, int y, int w, int h, int w2, int h2, int drawcoloredtile(x + 8 + (k * 8), y + (h) - 8, 46, r, g, b); } + if (w % 8 != 0) + { + drawcoloredtile(x + w - 16, y, 41, r, g, b); + drawcoloredtile(x + w - 16, y + h - 8, 46, r, g, b); + } + for (int k = 0; k < h/8-2; k++) { drawcoloredtile(x, y + 8 + (k * 8), 43, r, g, b); drawcoloredtile(x + (w) - 8, y + 8 + (k * 8), 44, r, g, b); } + if (h % 8 != 0) + { + drawcoloredtile(x, y + h - 16, 43, r, g, b); + drawcoloredtile(x + w - 8, y + h - 16, 44, r, g, b); + } + drawcoloredtile(x, y, 40, r, g, b); drawcoloredtile(x + (w) - 8, y, 42, r, g, b); drawcoloredtile(x, y + (h) - 8, 45, r, g, b);