Merge pull request #33678 from nekomatata/stylebox-flat-width-zero
StyleBoxFlat doesn't draw content when width or height is zero
This commit is contained in:
commit
d75b43e961
|
@ -694,6 +694,11 @@ void StyleBoxFlat::draw(RID p_canvas_item, const Rect2 &p_rect) const {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rect2 style_rect = p_rect.grow_individual(expand_margin[MARGIN_LEFT], expand_margin[MARGIN_TOP], expand_margin[MARGIN_RIGHT], expand_margin[MARGIN_BOTTOM]);
|
||||||
|
if (Math::is_zero_approx(style_rect.size.width) || Math::is_zero_approx(style_rect.size.height)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool rounded_corners = (corner_radius[0] > 0) || (corner_radius[1] > 0) || (corner_radius[2] > 0) || (corner_radius[3] > 0);
|
bool rounded_corners = (corner_radius[0] > 0) || (corner_radius[1] > 0) || (corner_radius[2] > 0) || (corner_radius[3] > 0);
|
||||||
bool aa_on = rounded_corners && anti_aliased;
|
bool aa_on = rounded_corners && anti_aliased;
|
||||||
|
|
||||||
|
@ -701,7 +706,6 @@ void StyleBoxFlat::draw(RID p_canvas_item, const Rect2 &p_rect) const {
|
||||||
|
|
||||||
bool blend_on = blend_border && draw_border;
|
bool blend_on = blend_border && draw_border;
|
||||||
|
|
||||||
Rect2 style_rect = p_rect.grow_individual(expand_margin[MARGIN_LEFT], expand_margin[MARGIN_TOP], expand_margin[MARGIN_RIGHT], expand_margin[MARGIN_BOTTOM]);
|
|
||||||
Rect2 border_style_rect = style_rect;
|
Rect2 border_style_rect = style_rect;
|
||||||
if (aa_on && !blend_on) {
|
if (aa_on && !blend_on) {
|
||||||
float aa_size_grow = 0.5 * ((aa_size + 1) / 2);
|
float aa_size_grow = 0.5 * ((aa_size + 1) / 2);
|
||||||
|
|
Loading…
Reference in New Issue