[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11558] trunk/blender/source/blender/src/ editscreen.c: only draw the xor line when the mouse moves (border moving).

Campbell Barton cbarton at metavr.com
Sun Aug 12 10:10:26 CEST 2007


Revision: 11558
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11558
Author:   campbellbarton
Date:     2007-08-12 10:10:26 +0200 (Sun, 12 Aug 2007)

Log Message:
-----------
only draw the xor line when the mouse moves (border moving).
This is the only thing that made software GL unuseable, and would even hang blender when using some debugging tools.
The lag was noticibel on some cheap graphics cards also.

There is a problem with blenders events that means the mouse movement events are sent while the mouse button release event isnt for some time. This could make resizing a border take a fairly long time... 4-10sec.
even though this is a workaround, only redrawing when the mouse is moved is logical.

Modified Paths:
--------------
    trunk/blender/source/blender/src/editscreen.c

Modified: trunk/blender/source/blender/src/editscreen.c
===================================================================
--- trunk/blender/source/blender/src/editscreen.c	2007-08-12 07:30:11 UTC (rev 11557)
+++ trunk/blender/source/blender/src/editscreen.c	2007-08-12 08:10:26 UTC (rev 11558)
@@ -3113,7 +3113,7 @@
 			}
 		}
 		
-		if (first || mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) {
+		if (first || (dir=='v' && mval[0]!=mvalo[0]) || (dir=='h' && mval[1]!=mvalo[1])) {
 			if (!first) {
 				scrarea_draw_splitpoint(sa, dir, fac);
 			}
@@ -3389,7 +3389,7 @@
 {
 	ScrVert *v1;
 	ScrArea *sa;
-	short mvalo[2];
+	short mvalo[2], mval_prev=-1;
 	short edge_start, edge_end, edge_position;
 	short bigger, smaller, headery, areaminy;
 	int delta, doit;
@@ -3478,13 +3478,18 @@
 			short mval[2];
 			
 			getmouseco_sc(mval);
-			
-			draw_front_xor_dirdist_line(dir, edge_position+delta, edge_start, edge_end);
+			if ((dir=='h' && mval_prev != mval[1]) || (dir=='v' && mval_prev != mval[0])) {
+				/* update the previous val with this one for comparison next loop */
+				if (dir=='h')	mval_prev = mval[1];
+				else			mval_prev = mval[0];
+				
+				draw_front_xor_dirdist_line(dir, edge_position+delta, edge_start, edge_end);
 
-			delta= (dir=='h')?(mval[1]-mvalo[1]):(mval[0]-mvalo[0]);
-			delta= CLAMPIS(delta, -smaller, bigger);
-			draw_front_xor_dirdist_line(dir, edge_position+delta, edge_start, edge_end);
-			bglFlush();
+				delta= (dir=='h')?(mval[1]-mvalo[1]):(mval[0]-mvalo[0]);
+				delta= CLAMPIS(delta, -smaller, bigger);
+				draw_front_xor_dirdist_line(dir, edge_position+delta, edge_start, edge_end);
+				bglFlush();
+			}
 		} 
 		else if (event==LEFTMOUSE) {
 			doit= 1;





More information about the Bf-blender-cvs mailing list