Skip to content

Commit 03bbbd4

Browse files
committed
Fix SURF_GET_AT macro for SDL3
1 parent e91c585 commit 03bbbd4

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src_c/draw.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2472,9 +2472,8 @@ draw_line(SDL_Surface *surf, SDL_Rect surf_clip_rect, int x1, int y1, int x2,
24722472
}
24732473
set_and_check_rect(surf, surf_clip_rect, x2, y2, color, drawn_area);
24742474
}
2475-
2476-
#define SURF_GET_AT(p_color, p_surf, p_x, p_y, p_pixels, p_format, p_pix) \
2477-
switch (PG_FORMAT_BytesPerPixel(p_format)) { \
2475+
#define SURF_GET_AT(p_color, p_surf, p_x, p_y, p_pixels, p_pix) \
2476+
switch (PG_SURF_BytesPerPixel(p_surf)) { \
24782477
case 1: \
24792478
p_color = (Uint32) * \
24802479
((Uint8 *)(p_pixels) + (p_y) * p_surf->pitch + (p_x)); \
@@ -2549,8 +2548,7 @@ flood_fill_inner(SDL_Surface *surf, int x1, int y1, Uint32 new_color,
25492548
goto flood_fill_finished;
25502549
}
25512550

2552-
SURF_GET_AT(old_color, surf, x1, y1, (Uint8 *)surf->pixels, surf->format,
2553-
pix);
2551+
SURF_GET_AT(old_color, surf, x1, y1, (Uint8 *)surf->pixels, pix);
25542552

25552553
if (pattern == NULL && old_color == new_color) {
25562554
// not an error, but nothing to do here
@@ -2573,16 +2571,15 @@ flood_fill_inner(SDL_Surface *surf, int x1, int y1, Uint32 new_color,
25732571

25742572
Uint32 current_color = 0;
25752573

2576-
SURF_GET_AT(current_color, surf, x, y, (Uint8 *)surf->pixels,
2577-
surf->format, pix);
2574+
SURF_GET_AT(current_color, surf, x, y, (Uint8 *)surf->pixels, pix);
25782575

25792576
if (current_color != old_color) {
25802577
continue;
25812578
}
25822579

25832580
if (pattern != NULL) {
25842581
SURF_GET_AT(new_color, pattern, x % pattern->w, y % pattern->h,
2585-
(Uint8 *)pattern->pixels, pattern->format, pix);
2582+
(Uint8 *)pattern->pixels, pix);
25862583
}
25872584

25882585
// clipping and color mapping have already happened here

0 commit comments

Comments
 (0)