Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src_c/_pygame.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ PG_UnlockMutex(SDL_mutex *mutex)
return 0;
}

#define PG_SURF_BitsPerPixel(surf) surf->format->bits_per_pixel
#define PG_SURF_BytesPerPixel(surf) surf->format->bytes_per_pixel
#define PG_SURF_BitsPerPixel(surf) SDL_BITSPERPIXEL(surf->format)
#define PG_SURF_BytesPerPixel(surf) SDL_BYTESPERPIXEL(surf->format)
#define PG_FORMAT_BitsPerPixel(format) format->bits_per_pixel
#define PG_FORMAT_BytesPerPixel(format) format->bytes_per_pixel

Expand Down Expand Up @@ -138,7 +138,7 @@ PG_UnlockMutex(SDL_mutex *mutex)

#define PG_CreateSurface(width, height, format) \
SDL_CreateRGBSurfaceWithFormat(0, width, height, 0, format)
#define PG_CreateSurfaceFrom(pixels, width, height, pitch, format) \
#define PG_CreateSurfaceFrom(width, height, format, pixels, pitch) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure to understand what is happening here. Why the arguments are in a whole new order ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SDL3 changed the order of SDL_CreateSurfaceFrom, so this macro is being updated to match that order

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But then it's not the macro argument order that needs to be changed, but the function arg order that's called.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is only compiled on SDL2, it defines a macro that re-orders the arguments from SDL3 style into the SDL2 function.

SDL_CreateRGBSurfaceWithFormatFrom(pixels, width, height, 0, pitch, format)
#define PG_ConvertSurface(src, fmt) SDL_ConvertSurface(src, fmt, 0)
#define PG_ConvertSurfaceFormat(src, pixel_format) \
Expand Down
Loading