History

Cleanup dpi scaling comments

Ryan Huffman committed 11 years ago

Commit a8999961 parent 47519742 files · +3 −17Browse files

Showing the changes to interface/src/UIUtil.cpp (1 of 2 files). Show all

Unified · Split

interface/src/UIUtil.cpp+3−11
@@ -33,9 +33,8 @@ int UIUtil::getWindowTitleBarHeight(const QWidget* window) { · 32 unmodified lines
33 33
34// When setting the font size of a widget in points, the rendered text will be larger34// When setting the font size of a widget in points, the rendered text will be larger
35// on Windows and Linux than on Mac OSX. This is because Windows and Linux use a DPI35// on Windows and Linux than on Mac OSX. This is because Windows and Linux use a DPI
36// of 96, while OSX uses 72.36// of 96, while OSX uses 72. In order to get consistent results across platforms, the
37// In order to get consistent results across platforms, the font sizes need to be scaled37// font sizes need to be scaled based on the system DPI.
38// based on the system DPI.
39// This function will scale the font size of widget and all38// This function will scale the font size of widget and all
40// of its children recursively.39// of its children recursively.
41void UIUtil::scaleWidgetFontSizes(QWidget* widget) {40void UIUtil::scaleWidgetFontSizes(QWidget* widget) {
@@ -53,14 +52,7 @@ void UIUtil::scaleWidgetFontSizes(QWidget* widget) { · 11 unmodified lines
53 52
54 // Scale fonts based on the native dpi. On Windows, where the native DPI is 96,53 // Scale fonts based on the native dpi. On Windows, where the native DPI is 96,
55 // the scale will be: 72.0 / 96.0 = 0.7554 // the scale will be: 72.0 / 96.0 = 0.75
56 float fontScale = (BASE_DPI / NATIVE_DPI);55 float fontScale = BASE_DPI / NATIVE_DPI;
57
58 // Scale the font further by the system's DPI settings. If using a 2x high-dpi screen
59 // on Windows, for example, the font will be further scaled by: 192.0 / 96.0 = 2.0
60 // This would give a final scale of: 0.75 * 2.0 = 1.5
61 // fontScale *= (glCanvas->logicalDpiX() / NATIVE_DPI);
62
63 qDebug() << "Scaling widgets by: " << fontScale;
64 56
65 internalScaleWidgetFontSizes(widget, fontScale);57 internalScaleWidgetFontSizes(widget, fontScale);
66}58}