[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34502] trunk/blender/source/blender/ editors: Bugfix #25756

Ton Roosendaal ton at blender.org
Wed Jan 26 13:26:45 CET 2011


Revision: 34502
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34502
Author:   ton
Date:     2011-01-26 12:26:44 +0000 (Wed, 26 Jan 2011)
Log Message:
-----------
Bugfix #25756

Outliner was drawing icons sometimes blurred. Happens when subpixel
positions vary. UI code doesn't suffer this, it makes own ortho for
it.

This fix re-uses an un-used v2d flag (V2D_PIXELOFS_X) to force a 2d
view on pixel exact positions. It's set for outliner only, I need
testing feedback first.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/view2d.c
    trunk/blender/source/blender/editors/space_outliner/outliner.c

Modified: trunk/blender/source/blender/editors/interface/view2d.c
===================================================================
--- trunk/blender/source/blender/editors/interface/view2d.c	2011-01-26 12:23:02 UTC (rev 34501)
+++ trunk/blender/source/blender/editors/interface/view2d.c	2011-01-26 12:26:44 UTC (rev 34502)
@@ -255,8 +255,6 @@
 				/* absolutely no scrollers allowed */
 				v2d->scroll= 0;
 				
-				/* pixel offsets need to be applied for smooth UI controls */
-				v2d->flag |= (V2D_PIXELOFS_X|V2D_PIXELOFS_Y);
 			}
 				break;
 			
@@ -980,10 +978,6 @@
 	/* pixel offsets (-0.375f) are needed to get 1:1 correspondance with pixels for smooth UI drawing, 
 	 * but only applied where requsted
 	 */
-	/* XXX ton: fix this! */
-	xofs= 0.0; // (v2d->flag & V2D_PIXELOFS_X) ? 0.375f : 0.0f;
-	yofs= 0.0; // (v2d->flag & V2D_PIXELOFS_Y) ? 0.375f : 0.0f;
-
 	/* XXX brecht: instead of zero at least use a tiny offset, otherwise
 	 * pixel rounding is effectively random due to float inaccuracy */
 	xofs= 0.001f*(v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin);
@@ -992,6 +986,19 @@
 	/* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */
 	view2d_map_cur_using_mask(v2d, &curmasked);
 	
+	curmasked.xmin-= xofs; curmasked.xmax-=xofs;
+	curmasked.ymin-= yofs; curmasked.ymax-=yofs;
+	
+	/* XXX ton: this flag set by outliner, for icons */
+	if(v2d->flag & V2D_PIXELOFS_X) {
+		curmasked.xmin= floor(curmasked.xmin) + 0.375f;
+		curmasked.xmax= floor(curmasked.xmax) + 0.375f;
+	}
+	if(v2d->flag & V2D_PIXELOFS_Y) {
+		curmasked.ymin= floor(curmasked.ymin) + 0.375f;
+		curmasked.ymax= floor(curmasked.ymax) + 0.375f;
+	}
+	
 	/* set matrix on all appropriate axes */
 	wmOrtho2(curmasked.xmin-xofs, curmasked.xmax-xofs, curmasked.ymin-yofs, curmasked.ymax-yofs);
 	

Modified: trunk/blender/source/blender/editors/space_outliner/outliner.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner.c	2011-01-26 12:23:02 UTC (rev 34501)
+++ trunk/blender/source/blender/editors/space_outliner/outliner.c	2011-01-26 12:26:44 UTC (rev 34502)
@@ -5718,6 +5718,8 @@
 	/* update size of tot-rect (extents of data/viewable area) */
 	UI_view2d_totRect_set(v2d, sizex, sizey);
 
+	/* force display to pixel coords */
+	v2d->flag |= (V2D_PIXELOFS_X|V2D_PIXELOFS_Y);
 	/* set matrix for 2d-view controls */
 	UI_view2d_view_ortho(v2d);
 




More information about the Bf-blender-cvs mailing list