Skip to content

Commit 08a8f43

Browse files
committed
Codestyle improvements in style_box_flat.cpp
1 parent 893bbdf commit 08a8f43

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

scene/resources/style_box_flat.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,13 @@ inline void draw_rounded_rectangle(Vector<Vector2> &verts, Vector<int> &indices,
263263

264264
// If the center is filled, we do not draw the border and directly use the inner ring as reference. Because all calls to this
265265
// method either draw a ring or a filled rounded rectangle, but not both.
266-
real_t quarter_arc_rad = Math_PI / 2.0;
267-
Point2 style_rect_center = style_rect.get_center();
266+
const real_t quarter_arc_rad = Math_PI / 2.0;
267+
const Point2 style_rect_center = style_rect.get_center();
268+
269+
const int colors_size = colors.size();
270+
const int verts_size = verts.size();
271+
const int new_verts_amount = (adapted_corner_detail + 1) * (draw_border ? 8 : 4);
268272

269-
int colors_size = colors.size();
270-
int verts_size = verts.size();
271-
int new_verts_amount = (adapted_corner_detail + 1) * (draw_border ? 8 : 4);
272273
colors.resize(colors_size + new_verts_amount);
273274
verts.resize(verts_size + new_verts_amount);
274275
Color *colors_ptr = colors.ptrw();
@@ -282,8 +283,8 @@ inline void draw_rounded_rectangle(Vector<Vector2> &verts, Vector<int> &indices,
282283
}
283284

284285
const real_t pt_angle = (corner_idx + detail / (double)adapted_corner_detail) * quarter_arc_rad + Math_PI;
285-
const real_t angle_cosine = cos(pt_angle);
286-
const real_t angle_sine = sin(pt_angle);
286+
const real_t angle_cosine = Math::cos(pt_angle);
287+
const real_t angle_sine = Math::sin(pt_angle);
287288

288289
{
289290
const real_t x = inner_corner_radius[corner_idx] * angle_cosine + inner_points[corner_idx].x;

0 commit comments

Comments
 (0)