mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-07 03:48:14 +00:00
Check SDL_LockSurface() return value
This commit is contained in:
@@ -135,7 +135,9 @@ static int SW_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
|||||||
size_t length;
|
size_t length;
|
||||||
|
|
||||||
if (SDL_MUSTLOCK(surface)) {
|
if (SDL_MUSTLOCK(surface)) {
|
||||||
SDL_LockSurface(surface);
|
if (SDL_LockSurface(surface) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
src = (Uint8 *)pixels;
|
src = (Uint8 *)pixels;
|
||||||
dst = (Uint8 *)surface->pixels +
|
dst = (Uint8 *)surface->pixels +
|
||||||
@@ -341,7 +343,9 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
|||||||
* necessary because this code is going to access the pixel buffer directly.
|
* necessary because this code is going to access the pixel buffer directly.
|
||||||
*/
|
*/
|
||||||
if (SDL_MUSTLOCK(src)) {
|
if (SDL_MUSTLOCK(src)) {
|
||||||
SDL_LockSurface(src);
|
if (SDL_LockSurface(src) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clone the source surface but use its pixel buffer directly.
|
/* Clone the source surface but use its pixel buffer directly.
|
||||||
|
@@ -561,7 +561,10 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in
|
|||||||
|
|
||||||
/* Lock source surface */
|
/* Lock source surface */
|
||||||
if (SDL_MUSTLOCK(src)) {
|
if (SDL_MUSTLOCK(src)) {
|
||||||
SDL_LockSurface(src);
|
if (SDL_LockSurface(src) < 0) {
|
||||||
|
SDL_DestroySurface(rz_dst);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if the rotation is a multiple of 90 degrees so we can take a fast path and also somewhat reduce
|
/* check if the rotation is a multiple of 90 degrees so we can take a fast path and also somewhat reduce
|
||||||
|
@@ -2045,7 +2045,9 @@ int SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g,
|
|||||||
bytes_per_pixel = SDL_BYTESPERPIXEL(surface->format);
|
bytes_per_pixel = SDL_BYTESPERPIXEL(surface->format);
|
||||||
|
|
||||||
if (SDL_MUSTLOCK(surface)) {
|
if (SDL_MUSTLOCK(surface)) {
|
||||||
SDL_LockSurface(surface);
|
if (SDL_LockSurface(surface) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p = (Uint8 *)surface->pixels + y * surface->pitch + x * bytes_per_pixel;
|
p = (Uint8 *)surface->pixels + y * surface->pitch + x * bytes_per_pixel;
|
||||||
|
Reference in New Issue
Block a user