From 47f319eb6e386e5f03c09de4eafe0c2fe4574407 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 12 Aug 2010 14:49:08 +0000 Subject: text editor, only draw line highlight when its in the view. --- source/blender/editors/space_text/text_draw.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'source/blender/editors/space_text/text_draw.c') diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 6fbfc463c45..a8335399a50 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1102,17 +1102,19 @@ static void draw_cursor(SpaceText *st, ARegion *ar) } if(st->line_hlight) { - /* TODO, dont draw if hidden */ - int x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; - int x2= x1 + ar->winx; y= ar->winy-2 - vsell*st->lheight; - - glColor4ub(255, 255, 255, 32); - - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glRecti(x1, y, x2, y-st->lheight+1); - glDisable(GL_BLEND); + if(!(y<0 || y > ar->winy)) { /* check we need to draw */ + int x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET; + int x2= x1 + ar->winx; + y= ar->winy-2 - vsell*st->lheight; + + glColor4ub(255, 255, 255, 32); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glRecti(x1-4, y, x2, y-st->lheight+1); + glDisable(GL_BLEND); + } } if(!hidden) { -- cgit v1.2.3