Skip to content

SDL_StretchSurface's documentation is outdated #13135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Slartibarty opened this issue May 27, 2025 · 1 comment
Closed

SDL_StretchSurface's documentation is outdated #13135

Slartibarty opened this issue May 27, 2025 · 1 comment
Milestone

Comments

@Slartibarty
Copy link

The comment above SDL_StretchSurface explains that srcrect and dstrect may not be NULL, but the actual implementation has code that handles this situation in a similar fashion to SDL_BlitSurfaceScaled. The comment is correct for SDL2, but the behaviour changed at some point for SDL3.

The docs:

 * \param srcrect the SDL_Rect structure representing the rectangle to be
 *                copied, may not be NULL.
 * \param dst the SDL_Surface structure that is the blit target.
 * \param dstrect the SDL_Rect structure representing the target rectangle in
 *                the destination surface, may not be NULL.

The code (same for both rects):

    if (dstrect) {
        if ((dstrect->x < 0) || (dstrect->y < 0) ||
            ((dstrect->x + dstrect->w) > dst->w) ||
            ((dstrect->y + dstrect->h) > dst->h)) {
            return SDL_SetError("Invalid destination blit rectangle");
        }
    } else {
        full_dst.x = 0;
        full_dst.y = 0;
        full_dst.w = dst->w;
        full_dst.h = dst->h;
        dstrect = &full_dst;
    }
slouken added a commit that referenced this issue May 29, 2025
Fixes #13135

(cherry picked from commit 7db0ac7)
@slouken slouken added this to the 3.2.16 milestone May 29, 2025
@slouken
Copy link
Collaborator

slouken commented May 29, 2025

Fixed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants