[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53176] trunk/blender/source/blender/ editors/interface/view2d.c: UI DPI scaling fix:

Ton Roosendaal ton at blender.org
Wed Dec 19 13:22:19 CET 2012


Revision: 53176
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53176
Author:   ton
Date:     2012-12-19 12:22:15 +0000 (Wed, 19 Dec 2012)
Log Message:
-----------
UI DPI scaling fix:

2D views with scale prints (numbers over slider) now follow the text size.

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

Modified: trunk/blender/source/blender/editors/interface/view2d.c
===================================================================
--- trunk/blender/source/blender/editors/interface/view2d.c	2012-12-19 11:56:10 UTC (rev 53175)
+++ trunk/blender/source/blender/editors/interface/view2d.c	2012-12-19 12:22:15 UTC (rev 53176)
@@ -1151,7 +1151,7 @@
 		pixels = (float)BLI_rcti_size_x(&v2d->mask);
 		
 		if (pixels != 0.0f) {
-			grid->dx = (U.v2d_min_gridsize * U.pixelsize * space) / (seconddiv * pixels);
+			grid->dx = (U.v2d_min_gridsize * UI_DPI_FAC * space) / (seconddiv * pixels);
 			step_to_grid(&grid->dx, &grid->powerx, xunits);
 			grid->dx *= seconddiv;
 		}
@@ -1168,7 +1168,7 @@
 		space = BLI_rctf_size_y(&v2d->cur);
 		pixels = (float)winy;
 		
-		grid->dy = U.v2d_min_gridsize * U.pixelsize * space / pixels;
+		grid->dy = U.v2d_min_gridsize * UI_DPI_FAC * space / pixels;
 		step_to_grid(&grid->dy, &grid->powery, yunits);
 		
 		if (yclamp == V2D_GRID_CLAMP) {
@@ -1213,7 +1213,7 @@
 		vec2[1] = v2d->cur.ymax;
 		
 		/* minor gridlines */
-		step = (BLI_rcti_size_x(&v2d->mask) + 1) / (U.v2d_min_gridsize * U.pixelsize);
+		step = (BLI_rcti_size_x(&v2d->mask) + 1) / (U.v2d_min_gridsize * UI_DPI_FAC);
 		UI_ThemeColor(TH_GRID);
 		
 		for (a = 0; a < step; a++) {
@@ -1247,7 +1247,7 @@
 		vec1[0] = grid->startx;
 		vec2[0] = v2d->cur.xmax;
 		
-		step = (BLI_rcti_size_y(&v2d->mask) + 1) / (U.v2d_min_gridsize * U.pixelsize);
+		step = (BLI_rcti_size_y(&v2d->mask) + 1) / (U.v2d_min_gridsize * UI_DPI_FAC);
 		
 		UI_ThemeColor(TH_GRID);
 		for (a = 0; a <= step; a++) {




More information about the Bf-blender-cvs mailing list