Fix: Property editor icon jittering in some cases
In the tools tab, the tool icon would be offset when it intersected the bottom of the editor. With some screen resolutions, the icons on the left side of the editor would also move when intersecting the bottom of the editor. This happened because of the truncation in the implicit conversion from float to int. Instead, use explicit conversion functions. Differential Revision: https://developer.blender.org/D11097
This commit is contained in:
parent
97ff37bf54
commit
9be49a1069
Notes:
blender-bot
2023-02-14 05:12:59 +01:00
Referenced by commit 49858bf526
, UI: Fix outliner and buttons icons alignment
|
@ -1503,7 +1503,8 @@ static void icon_draw_rect(float x,
|
|||
int draw_w = w;
|
||||
int draw_h = h;
|
||||
int draw_x = x;
|
||||
int draw_y = y;
|
||||
/* We need to round y, to avoid the icon jittering in some cases. */
|
||||
int draw_y = round_fl_to_int(y);
|
||||
|
||||
/* sanity check */
|
||||
if (w <= 0 || h <= 0 || w > 2000 || h > 2000) {
|
||||
|
|
|
@ -1407,8 +1407,8 @@ static void widget_draw_icon(
|
|||
|
||||
/* force positions to integers, for zoom levels near 1. draws icons crisp. */
|
||||
if (aspect > 0.95f && aspect < 1.05f) {
|
||||
xs = (int)(xs + 0.1f);
|
||||
ys = (int)(ys + 0.1f);
|
||||
xs = roundf(xs);
|
||||
ys = roundf(ys);
|
||||
}
|
||||
|
||||
/* Get theme color. */
|
||||
|
|
Loading…
Reference in New Issue