mirror of
https://github.com/encounter/SDL.git
synced 2025-12-16 00:17:18 +00:00
use SDL_InvalidParamError or SDL_assert instead of custom SDL_SetError
This commit is contained in:
@@ -238,7 +238,7 @@ int
|
||||
SDL_FillRect(SDL_Surface * dst, const SDL_Rect * rect, Uint32 color)
|
||||
{
|
||||
if (!dst) {
|
||||
return SDL_SetError("Passed NULL destination surface");
|
||||
return SDL_InvalidParamError("SDL_FillRect(): dst");
|
||||
}
|
||||
|
||||
/* If 'rect' == NULL, then fill the whole surface */
|
||||
@@ -306,12 +306,12 @@ SDL_FillRects(SDL_Surface * dst, const SDL_Rect * rects, int count,
|
||||
int i;
|
||||
|
||||
if (!dst) {
|
||||
return SDL_SetError("Passed NULL destination surface");
|
||||
return SDL_InvalidParamError("SDL_FillRects(): dst");
|
||||
}
|
||||
|
||||
/* This function doesn't work on surfaces < 8 bpp */
|
||||
if (dst->format->BitsPerPixel < 8) {
|
||||
return SDL_SetError("SDL_FillRect(): Unsupported surface format");
|
||||
return SDL_SetError("SDL_FillRects(): Unsupported surface format");
|
||||
}
|
||||
|
||||
/* Nothing to do */
|
||||
@@ -321,11 +321,11 @@ SDL_FillRects(SDL_Surface * dst, const SDL_Rect * rects, int count,
|
||||
|
||||
/* Perform software fill */
|
||||
if (!dst->pixels) {
|
||||
return SDL_SetError("SDL_FillRect(): You must lock the surface");
|
||||
return SDL_SetError("SDL_FillRects(): You must lock the surface");
|
||||
}
|
||||
|
||||
if (!rects) {
|
||||
return SDL_SetError("SDL_FillRects() passed NULL rects");
|
||||
return SDL_InvalidParamError("SDL_FillRects(): rects");
|
||||
}
|
||||
|
||||
#if SDL_ARM_NEON_BLITTERS
|
||||
|
||||
@@ -677,7 +677,7 @@ int
|
||||
SDL_SetPixelFormatPalette(SDL_PixelFormat * format, SDL_Palette *palette)
|
||||
{
|
||||
if (!format) {
|
||||
return SDL_SetError("SDL_SetPixelFormatPalette() passed NULL format");
|
||||
return SDL_InvalidParamError("SDL_SetPixelFormatPalette(): format");
|
||||
}
|
||||
|
||||
if (palette && palette->ncolors > (1 << format->BitsPerPixel)) {
|
||||
|
||||
@@ -219,7 +219,7 @@ int
|
||||
SDL_SetSurfacePalette(SDL_Surface * surface, SDL_Palette * palette)
|
||||
{
|
||||
if (!surface) {
|
||||
return SDL_SetError("SDL_SetSurfacePalette() passed a NULL surface");
|
||||
return SDL_InvalidParamError("SDL_SetSurfacePalette(): surface");
|
||||
}
|
||||
if (SDL_SetPixelFormatPalette(surface->format, palette) < 0) {
|
||||
return -1;
|
||||
@@ -646,7 +646,7 @@ SDL_UpperBlit(SDL_Surface * src, const SDL_Rect * srcrect,
|
||||
|
||||
/* Make sure the surfaces aren't locked */
|
||||
if (!src || !dst) {
|
||||
return SDL_SetError("SDL_UpperBlit: passed a NULL surface");
|
||||
return SDL_InvalidParamError("SDL_UpperBlit(): src/dst");
|
||||
}
|
||||
if (src->locked || dst->locked) {
|
||||
return SDL_SetError("Surfaces must not be locked during blit");
|
||||
@@ -757,7 +757,7 @@ SDL_PrivateUpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect,
|
||||
|
||||
/* Make sure the surfaces aren't locked */
|
||||
if (!src || !dst) {
|
||||
return SDL_SetError("SDL_UpperBlitScaled: passed a NULL surface");
|
||||
return SDL_InvalidParamError("SDL_UpperBlitScaled(): src/dst");
|
||||
}
|
||||
if (src->locked || dst->locked) {
|
||||
return SDL_SetError("Surfaces must not be locked during blit");
|
||||
|
||||
@@ -984,7 +984,7 @@ SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay * display,
|
||||
SDL_DisplayMode *current, *match;
|
||||
|
||||
if (!mode || !closest) {
|
||||
SDL_SetError("Missing desired mode or closest mode parameter");
|
||||
SDL_InvalidParamError("mode/closest");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user