Skip to content

Commit be55232

Browse files
authored
Merge pull request #2744 from oddbookworm/update-formatting
Formatting updates using newest version of clang-format
2 parents d59e480 + f5bc38f commit be55232

File tree

7 files changed

+39
-36
lines changed

7 files changed

+39
-36
lines changed

buildconfig/stubs/pygame/camera.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from abc import ABC, abstractmethod
2-
from typing import List, Optional, Tuple, Union
2+
from typing import List, Optional, Tuple, Union, Literal
33

44
from ._common import IntCoordinate
55

@@ -9,6 +9,9 @@ def get_backends() -> List[str]: ...
99
def init(backend: Optional[str] = None) -> None: ...
1010
def quit() -> None: ...
1111
def list_cameras() -> List[str]: ...
12+
def colorspace(
13+
surface: Surface, color: Literal["YUV", "HSV"], dest_surface: Surface = ..., /
14+
) -> Surface: ...
1215

1316
class AbstractCamera(ABC):
1417
@abstractmethod

docs/reST/ref/camera.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ The Bayer to ``RGB`` function is based on:
8989
The other big difference is "camera enumeration." Some backends don't have
9090
a way to list out camera names, or even the number of cameras on the
9191
system. In these cases, :func:`list_cameras()` will return
92-
something like ``[0]``. If you know you have multiple cameras on the
93-
system, these backend ports will pass through a "camera index number"
92+
something like ``[0]``. If you know you have multiple cameras on the
93+
system, these backend ports will pass through a "camera index number"
9494
through if you use that as the ``device`` parameter.
9595

9696
.. versionaddedold:: 2.0.3
@@ -100,7 +100,7 @@ The Bayer to ``RGB`` function is based on:
100100
.. function:: colorspace
101101

102102
| :sl:`Surface colorspace conversion`
103-
| :sg:`colorspace(Surface, format, DestSurface = None, /) -> Surface`
103+
| :sg:`colorspace(surface, format, dest_surface = None, /) -> Surface`
104104
105105
Allows for conversion from "RGB" to a destination colorspace of "HSV" or
106106
"YUV". The source and destination surfaces must be the same size and pixel
@@ -132,7 +132,7 @@ The Bayer to ``RGB`` function is based on:
132132
133133
Loads a camera. On Linux, the device is typically something like
134134
"/dev/video0". Default width and height are 640 by 480.
135-
Format is the desired colorspace of the output.
135+
Format is the desired colorspace of the output.
136136
This is useful for computer vision purposes. The default is
137137
``RGB``. The following are supported:
138138

@@ -214,7 +214,7 @@ The Bayer to ``RGB`` function is based on:
214214
frame when called with a blocking function like :func:`get_image()`.
215215
On Windows (MSMF), and the OpenCV backends, :func:`query_image()`
216216
should be reliable, though. This is useful to separate the framerate of
217-
the game from that of the camera without having to use threading.
217+
the game from that of the camera without having to use threading.
218218

219219
.. ## Camera.query_image ##
220220

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/doc/camera_doc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define DOC_CAMERA "pygame module for camera use"
33
#define DOC_CAMERA_INIT "init(backend = None) -> None\nModule init"
44
#define DOC_CAMERA_GETBACKENDS "get_backends() -> [str]\nGet the backends supported on this system"
5-
#define DOC_CAMERA_COLORSPACE "colorspace(Surface, format, DestSurface = None, /) -> Surface\nSurface colorspace conversion"
5+
#define DOC_CAMERA_COLORSPACE "colorspace(surface, format, dest_surface = None, /) -> Surface\nSurface colorspace conversion"
66
#define DOC_CAMERA_LISTCAMERAS "list_cameras() -> [cameras]\nreturns a list of available cameras"
77
#define DOC_CAMERA_CAMERA "Camera(device, (width, height), format) -> Camera\nload a camera"
88
#define DOC_CAMERA_CAMERA_START "start() -> None\nopens, initializes, and starts capturing"

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 *

0 commit comments

Comments
 (0)