Skip to content

Commit 1162639

Browse files
committed
Renamed radius_ and using 255.0f only where needed
1 parent f4e27c7 commit 1162639

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src_c/draw.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2523,14 +2523,15 @@ draw_circle_xaolinwu(SDL_Surface *surf, int x0, int y0, int radius,
25232523
int thickness, Uint32 color, int top_right, int top_left,
25242524
int bottom_left, int bottom_right, int *drawn_area)
25252525
{
2526-
for (int radius_ = radius - thickness; radius_ <= radius; radius_++) {
2526+
for (int layer_radius = radius - thickness; layer_radius <= radius;
2527+
layer_radius++) {
25272528
int x = 0;
2528-
int y = radius_;
2529+
int y = layer_radius;
25292530
double prev_opacity = 0.0;
2530-
if (radius_ == radius - thickness) {
2531+
if (layer_radius == radius - thickness) {
25312532
while (x < y) {
2532-
double height = sqrt(pow(radius_, 2) - pow(x, 2));
2533-
double opacity = 255.0f * (ceil(height) - height);
2533+
double height = sqrt(pow(layer_radius, 2) - pow(x, 2));
2534+
double opacity = 255.0 * (ceil(height) - height);
25342535
if (opacity < prev_opacity) {
25352536
--y;
25362537
}
@@ -2544,10 +2545,10 @@ draw_circle_xaolinwu(SDL_Surface *surf, int x0, int y0, int radius,
25442545
++x;
25452546
}
25462547
}
2547-
else if (radius_ == radius) {
2548+
else if (layer_radius == radius) {
25482549
while (x < y) {
2549-
double height = sqrt(pow(radius_, 2) - pow(x, 2));
2550-
double opacity = 255.0f * (ceil(height) - height);
2550+
double height = sqrt(pow(layer_radius, 2) - pow(x, 2));
2551+
double opacity = 255.0 * (ceil(height) - height);
25512552
if (opacity < prev_opacity) {
25522553
--y;
25532554
}
@@ -2564,8 +2565,8 @@ draw_circle_xaolinwu(SDL_Surface *surf, int x0, int y0, int radius,
25642565
}
25652566
else {
25662567
while (x < y) {
2567-
double height = sqrt(pow(radius_, 2) - pow(x, 2));
2568-
double opacity = 255.0f * (ceil(height) - height);
2568+
double height = sqrt(pow(layer_radius, 2) - pow(x, 2));
2569+
double opacity = 255.0 * (ceil(height) - height);
25692570
if (opacity < prev_opacity) {
25702571
--y;
25712572
}
@@ -2592,7 +2593,7 @@ draw_circle_xaolinwu_thin(SDL_Surface *surf, int x0, int y0, int radius,
25922593
double prev_opacity = 0.0;
25932594
while (x < y) {
25942595
double height = sqrt(pow(radius, 2) - pow(x, 2));
2595-
double opacity = 255.0f * (ceil(height) - height);
2596+
double opacity = 255.0 * (ceil(height) - height);
25962597
if (opacity < prev_opacity) {
25972598
--y;
25982599
}

0 commit comments

Comments
 (0)