diff options
author | Timo <16718859+toger5@users.noreply.github.com> | 2018-10-17 10:51:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-17 10:51:54 +0200 |
commit | 1dbb6e455424f37dc55adc4156a725364d7dbc37 (patch) | |
tree | 15e0f3879410b6b943957e4a0de56c5aad1d38cb /scene | |
parent | d3fde96dcf206a56c286eee85a52422c4cb158db (diff) | |
parent | cad9e4e6923b0d208a31bb0cd27e2504e7d0c8cb (diff) |
Merge pull request #23056 from YeldhamDev/stylebox_rings_removal
Remove unnecessary "rings" variable from "draw_rings()" in StyleBox
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/style_box.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 69d85eeef3..05050a5ea2 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -565,8 +565,6 @@ inline void draw_ring(Vector<Vector2> &verts, Vector<int> &indices, Vector<Color vert_offset = 0; } int adapted_corner_detail = (corner_radius[0] == 0 && corner_radius[1] == 0 && corner_radius[2] == 0 && corner_radius[3] == 0) ? 1 : corner_detail; - int rings = (border_width[0] == 0 && border_width[1] == 0 && border_width[2] == 0 && border_width[3] == 0) ? 1 : 2; - rings = 2; int ring_corner_radius[4]; set_inner_corner_radius(style_rect, ring_rect, corner_radius, ring_corner_radius); @@ -592,7 +590,7 @@ inline void draw_ring(Vector<Vector2> &verts, Vector<int> &indices, Vector<Color //calculate the vert array for (int corner_index = 0; corner_index < 4; corner_index++) { for (int detail = 0; detail <= adapted_corner_detail; detail++) { - for (int inner_outer = (2 - rings); inner_outer < 2; inner_outer++) { + for (int inner_outer = 0; inner_outer < 2; inner_outer++) { float radius; Color color; Point2 corner_point; @@ -613,19 +611,17 @@ inline void draw_ring(Vector<Vector2> &verts, Vector<int> &indices, Vector<Color } } - if (rings == 2) { - int vert_count = (adapted_corner_detail + 1) * 4 * rings; - //fill the indices and the colors for the border - for (int i = 0; i < vert_count; i++) { - //poly 1 - indices.push_back(vert_offset + ((i + 0) % vert_count)); - indices.push_back(vert_offset + ((i + 2) % vert_count)); - indices.push_back(vert_offset + ((i + 1) % vert_count)); - //poly 2 - indices.push_back(vert_offset + ((i + 1) % vert_count)); - indices.push_back(vert_offset + ((i + 2) % vert_count)); - indices.push_back(vert_offset + ((i + 3) % vert_count)); - } + int vert_count = (adapted_corner_detail + 1) * 4 * 2; + //fill the indices and the colors for the border + for (int i = 0; i < vert_count; i++) { + //poly 1 + indices.push_back(vert_offset + ((i + 0) % vert_count)); + indices.push_back(vert_offset + ((i + 2) % vert_count)); + indices.push_back(vert_offset + ((i + 1) % vert_count)); + //poly 2 + indices.push_back(vert_offset + ((i + 1) % vert_count)); + indices.push_back(vert_offset + ((i + 2) % vert_count)); + indices.push_back(vert_offset + ((i + 3) % vert_count)); } } |