From 71c7144aa58e29025c3e4fb5e5ca116a74ca21d3 Mon Sep 17 00:00:00 2001 From: "BADIM-PC\\Vadim" Date: Thu, 21 Dec 2017 00:10:44 +0300 Subject: [PATCH] perf opt don't draw invisible chars in the Code Editor --- src/code.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/code.c b/src/code.c index a6436be..9afcb5c 100644 --- a/src/code.c +++ b/src/code.c @@ -83,14 +83,17 @@ static void drawCode(Code* code, bool withCursor) { char symbol = *pointer; - if(code->cursor.selection && pointer >= selection.start && pointer < selection.end) - code->tic->api.rect(code->tic, x-1, y-1, TIC_FONT_WIDTH+1, TIC_FONT_HEIGHT+1, getConfig()->theme.code.select); - else if(getConfig()->theme.code.shadow) - { - code->tic->api.draw_char(code->tic, symbol, x+1, y+1, 0); - } + if(x >= -TIC_FONT_WIDTH && x < TIC80_WIDTH && y >= -TIC_FONT_HEIGHT && y < TIC80_HEIGHT ) + { + if(code->cursor.selection && pointer >= selection.start && pointer < selection.end) + code->tic->api.rect(code->tic, x-1, y-1, TIC_FONT_WIDTH+1, TIC_FONT_HEIGHT+1, getConfig()->theme.code.select); + else if(getConfig()->theme.code.shadow) + { + code->tic->api.draw_char(code->tic, symbol, x+1, y+1, 0); + } - code->tic->api.draw_char(code->tic, symbol, x, y, *colorPointer); + code->tic->api.draw_char(code->tic, symbol, x, y, *colorPointer); + } if(code->cursor.position == pointer) cursor.x = x, cursor.y = y, cursor.symbol = symbol;