diff --git a/src/render-cg/topti.c b/src/render-cg/topti.c index eedb3b6..49ee6e4 100644 --- a/src/render-cg/topti.c +++ b/src/render-cg/topti.c @@ -59,7 +59,6 @@ static void topti_render(int x, int y, char const *str_char, font_t const *f, /* Vertical clipping */ if(x >= dwindow.right || y >= dwindow.bottom) return; if(y + height <= dwindow.top) return; - height = min(height, dwindow.bottom - y); int top_overflow = y - dwindow.top; if(top_overflow < 0) { @@ -67,6 +66,8 @@ static void topti_render(int x, int y, char const *str_char, font_t const *f, height += top_overflow; y -= top_overflow; } + height = min(height, dwindow.bottom - y); + if(height <= 0) return; /* Move to top row */ uint16_t *target = gint_vram + DWIDTH * y; diff --git a/src/render-fx/topti.c b/src/render-fx/topti.c index 6eb30a0..4dc3dd7 100644 --- a/src/render-fx/topti.c +++ b/src/render-fx/topti.c @@ -109,6 +109,7 @@ void topti_render(int x, int y, char const *str_char, font_t const *f, vdisp = dwindow.top - y; y = dwindow.top; } + if(vdisp >= height) return; uint32_t bg_mask[4]; masks(dwindow.left, dwindow.right, bg_mask);