mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-16 17:58:27 +00:00
Pointer as bool (libsdl-org#7214)
This commit is contained in:
parent
23db971681
commit
d8600f717e
371 changed files with 2448 additions and 2442 deletions
|
@ -229,9 +229,9 @@ static int FlushRenderCommands(SDL_Renderer *renderer)
|
|||
{
|
||||
int retval;
|
||||
|
||||
SDL_assert((renderer->render_commands == NULL) == (renderer->render_commands_tail == NULL));
|
||||
SDL_assert((!renderer->render_commands) == (!renderer->render_commands_tail));
|
||||
|
||||
if (renderer->render_commands == NULL) { /* nothing to do! */
|
||||
if (!renderer->render_commands) { /* nothing to do! */
|
||||
SDL_assert(renderer->vertex_data_used == 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ static int FlushRenderCommands(SDL_Renderer *renderer)
|
|||
retval = renderer->RunCommandQueue(renderer, renderer->render_commands, renderer->vertex_data, renderer->vertex_data_used);
|
||||
|
||||
/* Move the whole render command queue to the unused pool so we can reuse them next time. */
|
||||
if (renderer->render_commands_tail != NULL) {
|
||||
if (renderer->render_commands_tail) {
|
||||
renderer->render_commands_tail->next = renderer->render_commands_pool;
|
||||
renderer->render_commands_pool = renderer->render_commands;
|
||||
renderer->render_commands_tail = NULL;
|
||||
|
@ -293,7 +293,7 @@ void *SDL_AllocateRenderVertices(SDL_Renderer *renderer, const size_t numbytes,
|
|||
|
||||
ptr = SDL_realloc(renderer->vertex_data, newsize);
|
||||
|
||||
if (ptr == NULL) {
|
||||
if (!ptr) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
@ -316,19 +316,19 @@ static SDL_RenderCommand *AllocateRenderCommand(SDL_Renderer *renderer)
|
|||
|
||||
/* !!! FIXME: are there threading limitations in SDL's render API? If not, we need to mutex this. */
|
||||
retval = renderer->render_commands_pool;
|
||||
if (retval != NULL) {
|
||||
if (retval) {
|
||||
renderer->render_commands_pool = retval->next;
|
||||
retval->next = NULL;
|
||||
} else {
|
||||
retval = SDL_calloc(1, sizeof(*retval));
|
||||
if (retval == NULL) {
|
||||
if (!retval) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_assert((renderer->render_commands == NULL) == (renderer->render_commands_tail == NULL));
|
||||
if (renderer->render_commands_tail != NULL) {
|
||||
SDL_assert((!renderer->render_commands) == (!renderer->render_commands_tail));
|
||||
if (renderer->render_commands_tail) {
|
||||
renderer->render_commands_tail->next = retval;
|
||||
} else {
|
||||
renderer->render_commands = retval;
|
||||
|
@ -364,7 +364,7 @@ static int QueueCmdSetViewport(SDL_Renderer *renderer)
|
|||
if (!renderer->viewport_queued ||
|
||||
SDL_memcmp(&viewport, &renderer->last_queued_viewport, sizeof(viewport)) != 0) {
|
||||
SDL_RenderCommand *cmd = AllocateRenderCommand(renderer);
|
||||
if (cmd != NULL) {
|
||||
if (cmd) {
|
||||
cmd->command = SDL_RENDERCMD_SETVIEWPORT;
|
||||
cmd->data.viewport.first = 0; /* render backend will fill this in. */
|
||||
SDL_copyp(&cmd->data.viewport.rect, &viewport);
|
||||
|
@ -396,7 +396,7 @@ static int QueueCmdSetClipRect(SDL_Renderer *renderer)
|
|||
renderer->view->clipping_enabled != renderer->last_queued_cliprect_enabled ||
|
||||
SDL_memcmp(&clip_rect, &renderer->last_queued_cliprect, sizeof(clip_rect)) != 0) {
|
||||
SDL_RenderCommand *cmd = AllocateRenderCommand(renderer);
|
||||
if (cmd != NULL) {
|
||||
if (cmd) {
|
||||
cmd->command = SDL_RENDERCMD_SETCLIPRECT;
|
||||
cmd->data.cliprect.enabled = renderer->view->clipping_enabled;
|
||||
SDL_copyp(&cmd->data.cliprect.rect, &clip_rect);
|
||||
|
@ -419,7 +419,7 @@ static int QueueCmdSetDrawColor(SDL_Renderer *renderer, SDL_Color *col)
|
|||
SDL_RenderCommand *cmd = AllocateRenderCommand(renderer);
|
||||
retval = -1;
|
||||
|
||||
if (cmd != NULL) {
|
||||
if (cmd) {
|
||||
cmd->command = SDL_RENDERCMD_SETDRAWCOLOR;
|
||||
cmd->data.color.first = 0; /* render backend will fill this in. */
|
||||
cmd->data.color.r = col->r;
|
||||
|
@ -441,7 +441,7 @@ static int QueueCmdSetDrawColor(SDL_Renderer *renderer, SDL_Color *col)
|
|||
static int QueueCmdClear(SDL_Renderer *renderer)
|
||||
{
|
||||
SDL_RenderCommand *cmd = AllocateRenderCommand(renderer);
|
||||
if (cmd == NULL) {
|
||||
if (!cmd) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -484,7 +484,7 @@ static SDL_RenderCommand *PrepQueueCmdDraw(SDL_Renderer *renderer, const SDL_Ren
|
|||
|
||||
if (retval == 0) {
|
||||
cmd = AllocateRenderCommand(renderer);
|
||||
if (cmd != NULL) {
|
||||
if (cmd) {
|
||||
cmd->command = cmdtype;
|
||||
cmd->data.draw.first = 0; /* render backend will fill this in. */
|
||||
cmd->data.draw.count = 0; /* render backend will fill this in. */
|
||||
|
@ -503,7 +503,7 @@ static int QueueCmdDrawPoints(SDL_Renderer *renderer, const SDL_FPoint *points,
|
|||
{
|
||||
SDL_RenderCommand *cmd = PrepQueueCmdDraw(renderer, SDL_RENDERCMD_DRAW_POINTS, NULL);
|
||||
int retval = -1;
|
||||
if (cmd != NULL) {
|
||||
if (cmd) {
|
||||
retval = renderer->QueueDrawPoints(renderer, cmd, points, count);
|
||||
if (retval < 0) {
|
||||
cmd->command = SDL_RENDERCMD_NO_OP;
|
||||
|
@ -516,7 +516,7 @@ static int QueueCmdDrawLines(SDL_Renderer *renderer, const SDL_FPoint *points, c
|
|||
{
|
||||
SDL_RenderCommand *cmd = PrepQueueCmdDraw(renderer, SDL_RENDERCMD_DRAW_LINES, NULL);
|
||||
int retval = -1;
|
||||
if (cmd != NULL) {
|
||||
if (cmd) {
|
||||
retval = renderer->QueueDrawLines(renderer, cmd, points, count);
|
||||
if (retval < 0) {
|
||||
cmd->command = SDL_RENDERCMD_NO_OP;
|
||||
|
@ -529,11 +529,11 @@ static int QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, con
|
|||
{
|
||||
SDL_RenderCommand *cmd;
|
||||
int retval = -1;
|
||||
const int use_rendergeometry = (renderer->QueueFillRects == NULL);
|
||||
const int use_rendergeometry = (!renderer->QueueFillRects);
|
||||
|
||||
cmd = PrepQueueCmdDraw(renderer, (use_rendergeometry ? SDL_RENDERCMD_GEOMETRY : SDL_RENDERCMD_FILL_RECTS), NULL);
|
||||
|
||||
if (cmd != NULL) {
|
||||
if (cmd) {
|
||||
if (use_rendergeometry) {
|
||||
SDL_bool isstack1;
|
||||
SDL_bool isstack2;
|
||||
|
@ -603,7 +603,7 @@ static int QueueCmdCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_
|
|||
{
|
||||
SDL_RenderCommand *cmd = PrepQueueCmdDraw(renderer, SDL_RENDERCMD_COPY, texture);
|
||||
int retval = -1;
|
||||
if (cmd != NULL) {
|
||||
if (cmd) {
|
||||
retval = renderer->QueueCopy(renderer, cmd, texture, srcrect, dstrect);
|
||||
if (retval < 0) {
|
||||
cmd->command = SDL_RENDERCMD_NO_OP;
|
||||
|
@ -618,7 +618,7 @@ static int QueueCmdCopyEx(SDL_Renderer *renderer, SDL_Texture *texture,
|
|||
{
|
||||
SDL_RenderCommand *cmd = PrepQueueCmdDraw(renderer, SDL_RENDERCMD_COPY_EX, texture);
|
||||
int retval = -1;
|
||||
if (cmd != NULL) {
|
||||
if (cmd) {
|
||||
retval = renderer->QueueCopyEx(renderer, cmd, texture, srcquad, dstrect, angle, center, flip, scale_x, scale_y);
|
||||
if (retval < 0) {
|
||||
cmd->command = SDL_RENDERCMD_NO_OP;
|
||||
|
@ -638,7 +638,7 @@ static int QueueCmdGeometry(SDL_Renderer *renderer, SDL_Texture *texture,
|
|||
SDL_RenderCommand *cmd;
|
||||
int retval = -1;
|
||||
cmd = PrepQueueCmdDraw(renderer, SDL_RENDERCMD_GEOMETRY, texture);
|
||||
if (cmd != NULL) {
|
||||
if (cmd) {
|
||||
retval = renderer->QueueGeometry(renderer, cmd, texture,
|
||||
xy, xy_stride,
|
||||
color, color_stride, uv, uv_stride,
|
||||
|
@ -751,13 +751,13 @@ static SDL_INLINE void VerifyDrawQueueFunctions(const SDL_Renderer *renderer)
|
|||
{
|
||||
/* all of these functions are required to be implemented, even as no-ops, so we don't
|
||||
have to check that they aren't NULL over and over. */
|
||||
SDL_assert(renderer->QueueSetViewport != NULL);
|
||||
SDL_assert(renderer->QueueSetDrawColor != NULL);
|
||||
SDL_assert(renderer->QueueDrawPoints != NULL);
|
||||
SDL_assert(renderer->QueueDrawLines != NULL || renderer->QueueGeometry != NULL);
|
||||
SDL_assert(renderer->QueueFillRects != NULL || renderer->QueueGeometry != NULL);
|
||||
SDL_assert(renderer->QueueCopy != NULL || renderer->QueueGeometry != NULL);
|
||||
SDL_assert(renderer->RunCommandQueue != NULL);
|
||||
SDL_assert(renderer->QueueSetViewport);
|
||||
SDL_assert(renderer->QueueSetDrawColor);
|
||||
SDL_assert(renderer->QueueDrawPoints);
|
||||
SDL_assert(renderer->QueueDrawLines || renderer->QueueGeometry);
|
||||
SDL_assert(renderer->QueueFillRects || renderer->QueueGeometry);
|
||||
SDL_assert(renderer->QueueCopy || renderer->QueueGeometry);
|
||||
SDL_assert(renderer->RunCommandQueue);
|
||||
}
|
||||
|
||||
static SDL_RenderLineMethod SDL_GetRenderLineMethod(void)
|
||||
|
@ -817,7 +817,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 fl
|
|||
Android_ActivityMutex_Lock_Running();
|
||||
#endif
|
||||
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
SDL_InvalidParamError("window");
|
||||
goto error;
|
||||
}
|
||||
|
@ -871,7 +871,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 fl
|
|||
}
|
||||
}
|
||||
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_SetError("Couldn't find matching render driver");
|
||||
goto error;
|
||||
}
|
||||
|
@ -1105,7 +1105,7 @@ static SDL_ScaleMode SDL_GetScaleMode(void)
|
|||
{
|
||||
const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY);
|
||||
|
||||
if (hint == NULL || SDL_strcasecmp(hint, "nearest") == 0) {
|
||||
if (!hint || SDL_strcasecmp(hint, "nearest") == 0) {
|
||||
return SDL_SCALEMODE_NEAREST;
|
||||
} else if (SDL_strcasecmp(hint, "linear") == 0) {
|
||||
return SDL_SCALEMODE_LINEAR;
|
||||
|
@ -1146,7 +1146,7 @@ SDL_Texture *SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access
|
|||
return NULL;
|
||||
}
|
||||
texture = (SDL_Texture *)SDL_calloc(1, sizeof(*texture));
|
||||
if (texture == NULL) {
|
||||
if (!texture) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1243,7 +1243,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
|
|||
|
||||
CHECK_RENDERER_MAGIC(renderer, NULL);
|
||||
|
||||
if (surface == NULL) {
|
||||
if (!surface) {
|
||||
SDL_InvalidParamError("SDL_CreateTextureFromSurface(): surface");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1307,7 +1307,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
|
|||
|
||||
texture = SDL_CreateTexture(renderer, format, SDL_TEXTUREACCESS_STATIC,
|
||||
surface->w, surface->h);
|
||||
if (texture == NULL) {
|
||||
if (!texture) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1339,7 +1339,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
|
|||
|
||||
/* Set up a destination surface for the texture update */
|
||||
dst_fmt = SDL_CreatePixelFormat(format);
|
||||
if (dst_fmt == NULL) {
|
||||
if (!dst_fmt) {
|
||||
SDL_DestroyTexture(texture);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1541,7 +1541,7 @@ static int SDL_UpdateTextureYUV(SDL_Texture *texture, const SDL_Rect *rect,
|
|||
const size_t alloclen = (size_t)rect->h * temp_pitch;
|
||||
if (alloclen > 0) {
|
||||
void *temp_pixels = SDL_malloc(alloclen);
|
||||
if (temp_pixels == NULL) {
|
||||
if (!temp_pixels) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format,
|
||||
|
@ -1581,7 +1581,7 @@ static int SDL_UpdateTextureNative(SDL_Texture *texture, const SDL_Rect *rect,
|
|||
const size_t alloclen = (size_t)rect->h * temp_pitch;
|
||||
if (alloclen > 0) {
|
||||
void *temp_pixels = SDL_malloc(alloclen);
|
||||
if (temp_pixels == NULL) {
|
||||
if (!temp_pixels) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_ConvertPixels(rect->w, rect->h,
|
||||
|
@ -1600,7 +1600,7 @@ int SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pi
|
|||
|
||||
CHECK_TEXTURE_MAGIC(texture, -1);
|
||||
|
||||
if (pixels == NULL) {
|
||||
if (!pixels) {
|
||||
return SDL_InvalidParamError("pixels");
|
||||
}
|
||||
if (!pitch) {
|
||||
|
@ -1674,7 +1674,7 @@ static int SDL_UpdateTextureYUVPlanar(SDL_Texture *texture, const SDL_Rect *rect
|
|||
const size_t alloclen = (size_t)rect->h * temp_pitch;
|
||||
if (alloclen > 0) {
|
||||
void *temp_pixels = SDL_malloc(alloclen);
|
||||
if (temp_pixels == NULL) {
|
||||
if (!temp_pixels) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format,
|
||||
|
@ -1724,7 +1724,7 @@ static int SDL_UpdateTextureNVPlanar(SDL_Texture *texture, const SDL_Rect *rect,
|
|||
const size_t alloclen = (size_t)rect->h * temp_pitch;
|
||||
if (alloclen > 0) {
|
||||
void *temp_pixels = SDL_malloc(alloclen);
|
||||
if (temp_pixels == NULL) {
|
||||
if (!temp_pixels) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format,
|
||||
|
@ -1749,19 +1749,19 @@ int SDL_UpdateYUVTexture(SDL_Texture *texture, const SDL_Rect *rect,
|
|||
|
||||
CHECK_TEXTURE_MAGIC(texture, -1);
|
||||
|
||||
if (Yplane == NULL) {
|
||||
if (!Yplane) {
|
||||
return SDL_InvalidParamError("Yplane");
|
||||
}
|
||||
if (!Ypitch) {
|
||||
return SDL_InvalidParamError("Ypitch");
|
||||
}
|
||||
if (Uplane == NULL) {
|
||||
if (!Uplane) {
|
||||
return SDL_InvalidParamError("Uplane");
|
||||
}
|
||||
if (!Upitch) {
|
||||
return SDL_InvalidParamError("Upitch");
|
||||
}
|
||||
if (Vplane == NULL) {
|
||||
if (!Vplane) {
|
||||
return SDL_InvalidParamError("Vplane");
|
||||
}
|
||||
if (!Vpitch) {
|
||||
|
@ -1815,13 +1815,13 @@ int SDL_UpdateNVTexture(SDL_Texture *texture, const SDL_Rect *rect,
|
|||
|
||||
CHECK_TEXTURE_MAGIC(texture, -1);
|
||||
|
||||
if (Yplane == NULL) {
|
||||
if (!Yplane) {
|
||||
return SDL_InvalidParamError("Yplane");
|
||||
}
|
||||
if (!Ypitch) {
|
||||
return SDL_InvalidParamError("Ypitch");
|
||||
}
|
||||
if (UVplane == NULL) {
|
||||
if (!UVplane) {
|
||||
return SDL_InvalidParamError("UVplane");
|
||||
}
|
||||
if (!UVpitch) {
|
||||
|
@ -1894,7 +1894,7 @@ int SDL_LockTexture(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, i
|
|||
return SDL_SetError("SDL_LockTexture(): texture must be streaming");
|
||||
}
|
||||
|
||||
if (rect == NULL) {
|
||||
if (!rect) {
|
||||
full_rect.x = 0;
|
||||
full_rect.y = 0;
|
||||
full_rect.w = texture->w;
|
||||
|
@ -1929,7 +1929,7 @@ int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Sur
|
|||
int pitch = 0; /* fix static analysis */
|
||||
int ret;
|
||||
|
||||
if (texture == NULL || surface == NULL) {
|
||||
if (!texture || !surface) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1947,7 +1947,7 @@ int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Sur
|
|||
}
|
||||
|
||||
texture->locked_surface = SDL_CreateSurfaceFrom(pixels, real_rect.w, real_rect.h, pitch, texture->format);
|
||||
if (texture->locked_surface == NULL) {
|
||||
if (!texture->locked_surface) {
|
||||
SDL_UnlockTexture(texture);
|
||||
return -1;
|
||||
}
|
||||
|
@ -2074,7 +2074,7 @@ static int SDL_SetRenderTargetInternal(SDL_Renderer *renderer, SDL_Texture *text
|
|||
|
||||
int SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
{
|
||||
if (texture == NULL && renderer->logical_target) {
|
||||
if (!texture && renderer->logical_target) {
|
||||
return SDL_SetRenderTargetInternal(renderer, renderer->logical_target);
|
||||
} else {
|
||||
return SDL_SetRenderTargetInternal(renderer, texture);
|
||||
|
@ -2304,7 +2304,7 @@ static void SDL_RenderLogicalBorders(SDL_Renderer *renderer)
|
|||
|
||||
static void SDL_RenderLogicalPresentation(SDL_Renderer *renderer)
|
||||
{
|
||||
SDL_assert(renderer->target == NULL);
|
||||
SDL_assert(!renderer->target);
|
||||
SDL_SetRenderViewport(renderer, NULL);
|
||||
SDL_SetRenderClipRect(renderer, NULL);
|
||||
SDL_SetRenderScale(renderer, 1.0f, 1.0f);
|
||||
|
@ -2673,7 +2673,7 @@ static int RenderPointsWithRects(SDL_Renderer *renderer, const SDL_FPoint *fpoin
|
|||
}
|
||||
|
||||
frects = SDL_small_alloc(SDL_FRect, count, &isstack);
|
||||
if (frects == NULL) {
|
||||
if (!frects) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
|
@ -2697,7 +2697,7 @@ int SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count
|
|||
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (points == NULL) {
|
||||
if (!points) {
|
||||
return SDL_InvalidParamError("SDL_RenderPoints(): points");
|
||||
}
|
||||
if (count < 1) {
|
||||
|
@ -2784,7 +2784,7 @@ static int RenderLineBresenham(SDL_Renderer *renderer, int x1, int y1, int x2, i
|
|||
}
|
||||
|
||||
points = SDL_small_alloc(SDL_FPoint, numpixels, &isstack);
|
||||
if (points == NULL) {
|
||||
if (!points) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
for (i = 0; i < numpixels; ++i) {
|
||||
|
@ -2827,7 +2827,7 @@ static int RenderLinesWithRectsF(SDL_Renderer *renderer,
|
|||
SDL_bool draw_last = SDL_FALSE;
|
||||
|
||||
frects = SDL_small_alloc(SDL_FRect, count - 1, &isstack);
|
||||
if (frects == NULL) {
|
||||
if (!frects) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
|
@ -2893,7 +2893,7 @@ int SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
|
|||
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (points == NULL) {
|
||||
if (!points) {
|
||||
return SDL_InvalidParamError("SDL_RenderLines(): points");
|
||||
}
|
||||
if (count < 2) {
|
||||
|
@ -3046,7 +3046,7 @@ int SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect)
|
|||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
/* If 'rect' == NULL, then outline the whole surface */
|
||||
if (rect == NULL) {
|
||||
if (!rect) {
|
||||
GetRenderViewportSize(renderer, &frect);
|
||||
rect = &frect;
|
||||
}
|
||||
|
@ -3070,7 +3070,7 @@ int SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
|
|||
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (rects == NULL) {
|
||||
if (!rects) {
|
||||
return SDL_InvalidParamError("SDL_RenderRects(): rects");
|
||||
}
|
||||
if (count < 1) {
|
||||
|
@ -3099,7 +3099,7 @@ int SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect)
|
|||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
/* If 'rect' == NULL, then fill the whole surface */
|
||||
if (rect == NULL) {
|
||||
if (!rect) {
|
||||
GetRenderViewportSize(renderer, &frect);
|
||||
rect = &frect;
|
||||
}
|
||||
|
@ -3115,7 +3115,7 @@ int SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int coun
|
|||
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (rects == NULL) {
|
||||
if (!rects) {
|
||||
return SDL_InvalidParamError("SDL_RenderFillRects(): rects");
|
||||
}
|
||||
if (count < 1) {
|
||||
|
@ -3130,7 +3130,7 @@ int SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int coun
|
|||
#endif
|
||||
|
||||
frects = SDL_small_alloc(SDL_FRect, count, &isstack);
|
||||
if (frects == NULL) {
|
||||
if (!frects) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
for (i = 0; i < count; ++i) {
|
||||
|
@ -3168,7 +3168,7 @@ int SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FR
|
|||
}
|
||||
#endif
|
||||
|
||||
use_rendergeometry = (renderer->QueueCopy == NULL);
|
||||
use_rendergeometry = (!renderer->QueueCopy);
|
||||
|
||||
real_srcrect.x = 0.0f;
|
||||
real_srcrect.y = 0.0f;
|
||||
|
@ -3283,7 +3283,7 @@ int SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
|
|||
}
|
||||
#endif
|
||||
|
||||
use_rendergeometry = (renderer->QueueCopyEx == NULL);
|
||||
use_rendergeometry = (!renderer->QueueCopyEx);
|
||||
|
||||
real_srcrect.x = 0.0f;
|
||||
real_srcrect.y = 0.0f;
|
||||
|
@ -3823,15 +3823,15 @@ int SDL_RenderGeometryRaw(SDL_Renderer *renderer,
|
|||
}
|
||||
}
|
||||
|
||||
if (xy == NULL) {
|
||||
if (!xy) {
|
||||
return SDL_InvalidParamError("xy");
|
||||
}
|
||||
|
||||
if (color == NULL) {
|
||||
if (!color) {
|
||||
return SDL_InvalidParamError("color");
|
||||
}
|
||||
|
||||
if (texture && uv == NULL) {
|
||||
if (texture && !uv) {
|
||||
return SDL_InvalidParamError("uv");
|
||||
}
|
||||
|
||||
|
@ -3923,7 +3923,7 @@ int SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 fo
|
|||
FlushRenderCommands(renderer); /* we need to render before we read the results. */
|
||||
|
||||
if (!format) {
|
||||
if (renderer->target == NULL) {
|
||||
if (!renderer->target) {
|
||||
format = SDL_GetWindowPixelFormat(renderer->window);
|
||||
} else {
|
||||
format = renderer->target->format;
|
||||
|
@ -4078,7 +4078,7 @@ static void SDL_DiscardAllCommands(SDL_Renderer *renderer)
|
|||
{
|
||||
SDL_RenderCommand *cmd;
|
||||
|
||||
if (renderer->render_commands_tail != NULL) {
|
||||
if (renderer->render_commands_tail) {
|
||||
renderer->render_commands_tail->next = renderer->render_commands_pool;
|
||||
cmd = renderer->render_commands;
|
||||
} else {
|
||||
|
@ -4089,7 +4089,7 @@ static void SDL_DiscardAllCommands(SDL_Renderer *renderer)
|
|||
renderer->render_commands_tail = NULL;
|
||||
renderer->render_commands = NULL;
|
||||
|
||||
while (cmd != NULL) {
|
||||
while (cmd) {
|
||||
SDL_RenderCommand *next = cmd->next;
|
||||
SDL_free(cmd);
|
||||
cmd = next;
|
||||
|
@ -4319,7 +4319,7 @@ int SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync)
|
|||
int SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync)
|
||||
{
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
if (vsync == NULL) {
|
||||
if (!vsync) {
|
||||
return SDL_InvalidParamError("vsync");
|
||||
}
|
||||
*vsync = renderer->wanted_vsync;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue