Commit: 07bdbeda8462c36fc7cff086b1fb31ee3ddbca0d
Author: Yevgeny Makarov
Date:   Mon Mar 9 17:08:35 2020 +0100
Branches: master
https://developer.blender.org/rB07bdbeda8462c36fc7cff086b1fb31ee3ddbca0d

UI: avoid blurring of view navigation widgets at some UI scales

Differential Revision: https://developer.blender.org/D6734

===================================================================

M       source/blender/editors/interface/view2d_gizmo_navigate.c
M       source/blender/editors/space_view3d/view3d_gizmo_navigate.c

===================================================================

diff --git a/source/blender/editors/interface/view2d_gizmo_navigate.c 
b/source/blender/editors/interface/view2d_gizmo_navigate.c
index a11ba0476e1..fd309045899 100644
--- a/source/blender/editors/interface/view2d_gizmo_navigate.c
+++ b/source/blender/editors/interface/view2d_gizmo_navigate.c
@@ -228,13 +228,13 @@ static void WIDGETGROUP_navigate_draw_prepare(const 
bContext *C, wmGizmoGroup *g
   int icon_mini_slot = 0;
 
   gz = navgroup->gz_array[GZ_INDEX_ZOOM];
-  gz->matrix_basis[3][0] = co[0];
-  gz->matrix_basis[3][1] = co[1] - (icon_offset_mini * icon_mini_slot++);
+  gz->matrix_basis[3][0] = roundf(co[0]);
+  gz->matrix_basis[3][1] = roundf(co[1] - (icon_offset_mini * 
icon_mini_slot++));
   WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false);
 
   gz = navgroup->gz_array[GZ_INDEX_MOVE];
-  gz->matrix_basis[3][0] = co[0];
-  gz->matrix_basis[3][1] = co[1] - (icon_offset_mini * icon_mini_slot++);
+  gz->matrix_basis[3][0] = roundf(co[0]);
+  gz->matrix_basis[3][1] = roundf(co[1] - (icon_offset_mini * 
icon_mini_slot++));
   WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false);
 }
 
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c 
b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
index 0d55fcda6a9..422cba7c52e 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
@@ -307,25 +307,25 @@ static void WIDGETGROUP_navigate_draw_prepare(const 
bContext *C, wmGizmoGroup *g
   if (show_navigate) {
     int icon_mini_slot = 0;
     gz = navgroup->gz_array[GZ_INDEX_ZOOM];
-    gz->matrix_basis[3][0] = co[0];
-    gz->matrix_basis[3][1] = co[1] - (icon_offset_mini * icon_mini_slot++);
+    gz->matrix_basis[3][0] = roundf(co[0]);
+    gz->matrix_basis[3][1] = roundf(co[1] - (icon_offset_mini * 
icon_mini_slot++));
     WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false);
 
     gz = navgroup->gz_array[GZ_INDEX_MOVE];
-    gz->matrix_basis[3][0] = co[0];
-    gz->matrix_basis[3][1] = co[1] - (icon_offset_mini * icon_mini_slot++);
+    gz->matrix_basis[3][0] = roundf(co[0]);
+    gz->matrix_basis[3][1] = roundf(co[1] - (icon_offset_mini * 
icon_mini_slot++));
     WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false);
 
     if ((rv3d->viewlock & RV3D_LOCKED) == 0) {
       gz = navgroup->gz_array[GZ_INDEX_CAMERA];
-      gz->matrix_basis[3][0] = co[0];
-      gz->matrix_basis[3][1] = co[1] - (icon_offset_mini * icon_mini_slot++);
+      gz->matrix_basis[3][0] = roundf(co[0]);
+      gz->matrix_basis[3][1] = roundf(co[1] - (icon_offset_mini * 
icon_mini_slot++));
       WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false);
 
       if (navgroup->state.rv3d.is_camera == false) {
         gz = navgroup->gz_array[rv3d->is_persp ? GZ_INDEX_PERSP : 
GZ_INDEX_ORTHO];
-        gz->matrix_basis[3][0] = co[0];
-        gz->matrix_basis[3][1] = co[1] - (icon_offset_mini * icon_mini_slot++);
+        gz->matrix_basis[3][0] = roundf(co[0]);
+        gz->matrix_basis[3][1] = roundf(co[1] - (icon_offset_mini * 
icon_mini_slot++));
         WM_gizmo_set_flag(gz, WM_GIZMO_HIDDEN, false);
       }
     }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to