From 53096517c9e11966691ffcb008f4da0b15926b2e Mon Sep 17 00:00:00 2001 From: Miloslav Ciz Date: Fri, 27 Sep 2024 00:55:30 +0200 Subject: [PATCH] Fix segfault --- frontend_sdl.c | 2 +- renderer.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend_sdl.c b/frontend_sdl.c index 99346f2..5764f1b 100644 --- a/frontend_sdl.c +++ b/frontend_sdl.c @@ -1,7 +1,7 @@ #include #include -#define LCR_SETTING_LOG_LEVEL 5 +#define LCR_SETTING_LOG_LEVEL 0 #include "game.h" #include "debug.h" diff --git a/renderer.h b/renderer.h index 1f19e8b..8194ae8 100644 --- a/renderer.h +++ b/renderer.h @@ -917,7 +917,7 @@ void LCR_rendererDrawRect(int x, int y, unsigned int w, unsigned int h, if (x < 0) { - if (-1 * x > ((int) w)) + if (-1 * x >= ((int) w)) return; w += x; @@ -936,12 +936,13 @@ void LCR_rendererDrawRect(int x, int y, unsigned int w, unsigned int h, y = 0; } - if (y + h > LCR_EFFECTIVE_RESOLUTION_X) + if (y + h > LCR_EFFECTIVE_RESOLUTION_Y) h = LCR_EFFECTIVE_RESOLUTION_Y - y; unsigned long index = y * LCR_EFFECTIVE_RESOLUTION_X + x; - if (dither) +if (0) +// if (dither) { uint8_t parity = (x % 2) == (y % 2);