[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59686] trunk/blender/source/blender/ editors/space_text: text drawing glitche - highlight line was offset slightly from selection.

Campbell Barton ideasman42 at gmail.com
Sat Aug 31 07:00:41 CEST 2013


Revision: 59686
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59686
Author:   campbellbarton
Date:     2013-08-31 05:00:40 +0000 (Sat, 31 Aug 2013)
Log Message:
-----------
text drawing glitche - highlight line was offset slightly from selection.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_text/text_draw.c
    trunk/blender/source/blender/editors/space_text/text_intern.h

Modified: trunk/blender/source/blender/editors/space_text/text_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_draw.c	2013-08-31 04:22:55 UTC (rev 59685)
+++ trunk/blender/source/blender/editors/space_text/text_draw.c	2013-08-31 05:00:40 UTC (rev 59686)
@@ -1133,23 +1133,23 @@
 
 			wrap_offset_in_line(st, ar, text->sell, text->selc, &offl, &offc);
 
-			y1 = ar->winy - 2 - (vsell - offl) * lheight;
-			y2 = y1 - (lheight * visible_lines + TXT_LINE_SPACING);
+			y1 = ar->winy - (vsell - offl) * lheight;
+			y2 = y1 - (lheight * visible_lines);
 		}
 		else {
-			y1 = ar->winy - 2 - vsell * lheight;
-			y2 = y1 - (lheight + TXT_LINE_SPACING);
+			y1 = ar->winy - vsell * lheight;
+			y2 = y1 - (lheight);
 		}
 
 		if (!(y1 < 0 || y2 > ar->winy)) { /* check we need to draw */
-			x1 = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
+			x1 = 0; // st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
 			x2 = x1 + ar->winx;
 
 			glColor4ub(255, 255, 255, 32);
 			
 			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 			glEnable(GL_BLEND);
-			glRecti(x1 - 4, y1, x2, y2 + TXT_LINE_SPACING);
+			glRecti(x1 - 4, y1, x2, y2);
 			glDisable(GL_BLEND);
 		}
 	}
@@ -1317,15 +1317,13 @@
 	int wraplinecount = 0, wrap_skip = 0;
 	int margin_column_x;
 
-	/* dpi controlled line height and font size */
-	st->lheight_dpi = (U.widget_unit * st->lheight) / 20;
-	
-	if (st->lheight_dpi) st->viewlines = (int)ar->winy / (st->lheight_dpi + TXT_LINE_SPACING);
-	else st->viewlines = 0;
-
 	/* if no text, nothing to do */
 	if (!text)
 		return;
+
+	/* dpi controlled line height and font size */
+	st->lheight_dpi = (U.widget_unit * st->lheight) / 20;
+	st->viewlines = (st->lheight_dpi) ? (int)ar->winy / (st->lheight_dpi + TXT_LINE_SPACING) : 0;
 	
 	text_update_drawcache(st, ar);
 

Modified: trunk/blender/source/blender/editors/space_text/text_intern.h
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_intern.h	2013-08-31 04:22:55 UTC (rev 59685)
+++ trunk/blender/source/blender/editors/space_text/text_intern.h	2013-08-31 05:00:40 UTC (rev 59686)
@@ -54,7 +54,7 @@
 void text_update_cursor_moved(struct bContext *C);
 
 	/* TXT_OFFSET used to be 35 when the scrollbar was on the left... */
-#define TXT_OFFSET			((int)(0.75f * U.widget_unit))
+#define TXT_OFFSET			((int)(0.2f * U.widget_unit))
 #define TXT_SCROLL_WIDTH	U.widget_unit
 #define TXT_SCROLL_SPACE	((int)(0.1f * U.widget_unit))
 #define TXT_LINE_SPACING	((int)(0.2f * U.widget_unit)) /* space between lines */




More information about the Bf-blender-cvs mailing list