diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-02-04 14:17:01 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-02-04 14:19:28 +0300 |
commit | 3dde6360ff6ae002002472f7b5a155e3d119230f (patch) | |
tree | 802493f801cad87d93f53e20173a02e671a3def4 /source/blender/editors/interface | |
parent | 62dba60e49e79e77ecb11027e723823767c13854 (diff) |
Fix T65306: UI widgets clipped when scaled up
Normal UI widget and 3D navigation gizmo where clipping at high DPI.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 31cbd2a3831..0250900759f 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1736,7 +1736,7 @@ void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rec /* sphere color */ float diffuse[3] = {1.0f, 1.0f, 1.0f}; float light[3]; - float size; + const float size = 0.5f * min_ff(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)); /* backdrop */ UI_draw_roundbox_corner_set(UI_CNR_ALL); @@ -1752,11 +1752,10 @@ void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rec /* transform to button */ GPU_matrix_push(); - if (BLI_rcti_size_x(rect) < BLI_rcti_size_y(rect)) { - size = 0.5f * BLI_rcti_size_x(rect); - } - else { - size = 0.5f * BLI_rcti_size_y(rect); + bool use_project_matrix = (size >= -GPU_MATRIX_ORTHO_CLIP_NEAR_DEFAULT); + if (use_project_matrix) { + GPU_matrix_push_projection(); + GPU_matrix_ortho_set_z(-size, size); } GPU_matrix_translate_2f(rect->xmin + 0.5f * BLI_rcti_size_x(rect), @@ -1784,6 +1783,10 @@ void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rec GPU_blend(false); GPU_line_smooth(false); + if (use_project_matrix) { + GPU_matrix_pop_projection(); + } + /* matrix after circle */ GPU_matrix_pop(); |