Skip to content

Commit 6aaa776

Browse files
committed
Image module SDL3 support
- Rework argument order of PG_CreateSurfaceFrom to match newest SDL3 (they changed it) - Deal with all the pixelformat fallout throughout the file - Fix TGA saving routine file writes - Switch out SDL_SetPaletteColors (all colors) for SDL_SetSurfacePalette
1 parent 6e0e0c6 commit 6aaa776

File tree

5 files changed

+143
-88
lines changed

5 files changed

+143
-88
lines changed

src_c/_pygame.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ PG_UnlockMutex(SDL_mutex *mutex)
9898
return 0;
9999
}
100100

101-
#define PG_SURF_BitsPerPixel(surf) surf->format->bits_per_pixel
102-
#define PG_SURF_BytesPerPixel(surf) surf->format->bytes_per_pixel
101+
#define PG_SURF_BitsPerPixel(surf) SDL_BITSPERPIXEL(surf->format)
102+
#define PG_SURF_BytesPerPixel(surf) SDL_BYTESPERPIXEL(surf->format)
103103
#define PG_FORMAT_BitsPerPixel(format) format->bits_per_pixel
104104
#define PG_FORMAT_BytesPerPixel(format) format->bytes_per_pixel
105105

@@ -138,7 +138,7 @@ PG_UnlockMutex(SDL_mutex *mutex)
138138

139139
#define PG_CreateSurface(width, height, format) \
140140
SDL_CreateRGBSurfaceWithFormat(0, width, height, 0, format)
141-
#define PG_CreateSurfaceFrom(pixels, width, height, pitch, format) \
141+
#define PG_CreateSurfaceFrom(width, height, format, pixels, pitch) \
142142
SDL_CreateRGBSurfaceWithFormatFrom(pixels, width, height, 0, pitch, format)
143143
#define PG_ConvertSurface(src, fmt) SDL_ConvertSurface(src, fmt, 0)
144144
#define PG_ConvertSurfaceFormat(src, pixel_format) \

0 commit comments

Comments
 (0)