mirror of
https://github.com/godotengine/godot.git
synced 2025-03-07 23:32:58 +08:00
Codestyle improvements in style_box_flat.cpp
This commit is contained in:
parent
893bbdfde8
commit
08a8f430f4
@ -263,12 +263,13 @@ inline void draw_rounded_rectangle(Vector<Vector2> &verts, Vector<int> &indices,
|
|||||||
|
|
||||||
// If the center is filled, we do not draw the border and directly use the inner ring as reference. Because all calls to this
|
// If the center is filled, we do not draw the border and directly use the inner ring as reference. Because all calls to this
|
||||||
// method either draw a ring or a filled rounded rectangle, but not both.
|
// method either draw a ring or a filled rounded rectangle, but not both.
|
||||||
real_t quarter_arc_rad = Math_PI / 2.0;
|
const real_t quarter_arc_rad = Math_PI / 2.0;
|
||||||
Point2 style_rect_center = style_rect.get_center();
|
const Point2 style_rect_center = style_rect.get_center();
|
||||||
|
|
||||||
|
const int colors_size = colors.size();
|
||||||
|
const int verts_size = verts.size();
|
||||||
|
const int new_verts_amount = (adapted_corner_detail + 1) * (draw_border ? 8 : 4);
|
||||||
|
|
||||||
int colors_size = colors.size();
|
|
||||||
int verts_size = verts.size();
|
|
||||||
int new_verts_amount = (adapted_corner_detail + 1) * (draw_border ? 8 : 4);
|
|
||||||
colors.resize(colors_size + new_verts_amount);
|
colors.resize(colors_size + new_verts_amount);
|
||||||
verts.resize(verts_size + new_verts_amount);
|
verts.resize(verts_size + new_verts_amount);
|
||||||
Color *colors_ptr = colors.ptrw();
|
Color *colors_ptr = colors.ptrw();
|
||||||
@ -282,8 +283,8 @@ inline void draw_rounded_rectangle(Vector<Vector2> &verts, Vector<int> &indices,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const real_t pt_angle = (corner_idx + detail / (double)adapted_corner_detail) * quarter_arc_rad + Math_PI;
|
const real_t pt_angle = (corner_idx + detail / (double)adapted_corner_detail) * quarter_arc_rad + Math_PI;
|
||||||
const real_t angle_cosine = cos(pt_angle);
|
const real_t angle_cosine = Math::cos(pt_angle);
|
||||||
const real_t angle_sine = sin(pt_angle);
|
const real_t angle_sine = Math::sin(pt_angle);
|
||||||
|
|
||||||
{
|
{
|
||||||
const real_t x = inner_corner_radius[corner_idx] * angle_cosine + inner_points[corner_idx].x;
|
const real_t x = inner_corner_radius[corner_idx] * angle_cosine + inner_points[corner_idx].x;
|
||||||
|
Loading…
Reference in New Issue
Block a user