Skip to content

Commit

Permalink
Merge pull request #91802 from Rindbee/round-icon-rect-when-drawing-t…
Browse files Browse the repository at this point in the history
…he-button

Round the icon's drawing rect when drawing the button
  • Loading branch information
akien-mga committed May 14, 2024
2 parents c9fdcde + 82fef61 commit 2b3d913
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scene/gui/button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ void Button::_notification(int p_what) {
icon_size = Size2(icon_width, icon_height);
}
icon_size = _fit_icon_size(icon_size);
icon_size = icon_size.round();
}

if (icon_size.width > 0.0f) {
Expand Down Expand Up @@ -336,6 +337,7 @@ void Button::_notification(int p_what) {
icon_ofs.y = size.y - style_margin_bottom - icon_size.height;
} break;
}
icon_ofs = icon_ofs.floor();

Rect2 icon_region = Rect2(icon_ofs, icon_size);
draw_texture_rect(_icon, icon_region, false, icon_modulate_color);
Expand Down

0 comments on commit 2b3d913

Please sign in to comment.