Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-28 17:00:41 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-28 17:16:04 +0300
commitbf75b248180e5f7411fa27cdc89d7d1f07f7735c (patch)
treeda65daaeca12492bff371a190db78b29947c991c /source/blender/editors/manipulator_library
parent61759f3b5554b808c6e27591416064ead42a0fc9 (diff)
UI: fix incorrect scaling of manipulator widgets with DPI.
U.ui_scale is the setting from the user preferences and should never be used for drawing. UI_DPI_FAC is the final scale after DPI from the operating system is taken into account.
Diffstat (limited to 'source/blender/editors/manipulator_library')
-rw-r--r--source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c
index 7e57b48c77c..68bddf36b3c 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c
@@ -57,6 +57,7 @@
#include "ED_view3d.h"
#include "ED_manipulator_library.h"
+#include "UI_interface.h"
#include "UI_interface_icons.h"
#include "UI_resources.h"
@@ -152,8 +153,8 @@ static void button2d_draw_intern(
button2d_geom_draw_backdrop(mpr, color, select);
gpuPopMatrix();
UI_icon_draw(
- mpr->matrix_basis[3][0] - (ICON_DEFAULT_WIDTH / 2.0) * U.ui_scale,
- mpr->matrix_basis[3][1] - (ICON_DEFAULT_HEIGHT / 2.0) * U.ui_scale,
+ mpr->matrix_basis[3][0] - (ICON_DEFAULT_WIDTH / 2.0) * UI_DPI_FAC,
+ mpr->matrix_basis[3][1] - (ICON_DEFAULT_HEIGHT / 2.0) * UI_DPI_FAC,
button->icon);
}
else {
@@ -194,7 +195,7 @@ static int manipulator_button2d_test_select(
else {
copy_v2_v2(point_local, (float [2]){UNPACK2(event->mval)});
sub_v2_v2(point_local, mpr->matrix_basis[3]);
- mul_v2_fl(point_local, 1.0f / (mpr->scale_basis * U.ui_scale));
+ mul_v2_fl(point_local, 1.0f / (mpr->scale_basis * UI_DPI_FAC));
}
/* The 'mpr->scale_final' is already applied when projecting. */
if (len_squared_v2(point_local) < 1.0f) {