Skip to content

Commit 5181505

Browse files
committed
Feedback applied.
1 parent 23ff10a commit 5181505

File tree

3 files changed

+168
-73
lines changed

3 files changed

+168
-73
lines changed

src_c/_pygame.h

+6-9
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#ifndef _PYGAME_INTERNAL_H
2727
#define _PYGAME_INTERNAL_H
2828

29+
#include <stdbool.h>
30+
2931
#include "pgplatform.h"
3032
/*
3133
If PY_SSIZE_T_CLEAN is defined before including Python.h, length is a
@@ -86,7 +88,7 @@
8688
#define PG_GetSurfacePalette SDL_GetSurfacePalette
8789
#define PG_SurfaceMapRGBA(surf, r, g, b, a) \
8890
SDL_MapSurfaceRGBA(surf, r, g, b, a)
89-
#define PG_GetSurfaceClipRect(surf, rect) SDL_GetSurfaceClipRect(surf, rect)
91+
#define PG_GetSurfaceClipRect SDL_GetSurfaceClipRect
9092

9193
#define PG_SurfaceHasRLE SDL_SurfaceHasRLE
9294

@@ -109,12 +111,7 @@ PG_UnlockMutex(SDL_mutex *mutex)
109111
return 0;
110112
}
111113

112-
/* Emulating SDL2 SDL_FillRect API. In SDL3, it returns -1 on failure. */
113-
static inline int
114-
PG_FillRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color)
115-
{
116-
return SDL_FillSurfaceRect(dst, rect, color) ? 0 : -1;
117-
}
114+
#define PG_FillRect SDL_FillSurfaceRect
118115

119116
#define PG_SURF_BitsPerPixel(surf) SDL_BITSPERPIXEL(surf->format)
120117
#define PG_SURF_BytesPerPixel(surf) SDL_BYTESPERPIXEL(surf->format)
@@ -192,10 +189,10 @@ PG_UnlockMutex(SDL_mutex *mutex)
192189
return SDL_UnlockMutex(mutex);
193190
}
194191

195-
static inline int
192+
static inline bool
196193
PG_FillRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color)
197194
{
198-
return SDL_FillRect(dst, rect, color);
195+
return SDL_FillRect(dst, rect, color) != -1;
199196
}
200197

201198
#define PG_SURF_BitsPerPixel(surf) surf->format->BitsPerPixel

0 commit comments

Comments
 (0)