From 62c924531b1d77fc69ce2a4cf71adbe5e4b9e86b Mon Sep 17 00:00:00 2001 From: "BADIM-PC\\Vadim" Date: Thu, 22 Feb 2018 09:09:56 +0300 Subject: [PATCH] Clipping doesn't work with tri() api #541 --- src/tic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tic.c b/src/tic.c index 16255b9..e092584 100644 --- a/src/tic.c +++ b/src/tic.c @@ -939,8 +939,9 @@ static void api_tri(tic_mem* memory, s32 x1, s32 y1, s32 x2, s32 y2, s32 x3, s32 ticLine(memory, x3, y3, x1, y1, color, triPixelFunc); u8 final_color = mapColor(&machine->memory, color); - s32 yt = max(0, min(y1, min(y2, y3))); - s32 yb = min(TIC80_HEIGHT, max(y1, max(y2, y3)) + 1); + s32 yt = max(machine->state.clip.t, min(y1, min(y2, y3))); + s32 yb = min(machine->state.clip.b, max(y1, max(y2, y3)) + 1); + for(s32 y = yt; y < yb; y++) { s32 xl = max(SidesBuffer.Left[y], machine->state.clip.l); s32 xr = min(SidesBuffer.Right[y]+1, machine->state.clip.r);