Document that the pitch value may be zero for surfaces that will be filled in by the application later.
Also verify that the pitch isn't zero for surfaces with valid pixels Fixes https://github.com/libsdl-org/SDL/issues/7143
This commit is contained in:
1 parent
e3bada6fbd
commit
d496d187c5
3 files changed
+28
-12
No files matched your search
@@ -621,6 +621,14 @@ int surface_testOverflow(void *arg)
|
||||
SDLTest_AssertCheck(surface == NULL, "Should detect negative pitch");
|
||||
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
|
||||
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
|
||||
surface = SDL_CreateSurfaceFrom(buf, 1, 1, 0, SDL_PIXELFORMAT_RGBA8888);
|
||||
SDLTest_AssertCheck(surface == NULL, "Should detect zero pitch");
|
||||
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
|
||||
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
|
||||
surface = SDL_CreateSurfaceFrom(NULL, 1, 1, 0, SDL_PIXELFORMAT_RGBA8888);
|
||||
SDLTest_AssertCheck(surface != NULL, "Allow zero pitch for partially set up surfaces: %s",
|
||||
surface != NULL ? "(success)" : SDL_GetError());
|
||||
SDL_DestroySurface(surface);
|
||||
|
||||
/* Less than 1 byte per pixel: the pitch can legitimately be less than
|
||||
* the width, but it must be enough to hold the appropriate number of
|
||||
|
||||
Reference in new issue
Block a user