[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53174] trunk/blender/source/blender/ editors/interface/interface_widgets.c: Icon scaling fix: for zoom levels near 1, icon positions are moved to exact pixel

Ton Roosendaal ton at blender.org
Wed Dec 19 12:55:42 CET 2012


Revision: 53174
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53174
Author:   ton
Date:     2012-12-19 11:55:41 +0000 (Wed, 19 Dec 2012)
Log Message:
-----------
Icon scaling fix: for zoom levels near 1, icon positions are moved to exact pixel
locations. Makes default headers and menus always crisp.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_widgets.c

Modified: trunk/blender/source/blender/editors/interface/interface_widgets.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_widgets.c	2012-12-19 11:19:43 UTC (rev 53173)
+++ trunk/blender/source/blender/editors/interface/interface_widgets.c	2012-12-19 11:55:41 UTC (rev 53174)
@@ -871,7 +871,7 @@
 	
 	aspect = but->block->aspect / UI_DPI_FAC;
 	height = ICON_DEFAULT_HEIGHT / aspect;
-	
+
 	/* calculate blend color */
 	if (ELEM4(but->type, TOG, ROW, TOGN, LISTROW)) {
 		if (but->flag & UI_SELECT) {}
@@ -915,6 +915,12 @@
 			ys = (rect->ymin + rect->ymax - height) / 2.0f;
 		}
 
+		/* force positions to integers, for zoom levels near 1. draws icons crisp. */
+		if (aspect > 0.95f && aspect < 1.05f) {
+			xs = (int)(xs + 0.1f);
+			ys = (int)(ys + 0.1f);
+		}
+		
 		/* to indicate draggable */
 		if (but->dragpoin && (but->flag & UI_ACTIVE)) {
 			float rgb[3] = {1.25f, 1.25f, 1.25f};




More information about the Bf-blender-cvs mailing list