From b45bb966df9c89e7611057fa4ebf7d663254092b Mon Sep 17 00:00:00 2001 From: Wolfvak Date: Mon, 27 May 2019 14:41:17 -0300 Subject: [PATCH] fixed an off by one error in the UI code that caused all rectangles to be drawn one pixel lower than indicated --- arm9/source/common/ui.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arm9/source/common/ui.c b/arm9/source/common/ui.c index 4a8db7d..9440878 100644 --- a/arm9/source/common/ui.c +++ b/arm9/source/common/ui.c @@ -27,7 +27,6 @@ static u8 font_bin[FONT_MAX_HEIGHT * 256]; #define PIXEL_OFFSET(x, y) (((x) * SCREEN_HEIGHT) + (SCREEN_HEIGHT - (y) - 1)) - u8* GetFontFromPbm(const void* pbm, const u32 pbm_size, u32* w, u32* h) { char* hdr = (char*) pbm; u32 hdr_max_size = min(512, pbm_size); @@ -163,7 +162,7 @@ void DrawPixel(u16 *screen, int x, int y, u32 color) void DrawRectangle(u16 *screen, int x, int y, u32 width, u32 height, u32 color) { - screen += PIXEL_OFFSET(x, y) - height; + screen += PIXEL_OFFSET(x, y) - height + 1; while(width--) { for (u32 h = 0; h < height; h++) screen[h] = color;