UI: better widget drawing with thick line width.

When the line width was larger than the UI scale, there was not enough
space for thicker widget outlines to draw properly. Now widgets are made
a little larger to accommodate the thicker outlines.

Differential Revision: https://developer.blender.org/D4368
This commit is contained in:
Harley Acheson
2019-02-21 17:34:48 +01:00
committed by Brecht Van Lommel
parent 86bbadaaee
commit 1de1cedf4c
6 changed files with 17 additions and 11 deletions

View File

@@ -603,9 +603,13 @@ void WM_window_set_dpi(wmWindow *win)
U.pixelsize = pixelsize;
U.dpi = dpi / pixelsize;
U.virtual_pixel = (pixelsize == 1) ? VIRTUAL_PIXEL_NATIVE : VIRTUAL_PIXEL_DOUBLE;
U.widget_unit = (U.pixelsize * U.dpi * 20 + 36) / 72;
U.dpi_fac = ((U.pixelsize * (float)U.dpi) / 72.0f);
/* Set user preferences globals for drawing, and for forward compatibility. */
U.widget_unit = (U.pixelsize * U.dpi * 20 + 36) / 72;
/* If line thickness differs from scaling factor then adjustments need to be made */
U.widget_unit += 2 * ((int)U.pixelsize - (int)U.dpi_fac);
/* update font drawing */
BLF_default_dpi(U.pixelsize * U.dpi);
}