mirror of
https://github.com/encounter/SDL.git
synced 2025-12-10 14:07:50 +00:00
use SDL_InvalidParamError or SDL_assert instead of custom SDL_SetError
This commit is contained in:
@@ -48,13 +48,13 @@ this should probably be removed at some point in the future. --ryan. */
|
||||
|
||||
#define CHECK_RENDERER_MAGIC(renderer, retval) \
|
||||
if (!renderer || renderer->magic != &renderer_magic) { \
|
||||
SDL_SetError("Invalid renderer"); \
|
||||
SDL_InvalidParamError("renderer"); \
|
||||
return retval; \
|
||||
}
|
||||
|
||||
#define CHECK_TEXTURE_MAGIC(texture, retval) \
|
||||
if (!texture || texture->magic != &texture_magic) { \
|
||||
SDL_SetError("Invalid texture"); \
|
||||
SDL_InvalidParamError("texture"); \
|
||||
return retval; \
|
||||
}
|
||||
|
||||
@@ -1326,7 +1326,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface)
|
||||
CHECK_RENDERER_MAGIC(renderer, NULL);
|
||||
|
||||
if (!surface) {
|
||||
SDL_SetError("SDL_CreateTextureFromSurface() passed NULL surface");
|
||||
SDL_InvalidParamError("SDL_CreateTextureFromSurface(): surface");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2694,7 +2694,7 @@ SDL_RenderDrawPoints(SDL_Renderer * renderer,
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (!points) {
|
||||
return SDL_SetError("SDL_RenderDrawPoints(): Passed NULL points");
|
||||
return SDL_InvalidParamError("SDL_RenderDrawPoints(): points");
|
||||
}
|
||||
if (count < 1) {
|
||||
return 0;
|
||||
@@ -2764,7 +2764,7 @@ SDL_RenderDrawPointsF(SDL_Renderer * renderer,
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (!points) {
|
||||
return SDL_SetError("SDL_RenderDrawPointsF(): Passed NULL points");
|
||||
return SDL_InvalidParamError("SDL_RenderDrawPointsF(): points");
|
||||
}
|
||||
if (count < 1) {
|
||||
return 0;
|
||||
@@ -2973,7 +2973,7 @@ SDL_RenderDrawLines(SDL_Renderer * renderer,
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (!points) {
|
||||
return SDL_SetError("SDL_RenderDrawLines(): Passed NULL points");
|
||||
return SDL_InvalidParamError("SDL_RenderDrawLines(): points");
|
||||
}
|
||||
if (count < 2) {
|
||||
return 0;
|
||||
@@ -3012,7 +3012,7 @@ SDL_RenderDrawLinesF(SDL_Renderer * renderer,
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (!points) {
|
||||
return SDL_SetError("SDL_RenderDrawLinesF(): Passed NULL points");
|
||||
return SDL_InvalidParamError("SDL_RenderDrawLinesF(): points");
|
||||
}
|
||||
if (count < 2) {
|
||||
return 0;
|
||||
@@ -3211,7 +3211,7 @@ SDL_RenderDrawRects(SDL_Renderer * renderer,
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (!rects) {
|
||||
return SDL_SetError("SDL_RenderDrawRects(): Passed NULL rects");
|
||||
return SDL_InvalidParamError("SDL_RenderDrawRects(): rects");
|
||||
}
|
||||
if (count < 1) {
|
||||
return 0;
|
||||
@@ -3241,7 +3241,7 @@ SDL_RenderDrawRectsF(SDL_Renderer * renderer,
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (!rects) {
|
||||
return SDL_SetError("SDL_RenderDrawRects(): Passed NULL rects");
|
||||
return SDL_InvalidParamError("SDL_RenderDrawRectsF(): rects");
|
||||
}
|
||||
if (count < 1) {
|
||||
return 0;
|
||||
@@ -3308,7 +3308,7 @@ SDL_RenderFillRects(SDL_Renderer * renderer,
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (!rects) {
|
||||
return SDL_SetError("SDL_RenderFillRects(): Passed NULL rects");
|
||||
return SDL_InvalidParamError("SDL_RenderFillRects(): rects");
|
||||
}
|
||||
if (count < 1) {
|
||||
return 0;
|
||||
@@ -3351,7 +3351,7 @@ SDL_RenderFillRectsF(SDL_Renderer * renderer,
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (!rects) {
|
||||
return SDL_SetError("SDL_RenderFillFRects(): Passed NULL rects");
|
||||
return SDL_InvalidParamError("SDL_RenderFillRectsF(): rects");
|
||||
}
|
||||
if (count < 1) {
|
||||
return 0;
|
||||
|
||||
@@ -220,7 +220,7 @@ SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect,
|
||||
SDL_Rect clipped;
|
||||
|
||||
if (!dst) {
|
||||
return SDL_SetError("Passed NULL destination surface");
|
||||
return SDL_InvalidParamError("SDL_BlendFillRect(): dst");
|
||||
}
|
||||
|
||||
/* This function doesn't work on surfaces < 8 bpp */
|
||||
@@ -291,7 +291,7 @@ SDL_BlendFillRects(SDL_Surface * dst, const SDL_Rect * rects, int count,
|
||||
int status = 0;
|
||||
|
||||
if (!dst) {
|
||||
return SDL_SetError("Passed NULL destination surface");
|
||||
return SDL_InvalidParamError("SDL_BlendFillRects(): dst");
|
||||
}
|
||||
|
||||
/* This function doesn't work on surfaces < 8 bpp */
|
||||
|
||||
@@ -809,7 +809,7 @@ SDL_BlendLine(SDL_Surface * dst, int x1, int y1, int x2, int y2,
|
||||
BlendLineFunc func;
|
||||
|
||||
if (!dst) {
|
||||
return SDL_SetError("SDL_BlendLine(): Passed NULL destination surface");
|
||||
return SDL_InvalidParamError("SDL_BlendLine(): dst");
|
||||
}
|
||||
|
||||
func = SDL_CalculateBlendLineFunc(dst->format);
|
||||
|
||||
@@ -218,7 +218,7 @@ SDL_BlendPoint(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r
|
||||
Uint8 g, Uint8 b, Uint8 a)
|
||||
{
|
||||
if (!dst) {
|
||||
return SDL_SetError("Passed NULL destination surface");
|
||||
return SDL_InvalidParamError("SDL_BlendPoint(): dst");
|
||||
}
|
||||
|
||||
/* This function doesn't work on surfaces < 8 bpp */
|
||||
@@ -287,7 +287,7 @@ SDL_BlendPoints(SDL_Surface * dst, const SDL_Point * points, int count,
|
||||
int status = 0;
|
||||
|
||||
if (!dst) {
|
||||
return SDL_SetError("Passed NULL destination surface");
|
||||
return SDL_InvalidParamError("SDL_BlendPoints(): dst");
|
||||
}
|
||||
|
||||
/* This function doesn't work on surfaces < 8 bpp */
|
||||
|
||||
@@ -144,7 +144,7 @@ SDL_DrawLine(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color)
|
||||
DrawLineFunc func;
|
||||
|
||||
if (!dst) {
|
||||
return SDL_SetError("SDL_DrawLine(): Passed NULL destination surface");
|
||||
return SDL_InvalidParamError("SDL_DrawLine(): dst");
|
||||
}
|
||||
|
||||
func = SDL_CalculateDrawLineFunc(dst->format);
|
||||
@@ -173,7 +173,7 @@ SDL_DrawLines(SDL_Surface * dst, const SDL_Point * points, int count,
|
||||
DrawLineFunc func;
|
||||
|
||||
if (!dst) {
|
||||
return SDL_SetError("SDL_DrawLines(): Passed NULL destination surface");
|
||||
return SDL_InvalidParamError("SDL_DrawLines(): dst");
|
||||
}
|
||||
|
||||
func = SDL_CalculateDrawLineFunc(dst->format);
|
||||
|
||||
@@ -30,7 +30,7 @@ int
|
||||
SDL_DrawPoint(SDL_Surface * dst, int x, int y, Uint32 color)
|
||||
{
|
||||
if (!dst) {
|
||||
return SDL_SetError("Passed NULL destination surface");
|
||||
return SDL_InvalidParamError("SDL_DrawPoint(): dst");
|
||||
}
|
||||
|
||||
/* This function doesn't work on surfaces < 8 bpp */
|
||||
@@ -71,7 +71,7 @@ SDL_DrawPoints(SDL_Surface * dst, const SDL_Point * points, int count,
|
||||
int x, y;
|
||||
|
||||
if (!dst) {
|
||||
return SDL_SetError("Passed NULL destination surface");
|
||||
return SDL_InvalidParamError("SDL_DrawPoints(): dst");
|
||||
}
|
||||
|
||||
/* This function doesn't work on surfaces < 8 bpp */
|
||||
|
||||
@@ -994,7 +994,7 @@ SW_CreateRendererForSurface(SDL_Surface * surface)
|
||||
SW_RenderData *data;
|
||||
|
||||
if (!surface) {
|
||||
SDL_SetError("Can't create renderer for NULL surface");
|
||||
SDL_InvalidParamError("surface");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user