Skip to content

Commit

Permalink
Feedback applied.
Browse files Browse the repository at this point in the history
  • Loading branch information
gresm committed Nov 12, 2024
1 parent 23ff10a commit 5181505
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 73 deletions.
15 changes: 6 additions & 9 deletions src_c/_pygame.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#ifndef _PYGAME_INTERNAL_H
#define _PYGAME_INTERNAL_H

#include <stdbool.h>

#include "pgplatform.h"
/*
If PY_SSIZE_T_CLEAN is defined before including Python.h, length is a
Expand Down Expand Up @@ -86,7 +88,7 @@
#define PG_GetSurfacePalette SDL_GetSurfacePalette
#define PG_SurfaceMapRGBA(surf, r, g, b, a) \
SDL_MapSurfaceRGBA(surf, r, g, b, a)
#define PG_GetSurfaceClipRect(surf, rect) SDL_GetSurfaceClipRect(surf, rect)
#define PG_GetSurfaceClipRect SDL_GetSurfaceClipRect

#define PG_SurfaceHasRLE SDL_SurfaceHasRLE

Expand All @@ -109,12 +111,7 @@ PG_UnlockMutex(SDL_mutex *mutex)
return 0;
}

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

#define PG_SURF_BitsPerPixel(surf) SDL_BITSPERPIXEL(surf->format)
#define PG_SURF_BytesPerPixel(surf) SDL_BYTESPERPIXEL(surf->format)
Expand Down Expand Up @@ -192,10 +189,10 @@ PG_UnlockMutex(SDL_mutex *mutex)
return SDL_UnlockMutex(mutex);
}

static inline int
static inline bool
PG_FillRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color)
{
return SDL_FillRect(dst, rect, color);
return SDL_FillRect(dst, rect, color) != -1;
}

#define PG_SURF_BitsPerPixel(surf) surf->format->BitsPerPixel
Expand Down
Loading

0 comments on commit 5181505

Please sign in to comment.