Skip to content

Commit 0417771

Browse files
committed
installed latest clang-format with pipenv
fixed pre-increment added @overload to stubs
1 parent d53883b commit 0417771

File tree

7 files changed

+64
-57
lines changed

7 files changed

+64
-57
lines changed

buildconfig/stubs/pygame/draw.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from pygame.rect import Rect
22
from pygame.surface import Surface
3+
from typing import overload
34

45
from ._common import ColorValue, Coordinate, RectValue, Sequence
56

@@ -31,13 +32,15 @@ def circle(
3132
draw_bottom_left: bool = False,
3233
draw_bottom_right: bool = False,
3334
) -> Rect: ...
35+
@overload
3436
def aacircle(
3537
surface: Surface,
3638
color: ColorValue,
3739
center: Coordinate,
3840
radius: float,
3941
width: int = 0,
4042
) -> Rect: ...
43+
@overload
4144
def aacircle(
4245
surface: Surface,
4346
color: ColorValue,

src_c/SDL_gfx/SDL_gfxPrimitives.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4226,7 +4226,8 @@ lrint(double flt)
42264226
#include <armintr.h>
42274227
#pragma warning(push)
42284228
#pragma warning(disable : 4716)
4229-
__declspec(naked) long int lrint(double flt)
4229+
__declspec(naked) long int
4230+
lrint(double flt)
42304231
{
42314232
__emit(0xEC410B10); // fmdrr d0, r0, r1
42324233
__emit(0xEEBD0B40); // ftosid s0, d0

src_c/color.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
#if (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L) && \
5151
!defined(round)
52-
#define pg_round(d) (((d < 0) ? (ceil((d)-0.5)) : (floor((d) + 0.5))))
52+
#define pg_round(d) (((d < 0) ? (ceil((d) - 0.5)) : (floor((d) + 0.5))))
5353
#else
5454
#define pg_round(d) round(d)
5555
#endif

src_c/draw.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2531,53 +2531,53 @@ draw_circle_xaolinwu(SDL_Surface *surf, int x0, int y0, int radius,
25312531
float prev_opacity = 0;
25322532
if (radius_ == radius - thickness) {
25332533
while (x < y) {
2534-
x++;
2535-
float height = sqrt(pow(radius_, 2) - pow(x - 1, 2));
2534+
float height = sqrt(pow(radius_, 2) - pow(x, 2));
25362535
float opacity = 255 * (ceil(height) - height);
25372536
if (opacity < prev_opacity) {
2538-
y--;
2537+
--y;
25392538
}
25402539
prev_opacity = opacity;
2541-
draw_eight_symetric_pixels(surf, x0, y0, color, x - 1, y, 255,
2540+
draw_eight_symetric_pixels(surf, x0, y0, color, x, y, 255,
25422541
top_right, top_left, bottom_left,
25432542
bottom_right, drawn_area);
25442543
draw_eight_symetric_pixels(
2545-
surf, x0, y0, color, x - 1, y - 1, opacity, top_right,
2544+
surf, x0, y0, color, x, y - 1, opacity, top_right,
25462545
top_left, bottom_left, bottom_right, drawn_area);
2546+
++x;
25472547
}
25482548
}
25492549
else if (radius_ == radius) {
25502550
while (x < y) {
2551-
x++;
2552-
float height = sqrt(pow(radius_, 2) - pow(x - 1, 2));
2551+
float height = sqrt(pow(radius_, 2) - pow(x, 2));
25532552
float opacity = 255 * (ceil(height) - height);
25542553
if (opacity < prev_opacity) {
2555-
y--;
2554+
--y;
25562555
}
25572556
prev_opacity = opacity;
25582557
draw_eight_symetric_pixels(
2559-
surf, x0, y0, color, x - 1, y, 255 - opacity, top_right,
2560-
top_left, bottom_left, bottom_right, drawn_area);
2561-
draw_eight_symetric_pixels(
2562-
surf, x0, y0, color, x - 1, y - 1, 255, top_right,
2558+
surf, x0, y0, color, x, y, 255 - opacity, top_right,
25632559
top_left, bottom_left, bottom_right, drawn_area);
2560+
draw_eight_symetric_pixels(surf, x0, y0, color, x, y - 1, 255,
2561+
top_right, top_left, bottom_left,
2562+
bottom_right, drawn_area);
2563+
++x;
25642564
}
25652565
}
25662566
else {
25672567
while (x < y) {
2568-
x++;
2569-
float height = sqrt(pow(radius_, 2) - pow(x - 1, 2));
2568+
float height = sqrt(pow(radius_, 2) - pow(x, 2));
25702569
float opacity = 255 * (ceil(height) - height);
25712570
if (opacity < prev_opacity) {
2572-
y--;
2571+
--y;
25732572
}
25742573
prev_opacity = opacity;
2575-
draw_eight_symetric_pixels(surf, x0, y0, color, x - 1, y, 255,
2574+
draw_eight_symetric_pixels(surf, x0, y0, color, x, y, 255,
25762575
top_right, top_left, bottom_left,
25772576
bottom_right, drawn_area);
2578-
draw_eight_symetric_pixels(
2579-
surf, x0, y0, color, x - 1, y - 1, 255, top_right,
2580-
top_left, bottom_left, bottom_right, drawn_area);
2577+
draw_eight_symetric_pixels(surf, x0, y0, color, x, y - 1, 255,
2578+
top_right, top_left, bottom_left,
2579+
bottom_right, drawn_area);
2580+
++x;
25812581
}
25822582
}
25832583
}
@@ -2592,19 +2592,19 @@ draw_circle_xaolinwu_thin(SDL_Surface *surf, int x0, int y0, int radius,
25922592
int y = radius;
25932593
float prev_opacity = 0;
25942594
while (x < y) {
2595-
x++;
2596-
float height = sqrt(pow(radius, 2) - pow(x - 1, 2));
2595+
float height = sqrt(pow(radius, 2) - pow(x, 2));
25972596
float opacity = 255 * (ceil(height) - height);
25982597
if (opacity < prev_opacity) {
2599-
y--;
2598+
--y;
26002599
}
26012600
prev_opacity = opacity;
2602-
draw_eight_symetric_pixels(surf, x0, y0, color, x - 1, y,
2603-
255 - opacity, top_right, top_left,
2604-
bottom_left, bottom_right, drawn_area);
2605-
draw_eight_symetric_pixels(surf, x0, y0, color, x - 1, y - 1, opacity,
2601+
draw_eight_symetric_pixels(surf, x0, y0, color, x, y, 255 - opacity,
2602+
top_right, top_left, bottom_left,
2603+
bottom_right, drawn_area);
2604+
draw_eight_symetric_pixels(surf, x0, y0, color, x, y - 1, opacity,
26062605
top_right, top_left, bottom_left,
26072606
bottom_right, drawn_area);
2607+
++x;
26082608
}
26092609
}
26102610

src_c/event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ dict_from_event(SDL_Event *event)
12451245
}
12461246
break;
12471247
#endif /* (defined(unix) || ... */
1248-
} /* switch (event->type) */
1248+
} /* switch (event->type) */
12491249
/* Events that dont have any attributes are not handled in switch
12501250
* statement */
12511251
SDL_Window *window;

src_c/freetype/ft_wrap.c

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ ft_wrap_quit(pgFontObject *);
3838
*
3939
*********************************************************/
4040
void
41-
_PGFT_SetError(FreeTypeInstance *ft, const char *error_msg, FT_Error error_id)
42-
{
41+
_PGFT_SetError(FreeTypeInstance *ft, const char *error_msg, FT_Error error_id){
4342
#undef __FTERRORS_H__
4443
#define FT_ERRORDEF(e, v, s) {e, s},
4544
#define FT_ERROR_START_LIST {
@@ -49,37 +48,37 @@ _PGFT_SetError(FreeTypeInstance *ft, const char *error_msg, FT_Error error_id)
4948
} \
5049
} \
5150
;
52-
static const struct {
53-
int err_code;
54-
const char *err_msg;
55-
} ft_errors[] =
51+
static const struct {int err_code;
52+
const char *err_msg;
53+
}
54+
ft_errors[] =
5655
#include FT_ERRORS_H
5756

58-
const int maxlen = (int)(sizeof(ft->_error_msg)) - 1;
59-
int i;
60-
const char *ft_msg;
57+
const int maxlen = (int)(sizeof(ft->_error_msg)) - 1;
58+
int i;
59+
const char *ft_msg;
6160

62-
ft_msg = 0;
63-
for (i = 0; ft_errors[i].err_msg; ++i) {
64-
if (error_id == ft_errors[i].err_code) {
65-
ft_msg = ft_errors[i].err_msg;
66-
break;
67-
}
61+
ft_msg = 0;
62+
for (i = 0; ft_errors[i].err_msg; ++i) {
63+
if (error_id == ft_errors[i].err_code) {
64+
ft_msg = ft_errors[i].err_msg;
65+
break;
6866
}
67+
}
6968

70-
if (error_id && ft_msg) {
71-
int ret = PyOS_snprintf(ft->_error_msg, sizeof(ft->_error_msg),
72-
"%.*s: %s", maxlen - 3, error_msg, ft_msg);
73-
if (ret >= 0) {
74-
/* return after successfully copying full or truncated error.
75-
* If ret < 0, PyOS_snprintf failed so try to strncpy error
76-
* message */
77-
return;
78-
}
69+
if (error_id && ft_msg) {
70+
int ret = PyOS_snprintf(ft->_error_msg, sizeof(ft->_error_msg), "%.*s: %s",
71+
maxlen - 3, error_msg, ft_msg);
72+
if (ret >= 0) {
73+
/* return after successfully copying full or truncated error.
74+
* If ret < 0, PyOS_snprintf failed so try to strncpy error
75+
* message */
76+
return;
7977
}
78+
}
8079

81-
strncpy(ft->_error_msg, error_msg, maxlen);
82-
ft->_error_msg[maxlen] = '\0'; /* in case of message truncation */
80+
strncpy(ft->_error_msg, error_msg, maxlen);
81+
ft->_error_msg[maxlen] = '\0'; /* in case of message truncation */
8382
}
8483

8584
const char *

test/draw_test.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5761,7 +5761,9 @@ def test_aacircle__args(self):
57615761
def test_aacircle__args_without_width(self):
57625762
"""Ensures draw aacircle accepts the args without a width and
57635763
quadrants."""
5764-
bounds_rect = self.draw_aacircle(pygame.Surface((2, 2)), (0, 0, 0, 50), (1, 1), 1)
5764+
bounds_rect = self.draw_aacircle(
5765+
pygame.Surface((2, 2)), (0, 0, 0, 50), (1, 1), 1
5766+
)
57655767

57665768
self.assertIsInstance(bounds_rect, pygame.Rect)
57675769

@@ -6106,7 +6108,9 @@ def test_aacircle__args_and_kwargs(self):
61066108
elif "center" == name:
61076109
bounds_rect = self.draw_aacircle(surface, color, center, **kwargs)
61086110
elif "radius" == name:
6109-
bounds_rect = self.draw_aacircle(surface, color, center, radius, **kwargs)
6111+
bounds_rect = self.draw_aacircle(
6112+
surface, color, center, radius, **kwargs
6113+
)
61106114
elif "width" == name:
61116115
bounds_rect = self.draw_aacircle(
61126116
surface, color, center, radius, width, **kwargs

0 commit comments

Comments
 (0)