[Bf-blender-cvs] [f682812f41f] blender-v2.93-release: Fix T87749: Fix text jitter in buttons with icons

Hans Goudey noreply at git.blender.org
Tue Apr 27 05:23:43 CEST 2021


Commit: f682812f41f0957ac1f72cc105dfc06f250d7755
Author: Hans Goudey
Date:   Mon Apr 26 22:23:23 2021 -0500
Branches: blender-v2.93-release
https://developer.blender.org/rBf682812f41f0957ac1f72cc105dfc06f250d7755

Fix T87749: Fix text jitter in buttons with icons

This patch fixes the remaining issues described in T87749. The jitter
was caused by inconsistent rounding when using the floats icon_size
and icon_padding to offset the bound for the text drawing. Using
`round_fl_to_int` leads to consistent results and fixes the jitter
that remained in some buttons with icons, UI lists, and breadcrumbs.

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

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

M	source/blender/editors/interface/interface_widgets.c

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

diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 8dbebe2a94c..c9c1f56dc98 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2416,7 +2416,7 @@ static void widget_draw_text_icon(const uiFontStyle *fstyle,
     but->block->aspect = aspect_orig;
 #endif
 
-    rect->xmin += icon_size + icon_padding;
+    rect->xmin += round_fl_to_int(icon_size + icon_padding);
   }
 
   if (!no_text_padding) {



More information about the Bf-blender-cvs mailing list