Skip to content

Commit 717d6d0

Browse files
authored
Merge pull request #3314 from Starbuck5/transform-sdl3-a-bit
Move transform towards compiling w/ SDL3
2 parents efeb3ff + 52967d0 commit 717d6d0

File tree

4 files changed

+174
-86
lines changed

4 files changed

+174
-86
lines changed

src_c/_pygame.h

+8
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ PG_GetSurfaceFormat(SDL_Surface *surf)
130130
return SDL_GetPixelFormatDetails(surf->format);
131131
}
132132

133+
#define PG_GetSurfacePalette SDL_GetSurfacePalette
134+
133135
#define PG_GetRGBA SDL_GetRGBA
134136
#define PG_GetRGB SDL_GetRGB
135137
#define PG_MapRGBA SDL_MapRGBA
@@ -225,6 +227,12 @@ PG_GetSurfaceFormat(SDL_Surface *surf)
225227
return surf->format;
226228
}
227229

230+
static inline SDL_Palette *
231+
PG_GetSurfacePalette(SDL_Surface *surf)
232+
{
233+
return surf->format->palette;
234+
}
235+
228236
// NOTE:
229237
// palette is part of the format in SDL2, so these functions below have it
230238
// as a separate parameter to be consistent with the SDL3 signature.

src_c/meson.build

-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ surface = py.extension_module(
134134
)
135135
endif
136136

137-
# TODO: support SDL3
138137
surflock = py.extension_module(
139138
'surflock',
140139
'surflock.c',

src_c/scale2x.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ scale2x(SDL_Surface *src, SDL_Surface *dst)
7373
const int height = src->h;
7474

7575
#if SDL_VERSION_ATLEAST(3, 0, 0)
76-
const Uint8 Bpp = src->format->bytes_per_pixel;
76+
const Uint8 Bpp = SDL_BYTESPERPIXEL(src->format);
7777
#else
7878
const Uint8 Bpp = src->format->BytesPerPixel;
7979
#endif

0 commit comments

Comments
 (0)