Skip to content

Commit 13d13ed

Browse files
authored
chore: improve naming in shared border corner logic
1 parent 067fff5 commit 13d13ed

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

lib/pandagl/src/border.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,22 @@ static int draw_border_corner(pd_canvas_t *dst, int bound_left, int bound_top,
7474
const pd_corner_flags_t *flags)
7575
{
7676
BorderRenderContext();
77-
int corner_height = y_max(radius, xline->width);
77+
int bottom_corner_height = y_max(radius, xline->width);
7878
double circle_center_y = bound_top +
7979
(flags->is_bottom
80-
? corner_height - 1.0 * radius - 0.5
80+
? bottom_corner_height - 1.0 * radius - 0.5
8181
: r);
8282
double circle_center_x = bound_left +
8383
(flags->is_right ? width - 1.0 * radius - 0.5
8484
: r);
85-
double split_k = xline->width > 0
86-
? 1.0 * yline->width / xline->width
87-
: 0.0;
85+
double split_slope =
86+
xline->width > 0 ? 1.0 * yline->width / xline->width : 0.0;
8887
double split_center_x = bound_left +
8988
(flags->is_right ? width - 1.0 * yline->width
9089
: 1.0 * yline->width);
9190
double split_center_y = bound_top +
9291
(flags->is_bottom
93-
? corner_height - 1.0 * xline->width
92+
? bottom_corner_height - 1.0 * xline->width
9493
: 1.0 * xline->width);
9594
double inner_ellipse_limit = flags->is_bottom
9695
? circle_center_y + radius_y
@@ -110,13 +109,13 @@ static int draw_border_corner(pd_canvas_t *dst, int bound_left, int bound_top,
110109
inner_x = flags->is_right ? -1.0 : width;
111110
circle_y = ToGeoY(y, circle_center_y);
112111
if (r > 0 && (flags->is_bottom ? circle_y <= 0 : circle_y >= 0)) {
113-
int allow_inner =
112+
int should_draw_inner_ellipse =
114113
!flags->is_bottom || !flags->is_right ||
115114
y >= circle_center_y;
116115
outer_x = flags->is_right
117116
? width - radius + ellipse_x(r, r, circle_y)
118117
: r - ellipse_x(r, r, circle_y);
119-
if (radius_y > 0 && allow_inner &&
118+
if (radius_y > 0 && should_draw_inner_ellipse &&
120119
(flags->is_bottom ? y <= inner_ellipse_limit
121120
: y >= inner_ellipse_limit)) {
122121
inner_x = flags->is_right
@@ -129,7 +128,8 @@ static int draw_border_corner(pd_canvas_t *dst, int bound_left, int bound_top,
129128
}
130129
if (xline->width > 0) {
131130
split_x = split_center_x + split_sign *
132-
ToGeoY(y, split_center_y) * split_k;
131+
ToGeoY(y, split_center_y) *
132+
split_slope;
133133
}
134134
outer_x = bound_left + outer_x;
135135
inner_x = bound_left + inner_x;

0 commit comments

Comments
 (0)