From e58286276c9107e4c366bd649f2f09eb572b9553 Mon Sep 17 00:00:00 2001 From: "BADIM-PC\\Vadim" Date: Thu, 11 Jan 2018 14:28:46 +0300 Subject: [PATCH] some textri() optimisations --- src/tic.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/tic.c b/src/tic.c index 30853ee..3d25445 100644 --- a/src/tic.c +++ b/src/tic.c @@ -966,7 +966,23 @@ static void ticTexLine(tic_mem* memory, TexVert *v0, TexVert *v1) float y = top->y; float u = top->u; float v = top->v; - for (; y < (s32)bot->y; y++) + + if(y < .0f) + { + y = .0f - y; + + x += step_x * y; + u += step_u * y; + v += step_v * y; + + y = .0f; + } + + s32 botY = bot->y; + if(botY > TIC80_HEIGHT) + botY = TIC80_HEIGHT; + + for (; y < botY; y++) { setSideTexPixel(x, y, u, v); x += step_x;