summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-11-17 16:09:26 +0100
committerGitHub <noreply@github.com>2019-11-17 16:09:26 +0100
commitd75b43e961deb75303e3b05f8887a7a3571880ea (patch)
tree5dca5f6cab7befe6a0c556333cba6e4b636ff4bf
parent3c831377712ec7b37d8f22739538e6abb3c7741f (diff)
parent2511f275b9641286777fd5c60d12b462347359d8 (diff)
Merge pull request #33678 from nekomatata/stylebox-flat-width-zero
StyleBoxFlat doesn't draw content when width or height is zero
-rw-r--r--scene/resources/style_box.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index 9ee7c2936e..d56360f918 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -694,6 +694,11 @@ void StyleBoxFlat::draw(RID p_canvas_item, const Rect2 &p_rect) const {
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 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;
- 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;
if (aa_on && !blend_on) {
float aa_size_grow = 0.5 * ((aa_size + 1) / 2);