diff options
Diffstat (limited to 'scene/resources/style_box.cpp')
-rw-r--r-- | scene/resources/style_box.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index b7c26dd3c3..eb65f10ec9 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -54,10 +54,11 @@ float StyleBox::get_default_margin(Margin p_margin) const { float StyleBox::get_margin(Margin p_margin) const { ERR_FAIL_INDEX_V((int)p_margin, 4, 0.0); - if (margin[p_margin] < 0) + if (margin[p_margin] < 0) { return get_style_margin(p_margin); - else + } else { return margin[p_margin]; + } } CanvasItem *StyleBox::get_current_item_drawn() const { @@ -111,8 +112,9 @@ StyleBox::StyleBox() { } void StyleBoxTexture::set_texture(Ref<Texture2D> p_texture) { - if (texture == p_texture) + if (texture == p_texture) { return; + } texture = p_texture; if (p_texture.is_null()) { region_rect = Rect2(0, 0, 0, 0); @@ -129,8 +131,9 @@ Ref<Texture2D> StyleBoxTexture::get_texture() const { } void StyleBoxTexture::set_normal_map(Ref<Texture2D> p_normal_map) { - if (normal_map == p_normal_map) + if (normal_map == p_normal_map) { return; + } normal_map = p_normal_map; emit_changed(); } @@ -170,8 +173,9 @@ Rect2 StyleBoxTexture::get_draw_rect(const Rect2 &p_rect) const { } void StyleBoxTexture::draw(RID p_canvas_item, const Rect2 &p_rect) const { - if (texture.is_null()) + if (texture.is_null()) { return; + } Rect2 rect = p_rect; Rect2 src_rect = region_rect; @@ -184,8 +188,9 @@ void StyleBoxTexture::draw(RID p_canvas_item, const Rect2 &p_rect) const { rect.size.y += expand_margin[MARGIN_TOP] + expand_margin[MARGIN_BOTTOM]; RID normal_rid; - if (normal_map.is_valid()) + if (normal_map.is_valid()) { normal_rid = normal_map->get_rid(); + } RenderingServer::get_singleton()->canvas_item_add_nine_patch(p_canvas_item, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), RS::NinePatchAxisMode(axis_h), RS::NinePatchAxisMode(axis_v), draw_center, modulate, normal_rid); } @@ -200,8 +205,9 @@ bool StyleBoxTexture::is_draw_center_enabled() const { } Size2 StyleBoxTexture::get_center_size() const { - if (texture.is_null()) + if (texture.is_null()) { return Size2(); + } return region_rect.size - get_minimum_size(); } @@ -233,8 +239,9 @@ float StyleBoxTexture::get_expand_margin_size(Margin p_expand_margin) const { } void StyleBoxTexture::set_region_rect(const Rect2 &p_region_rect) { - if (region_rect == p_region_rect) + if (region_rect == p_region_rect) { return; + } region_rect = p_region_rect; emit_changed(); @@ -265,8 +272,9 @@ StyleBoxTexture::AxisStretchMode StyleBoxTexture::get_v_axis_stretch_mode() cons } void StyleBoxTexture::set_modulate(const Color &p_modulate) { - if (modulate == p_modulate) + if (modulate == p_modulate) { return; + } modulate = p_modulate; emit_changed(); } |