mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-01 13:21:56 +00:00
[SDL2] pointer boolean (#8523)
This commit is contained in:
@@ -237,9 +237,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;
|
||||
}
|
||||
@@ -249,7 +249,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;
|
||||
@@ -301,7 +301,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;
|
||||
}
|
||||
@@ -324,19 +324,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;
|
||||
@@ -352,7 +352,7 @@ static int QueueCmdSetViewport(SDL_Renderer *renderer)
|
||||
if (!renderer->viewport_queued || (SDL_memcmp(&renderer->viewport, &renderer->last_queued_viewport, sizeof(SDL_DRect)) != 0)) {
|
||||
SDL_RenderCommand *cmd = AllocateRenderCommand(renderer);
|
||||
retval = -1;
|
||||
if (cmd != NULL) {
|
||||
if (cmd) {
|
||||
cmd->command = SDL_RENDERCMD_SETVIEWPORT;
|
||||
cmd->data.viewport.first = 0; /* render backend will fill this in. */
|
||||
/* Convert SDL_DRect to SDL_Rect */
|
||||
@@ -379,7 +379,7 @@ static int QueueCmdSetClipRect(SDL_Renderer *renderer)
|
||||
(renderer->clipping_enabled != renderer->last_queued_cliprect_enabled) ||
|
||||
(SDL_memcmp(&renderer->clip_rect, &renderer->last_queued_cliprect, sizeof(SDL_DRect)) != 0)) {
|
||||
SDL_RenderCommand *cmd = AllocateRenderCommand(renderer);
|
||||
if (cmd == NULL) {
|
||||
if (!cmd) {
|
||||
retval = -1;
|
||||
} else {
|
||||
cmd->command = SDL_RENDERCMD_SETCLIPRECT;
|
||||
@@ -406,7 +406,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;
|
||||
@@ -428,7 +428,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;
|
||||
}
|
||||
|
||||
@@ -472,7 +472,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. */
|
||||
@@ -491,7 +491,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;
|
||||
@@ -504,7 +504,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;
|
||||
@@ -517,11 +517,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;
|
||||
@@ -591,7 +591,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;
|
||||
@@ -606,7 +606,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;
|
||||
@@ -626,7 +626,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,
|
||||
@@ -883,13 +883,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()
|
||||
@@ -945,7 +945,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags)
|
||||
Android_ActivityMutex_Lock_Running();
|
||||
#endif
|
||||
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
SDL_InvalidParamError("window");
|
||||
goto error;
|
||||
}
|
||||
@@ -986,7 +986,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags)
|
||||
}
|
||||
}
|
||||
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
for (index = 0; index < n; ++index) {
|
||||
const SDL_RenderDriver *driver = render_drivers[index];
|
||||
|
||||
@@ -1000,7 +1000,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_SetError("Couldn't find matching render driver");
|
||||
goto error;
|
||||
}
|
||||
@@ -1013,7 +1013,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags)
|
||||
/* Create a new renderer instance */
|
||||
renderer = render_drivers[index]->CreateRenderer(window, flags);
|
||||
batching = SDL_FALSE;
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
@@ -1228,7 +1228,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_ScaleModeNearest;
|
||||
} else if (SDL_strcasecmp(hint, "linear") == 0) {
|
||||
return SDL_ScaleModeLinear;
|
||||
@@ -1269,7 +1269,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;
|
||||
}
|
||||
@@ -1360,7 +1360,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;
|
||||
}
|
||||
@@ -1424,7 +1424,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;
|
||||
}
|
||||
|
||||
@@ -1468,7 +1468,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
|
||||
|
||||
/* Set up a destination surface for the texture update */
|
||||
dst_fmt = SDL_AllocFormat(format);
|
||||
if (dst_fmt == NULL) {
|
||||
if (!dst_fmt) {
|
||||
SDL_DestroyTexture(texture);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1687,7 +1687,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,
|
||||
@@ -1727,7 +1727,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,
|
||||
@@ -1747,7 +1747,7 @@ int SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect,
|
||||
|
||||
CHECK_TEXTURE_MAGIC(texture, -1);
|
||||
|
||||
if (pixels == NULL) {
|
||||
if (!pixels) {
|
||||
return SDL_InvalidParamError("pixels");
|
||||
}
|
||||
if (!pitch) {
|
||||
@@ -1821,7 +1821,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,
|
||||
@@ -1871,7 +1871,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,
|
||||
@@ -1896,19 +1896,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) {
|
||||
@@ -1962,13 +1962,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) {
|
||||
@@ -2042,7 +2042,7 @@ int SDL_LockTexture(SDL_Texture *texture, const SDL_Rect *rect,
|
||||
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;
|
||||
@@ -2078,7 +2078,7 @@ int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect,
|
||||
int pitch = 0; /* fix static analysis */
|
||||
int ret;
|
||||
|
||||
if (texture == NULL || surface == NULL) {
|
||||
if (!texture || !surface) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2096,7 +2096,7 @@ int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect,
|
||||
}
|
||||
|
||||
texture->locked_surface = SDL_CreateRGBSurfaceWithFormatFrom(pixels, real_rect.w, real_rect.h, 0, pitch, texture->format);
|
||||
if (texture->locked_surface == NULL) {
|
||||
if (!texture->locked_surface) {
|
||||
SDL_UnlockTexture(texture);
|
||||
return -1;
|
||||
}
|
||||
@@ -2172,7 +2172,7 @@ void SDL_UnlockTexture(SDL_Texture *texture)
|
||||
|
||||
SDL_bool SDL_RenderTargetSupported(SDL_Renderer *renderer)
|
||||
{
|
||||
if (renderer == NULL || !renderer->SetRenderTarget) {
|
||||
if (!renderer || !renderer->SetRenderTarget) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
return (renderer->info.flags & SDL_RENDERER_TARGETTEXTURE) != 0;
|
||||
@@ -2660,7 +2660,7 @@ static int RenderDrawPointsWithRects(SDL_Renderer *renderer,
|
||||
}
|
||||
|
||||
frects = SDL_small_alloc(SDL_FRect, count, &isstack);
|
||||
if (frects == NULL) {
|
||||
if (!frects) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -2688,7 +2688,7 @@ int SDL_RenderDrawPoints(SDL_Renderer *renderer,
|
||||
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (points == NULL) {
|
||||
if (!points) {
|
||||
return SDL_InvalidParamError("SDL_RenderDrawPoints(): points");
|
||||
}
|
||||
if (count < 1) {
|
||||
@@ -2706,7 +2706,7 @@ int SDL_RenderDrawPoints(SDL_Renderer *renderer,
|
||||
retval = RenderDrawPointsWithRects(renderer, points, count);
|
||||
} else {
|
||||
fpoints = SDL_small_alloc(SDL_FPoint, count, &isstack);
|
||||
if (fpoints == NULL) {
|
||||
if (!fpoints) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
for (i = 0; i < count; ++i) {
|
||||
@@ -2734,7 +2734,7 @@ static int RenderDrawPointsWithRectsF(SDL_Renderer *renderer,
|
||||
}
|
||||
|
||||
frects = SDL_small_alloc(SDL_FRect, count, &isstack);
|
||||
if (frects == NULL) {
|
||||
if (!frects) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -2759,7 +2759,7 @@ int SDL_RenderDrawPointsF(SDL_Renderer *renderer,
|
||||
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (points == NULL) {
|
||||
if (!points) {
|
||||
return SDL_InvalidParamError("SDL_RenderDrawPointsF(): points");
|
||||
}
|
||||
if (count < 1) {
|
||||
@@ -2851,7 +2851,7 @@ static int RenderDrawLineBresenham(SDL_Renderer *renderer, int x1, int y1, int x
|
||||
}
|
||||
|
||||
points = SDL_small_alloc(SDL_FPoint, numpixels, &isstack);
|
||||
if (points == NULL) {
|
||||
if (!points) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
for (i = 0; i < numpixels; ++i) {
|
||||
@@ -2894,7 +2894,7 @@ static int RenderDrawLinesWithRectsF(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();
|
||||
}
|
||||
|
||||
@@ -2964,7 +2964,7 @@ int SDL_RenderDrawLines(SDL_Renderer *renderer,
|
||||
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (points == NULL) {
|
||||
if (!points) {
|
||||
return SDL_InvalidParamError("SDL_RenderDrawLines(): points");
|
||||
}
|
||||
if (count < 2) {
|
||||
@@ -2979,7 +2979,7 @@ int SDL_RenderDrawLines(SDL_Renderer *renderer,
|
||||
#endif
|
||||
|
||||
fpoints = SDL_small_alloc(SDL_FPoint, count, &isstack);
|
||||
if (fpoints == NULL) {
|
||||
if (!fpoints) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -3002,7 +3002,7 @@ int SDL_RenderDrawLinesF(SDL_Renderer *renderer,
|
||||
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (points == NULL) {
|
||||
if (!points) {
|
||||
return SDL_InvalidParamError("SDL_RenderDrawLinesF(): points");
|
||||
}
|
||||
if (count < 2) {
|
||||
@@ -3171,7 +3171,7 @@ int SDL_RenderDrawRectF(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) {
|
||||
RenderGetViewportSize(renderer, &frect);
|
||||
rect = &frect;
|
||||
}
|
||||
@@ -3196,7 +3196,7 @@ int SDL_RenderDrawRects(SDL_Renderer *renderer,
|
||||
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (rects == NULL) {
|
||||
if (!rects) {
|
||||
return SDL_InvalidParamError("SDL_RenderDrawRects(): rects");
|
||||
}
|
||||
if (count < 1) {
|
||||
@@ -3225,7 +3225,7 @@ int SDL_RenderDrawRectsF(SDL_Renderer *renderer,
|
||||
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (rects == NULL) {
|
||||
if (!rects) {
|
||||
return SDL_InvalidParamError("SDL_RenderDrawRectsF(): rects");
|
||||
}
|
||||
if (count < 1) {
|
||||
@@ -3272,7 +3272,7 @@ int SDL_RenderFillRectF(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) {
|
||||
RenderGetViewportSize(renderer, &frect);
|
||||
rect = &frect;
|
||||
}
|
||||
@@ -3289,7 +3289,7 @@ int SDL_RenderFillRects(SDL_Renderer *renderer,
|
||||
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (rects == NULL) {
|
||||
if (!rects) {
|
||||
return SDL_InvalidParamError("SDL_RenderFillRects(): rects");
|
||||
}
|
||||
if (count < 1) {
|
||||
@@ -3304,7 +3304,7 @@ int SDL_RenderFillRects(SDL_Renderer *renderer,
|
||||
#endif
|
||||
|
||||
frects = SDL_small_alloc(SDL_FRect, count, &isstack);
|
||||
if (frects == NULL) {
|
||||
if (!frects) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
for (i = 0; i < count; ++i) {
|
||||
@@ -3331,7 +3331,7 @@ int SDL_RenderFillRectsF(SDL_Renderer *renderer,
|
||||
|
||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||
|
||||
if (rects == NULL) {
|
||||
if (!rects) {
|
||||
return SDL_InvalidParamError("SDL_RenderFillRectsF(): rects");
|
||||
}
|
||||
if (count < 1) {
|
||||
@@ -3346,7 +3346,7 @@ int SDL_RenderFillRectsF(SDL_Renderer *renderer,
|
||||
#endif
|
||||
|
||||
frects = SDL_small_alloc(SDL_FRect, count, &isstack);
|
||||
if (frects == NULL) {
|
||||
if (!frects) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
for (i = 0; i < count; ++i) {
|
||||
@@ -3400,7 +3400,7 @@ int SDL_RenderCopyF(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
}
|
||||
#endif
|
||||
|
||||
use_rendergeometry = (renderer->QueueCopy == NULL);
|
||||
use_rendergeometry = (!renderer->QueueCopy);
|
||||
|
||||
real_srcrect.x = 0;
|
||||
real_srcrect.y = 0;
|
||||
@@ -3540,7 +3540,7 @@ int SDL_RenderCopyExF(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
}
|
||||
#endif
|
||||
|
||||
use_rendergeometry = (renderer->QueueCopyEx == NULL);
|
||||
use_rendergeometry = (!renderer->QueueCopyEx);
|
||||
|
||||
real_srcrect.x = 0;
|
||||
real_srcrect.y = 0;
|
||||
@@ -4071,15 +4071,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");
|
||||
}
|
||||
|
||||
@@ -4171,7 +4171,7 @@ int SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect,
|
||||
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;
|
||||
@@ -4300,7 +4300,7 @@ void SDL_DestroyRenderer(SDL_Renderer *renderer)
|
||||
|
||||
SDL_DelEventWatch(SDL_RendererEventWatch, renderer);
|
||||
|
||||
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 {
|
||||
@@ -4311,7 +4311,7 @@ void SDL_DestroyRenderer(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;
|
||||
|
||||
@@ -47,7 +47,7 @@ SDL_SW_YUVTexture *SDL_SW_CreateYUVTexture(Uint32 format, int w, int h)
|
||||
}
|
||||
|
||||
swdata = (SDL_SW_YUVTexture *)SDL_calloc(1, sizeof(*swdata));
|
||||
if (swdata == NULL) {
|
||||
if (!swdata) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -443,7 +443,7 @@ static int D3D_CreateStagingTexture(IDirect3DDevice9 *device, D3D_TextureRep *te
|
||||
{
|
||||
HRESULT result;
|
||||
|
||||
if (texture->staging == NULL) {
|
||||
if (!texture->staging) {
|
||||
result = IDirect3DDevice9_CreateTexture(device, texture->w, texture->h, 1, 0,
|
||||
texture->d3dfmt, D3DPOOL_SYSTEMMEM, &texture->staging, NULL);
|
||||
if (FAILED(result)) {
|
||||
@@ -535,7 +535,7 @@ static int D3D_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
DWORD usage;
|
||||
|
||||
texturedata = (D3D_TextureData *)SDL_calloc(1, sizeof(*texturedata));
|
||||
if (texturedata == NULL) {
|
||||
if (!texturedata) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
texturedata->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3DTEXF_POINT : D3DTEXF_LINEAR;
|
||||
@@ -573,7 +573,7 @@ static int D3D_RecreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
||||
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
||||
|
||||
if (texturedata == NULL) {
|
||||
if (!texturedata) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -600,7 +600,7 @@ static int D3D_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
||||
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
||||
|
||||
if (texturedata == NULL) {
|
||||
if (!texturedata) {
|
||||
return SDL_SetError("Texture is not currently available");
|
||||
}
|
||||
|
||||
@@ -636,7 +636,7 @@ static int D3D_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
||||
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
||||
|
||||
if (texturedata == NULL) {
|
||||
if (!texturedata) {
|
||||
return SDL_SetError("Texture is not currently available");
|
||||
}
|
||||
|
||||
@@ -660,7 +660,7 @@ static int D3D_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
||||
IDirect3DDevice9 *device = data->device;
|
||||
|
||||
if (texturedata == NULL) {
|
||||
if (!texturedata) {
|
||||
return SDL_SetError("Texture is not currently available");
|
||||
}
|
||||
#if SDL_HAVE_YUV
|
||||
@@ -710,7 +710,7 @@ static void D3D_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
|
||||
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
||||
|
||||
if (texturedata == NULL) {
|
||||
if (!texturedata) {
|
||||
return;
|
||||
}
|
||||
#if SDL_HAVE_YUV
|
||||
@@ -738,7 +738,7 @@ static void D3D_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture
|
||||
{
|
||||
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
||||
|
||||
if (texturedata == NULL) {
|
||||
if (!texturedata) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -754,18 +754,18 @@ static int D3D_SetRenderTargetInternal(SDL_Renderer *renderer, SDL_Texture *text
|
||||
IDirect3DDevice9 *device = data->device;
|
||||
|
||||
/* Release the previous render target if it wasn't the default one */
|
||||
if (data->currentRenderTarget != NULL) {
|
||||
if (data->currentRenderTarget) {
|
||||
IDirect3DSurface9_Release(data->currentRenderTarget);
|
||||
data->currentRenderTarget = NULL;
|
||||
}
|
||||
|
||||
if (texture == NULL) {
|
||||
if (!texture) {
|
||||
IDirect3DDevice9_SetRenderTarget(data->device, 0, data->defaultRenderTarget);
|
||||
return 0;
|
||||
}
|
||||
|
||||
texturedata = (D3D_TextureData *)texture->driverdata;
|
||||
if (texturedata == NULL) {
|
||||
if (!texturedata) {
|
||||
return SDL_SetError("Texture is not currently available");
|
||||
}
|
||||
|
||||
@@ -820,7 +820,7 @@ static int D3D_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, c
|
||||
Vertex *verts = (Vertex *)SDL_AllocateRenderVertices(renderer, vertslen, 0, &cmd->data.draw.first);
|
||||
int i;
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -845,7 +845,7 @@ static int D3D_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL
|
||||
int count = indices ? num_indices : num_vertices;
|
||||
Vertex *verts = (Vertex *)SDL_AllocateRenderVertices(renderer, count * sizeof(Vertex), 0, &cmd->data.draw.first);
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -939,9 +939,9 @@ static int SetupTextureState(D3D_RenderData *data, SDL_Texture *texture, LPDIREC
|
||||
{
|
||||
D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata;
|
||||
|
||||
SDL_assert(*shader == NULL);
|
||||
SDL_assert(!*shader);
|
||||
|
||||
if (texturedata == NULL) {
|
||||
if (!texturedata) {
|
||||
return SDL_SetError("Texture is not currently available");
|
||||
}
|
||||
|
||||
@@ -993,11 +993,11 @@ static int SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd)
|
||||
LPDIRECT3DPIXELSHADER9 shader = NULL;
|
||||
|
||||
/* disable any enabled textures we aren't going to use, let SetupTextureState() do the rest. */
|
||||
if (texture == NULL) {
|
||||
if (!texture) {
|
||||
IDirect3DDevice9_SetTexture(data->device, 0, NULL);
|
||||
}
|
||||
#if SDL_HAVE_YUV
|
||||
if ((newtexturedata == NULL || !newtexturedata->yuv) && (oldtexturedata && oldtexturedata->yuv)) {
|
||||
if ((!newtexturedata || !newtexturedata->yuv) && (oldtexturedata && oldtexturedata->yuv)) {
|
||||
IDirect3DDevice9_SetTexture(data->device, 1, NULL);
|
||||
IDirect3DDevice9_SetTexture(data->device, 2, NULL);
|
||||
}
|
||||
@@ -1391,7 +1391,7 @@ static void D3D_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1417,7 +1417,7 @@ static void D3D_DestroyRenderer(SDL_Renderer *renderer)
|
||||
IDirect3DSurface9_Release(data->defaultRenderTarget);
|
||||
data->defaultRenderTarget = NULL;
|
||||
}
|
||||
if (data->currentRenderTarget != NULL) {
|
||||
if (data->currentRenderTarget) {
|
||||
IDirect3DSurface9_Release(data->currentRenderTarget);
|
||||
data->currentRenderTarget = NULL;
|
||||
}
|
||||
@@ -1468,7 +1468,7 @@ static int D3D_Reset(SDL_Renderer *renderer)
|
||||
IDirect3DSurface9_Release(data->defaultRenderTarget);
|
||||
data->defaultRenderTarget = NULL;
|
||||
}
|
||||
if (data->currentRenderTarget != NULL) {
|
||||
if (data->currentRenderTarget) {
|
||||
IDirect3DSurface9_Release(data->currentRenderTarget);
|
||||
data->currentRenderTarget = NULL;
|
||||
}
|
||||
@@ -1562,13 +1562,13 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||
int displayIndex;
|
||||
|
||||
renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = (D3D_RenderData *)SDL_calloc(1, sizeof(*data));
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
SDL_free(renderer);
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
|
||||
@@ -385,7 +385,7 @@ static ID3D11BlendState *D3D11_CreateBlendState(SDL_Renderer *renderer, SDL_Blen
|
||||
}
|
||||
|
||||
blendModes = (D3D11_BlendMode *)SDL_realloc(data->blendModes, (data->blendModesCount + 1) * sizeof(*blendModes));
|
||||
if (blendModes == NULL) {
|
||||
if (!blendModes) {
|
||||
SAFE_RELEASE(blendState);
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
@@ -442,7 +442,7 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer)
|
||||
}
|
||||
|
||||
CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory");
|
||||
if (CreateDXGIFactoryFunc == NULL) {
|
||||
if (!CreateDXGIFactoryFunc) {
|
||||
result = E_FAIL;
|
||||
goto done;
|
||||
}
|
||||
@@ -740,7 +740,7 @@ static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h)
|
||||
D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
|
||||
#ifdef __WINRT__
|
||||
IUnknown *coreWindow = D3D11_GetCoreWindowFromSDLRenderer(renderer);
|
||||
const BOOL usingXAML = (coreWindow == NULL);
|
||||
const BOOL usingXAML = (!coreWindow);
|
||||
#else
|
||||
IUnknown *coreWindow = NULL;
|
||||
const BOOL usingXAML = FALSE;
|
||||
@@ -929,7 +929,7 @@ static HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer *renderer)
|
||||
#endif
|
||||
} else {
|
||||
result = D3D11_CreateSwapChain(renderer, w, h);
|
||||
if (FAILED(result) || data->swapChain == NULL) {
|
||||
if (FAILED(result) || !data->swapChain) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -1071,7 +1071,7 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
}
|
||||
|
||||
textureData = (D3D11_TextureData *)SDL_calloc(1, sizeof(*textureData));
|
||||
if (textureData == NULL) {
|
||||
if (!textureData) {
|
||||
SDL_OutOfMemory();
|
||||
return -1;
|
||||
}
|
||||
@@ -1232,7 +1232,7 @@ static void D3D11_DestroyTexture(SDL_Renderer *renderer,
|
||||
{
|
||||
D3D11_TextureData *data = (D3D11_TextureData *)texture->driverdata;
|
||||
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1339,7 +1339,7 @@ static int D3D11_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
||||
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
|
||||
|
||||
if (textureData == NULL) {
|
||||
if (!textureData) {
|
||||
return SDL_SetError("Texture is not currently available");
|
||||
}
|
||||
|
||||
@@ -1384,7 +1384,7 @@ static int D3D11_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
||||
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
|
||||
|
||||
if (textureData == NULL) {
|
||||
if (!textureData) {
|
||||
return SDL_SetError("Texture is not currently available");
|
||||
}
|
||||
|
||||
@@ -1408,7 +1408,7 @@ static int D3D11_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
||||
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
|
||||
|
||||
if (textureData == NULL) {
|
||||
if (!textureData) {
|
||||
return SDL_SetError("Texture is not currently available");
|
||||
}
|
||||
|
||||
@@ -1432,7 +1432,7 @@ static int D3D11_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
D3D11_TEXTURE2D_DESC stagingTextureDesc;
|
||||
D3D11_MAPPED_SUBRESOURCE textureMemory;
|
||||
|
||||
if (textureData == NULL) {
|
||||
if (!textureData) {
|
||||
return SDL_SetError("Texture is not currently available");
|
||||
}
|
||||
#if SDL_HAVE_YUV
|
||||
@@ -1511,7 +1511,7 @@ static void D3D11_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
||||
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
|
||||
|
||||
if (textureData == NULL) {
|
||||
if (!textureData) {
|
||||
return;
|
||||
}
|
||||
#if SDL_HAVE_YUV
|
||||
@@ -1547,7 +1547,7 @@ static void D3D11_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu
|
||||
{
|
||||
D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata;
|
||||
|
||||
if (textureData == NULL) {
|
||||
if (!textureData) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1559,7 +1559,7 @@ static int D3D11_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata;
|
||||
D3D11_TextureData *textureData = NULL;
|
||||
|
||||
if (texture == NULL) {
|
||||
if (!texture) {
|
||||
rendererData->currentOffscreenRenderTargetView = NULL;
|
||||
return 0;
|
||||
}
|
||||
@@ -1590,7 +1590,7 @@ static int D3D11_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
color.b = cmd->data.draw.b;
|
||||
color.a = cmd->data.draw.a;
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1617,7 +1617,7 @@ static int D3D11_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S
|
||||
int count = indices ? num_indices : num_vertices;
|
||||
VertexPositionColor *verts = (VertexPositionColor *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertexPositionColor), 0, &cmd->data.draw.first);
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1889,9 +1889,9 @@ static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (blendState == NULL) {
|
||||
if (!blendState) {
|
||||
blendState = D3D11_CreateBlendState(renderer, blendMode);
|
||||
if (blendState == NULL) {
|
||||
if (!blendState) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -2144,13 +2144,13 @@ static int D3D11_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect,
|
||||
D3D11_MAPPED_SUBRESOURCE textureMemory;
|
||||
|
||||
renderTargetView = D3D11_GetCurrentRenderTargetView(renderer);
|
||||
if (renderTargetView == NULL) {
|
||||
if (!renderTargetView) {
|
||||
SDL_SetError("%s, ID3D11DeviceContext::OMGetRenderTargets failed", __FUNCTION__);
|
||||
goto done;
|
||||
}
|
||||
|
||||
ID3D11View_GetResource(renderTargetView, (ID3D11Resource **)&backBuffer);
|
||||
if (backBuffer == NULL) {
|
||||
if (!backBuffer) {
|
||||
SDL_SetError("%s, ID3D11View::GetResource failed", __FUNCTION__);
|
||||
goto done;
|
||||
}
|
||||
@@ -2305,13 +2305,13 @@ SDL_Renderer *D3D11_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||
D3D11_RenderData *data;
|
||||
|
||||
renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer));
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = (D3D11_RenderData *)SDL_calloc(1, sizeof(*data));
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
SDL_free(renderer);
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
|
||||
@@ -46,7 +46,7 @@ extern "C" void *
|
||||
D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer *renderer)
|
||||
{
|
||||
SDL_Window *sdlWindow = renderer->window;
|
||||
if (renderer->window == NULL) {
|
||||
if (!renderer->window) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -633,7 +633,7 @@ static D3D12_PipelineState *D3D12_CreatePipelineState(SDL_Renderer *renderer,
|
||||
}
|
||||
|
||||
pipelineStates = (D3D12_PipelineState *)SDL_realloc(data->pipelineStates, (data->pipelineStateCount + 1) * sizeof(*pipelineStates));
|
||||
if (pipelineStates == NULL) {
|
||||
if (!pipelineStates) {
|
||||
SAFE_RELEASE(pipelineState);
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
@@ -748,7 +748,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (CreateEventExFunc == NULL) {
|
||||
if (!CreateEventExFunc) {
|
||||
result = E_FAIL;
|
||||
goto done;
|
||||
}
|
||||
@@ -761,7 +761,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
|
||||
}
|
||||
|
||||
CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory2");
|
||||
if (CreateDXGIFactoryFunc == NULL) {
|
||||
if (!CreateDXGIFactoryFunc) {
|
||||
result = E_FAIL;
|
||||
goto done;
|
||||
}
|
||||
@@ -805,7 +805,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer)
|
||||
|
||||
/* If the debug hint is set, also create the DXGI factory in debug mode */
|
||||
DXGIGetDebugInterfaceFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "DXGIGetDebugInterface1");
|
||||
if (DXGIGetDebugInterfaceFunc == NULL) {
|
||||
if (!DXGIGetDebugInterfaceFunc) {
|
||||
result = E_FAIL;
|
||||
goto done;
|
||||
}
|
||||
@@ -1438,7 +1438,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
}
|
||||
|
||||
textureData = (D3D12_TextureData *)SDL_calloc(1, sizeof(*textureData));
|
||||
if (textureData == NULL) {
|
||||
if (!textureData) {
|
||||
SDL_OutOfMemory();
|
||||
return -1;
|
||||
}
|
||||
@@ -1616,7 +1616,7 @@ static void D3D12_DestroyTexture(SDL_Renderer *renderer,
|
||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
||||
|
||||
if (textureData == NULL) {
|
||||
if (!textureData) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1794,7 +1794,7 @@ static int D3D12_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
||||
|
||||
if (textureData == NULL) {
|
||||
if (!textureData) {
|
||||
return SDL_SetError("Texture is not currently available");
|
||||
}
|
||||
|
||||
@@ -1839,7 +1839,7 @@ static int D3D12_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
||||
|
||||
if (textureData == NULL) {
|
||||
if (!textureData) {
|
||||
return SDL_SetError("Texture is not currently available");
|
||||
}
|
||||
|
||||
@@ -1863,7 +1863,7 @@ static int D3D12_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
||||
|
||||
if (textureData == NULL) {
|
||||
if (!textureData) {
|
||||
return SDL_SetError("Texture is not currently available");
|
||||
}
|
||||
|
||||
@@ -1892,7 +1892,7 @@ static int D3D12_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
BYTE *textureMemory;
|
||||
int bpp;
|
||||
|
||||
if (textureData == NULL) {
|
||||
if (!textureData) {
|
||||
return SDL_SetError("Texture is not currently available");
|
||||
}
|
||||
#if SDL_HAVE_YUV
|
||||
@@ -2011,7 +2011,7 @@ static void D3D12_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
D3D12_TEXTURE_COPY_LOCATION dstLocation;
|
||||
int bpp;
|
||||
|
||||
if (textureData == NULL) {
|
||||
if (!textureData) {
|
||||
return;
|
||||
}
|
||||
#if SDL_HAVE_YUV
|
||||
@@ -2082,7 +2082,7 @@ static void D3D12_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu
|
||||
{
|
||||
D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata;
|
||||
|
||||
if (textureData == NULL) {
|
||||
if (!textureData) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2094,7 +2094,7 @@ static int D3D12_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata;
|
||||
D3D12_TextureData *textureData = NULL;
|
||||
|
||||
if (texture == NULL) {
|
||||
if (!texture) {
|
||||
if (rendererData->textureRenderTarget) {
|
||||
D3D12_TransitionResource(rendererData,
|
||||
rendererData->textureRenderTarget->mainTexture,
|
||||
@@ -2137,7 +2137,7 @@ static int D3D12_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
color.b = cmd->data.draw.b;
|
||||
color.a = cmd->data.draw.a;
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2164,7 +2164,7 @@ static int D3D12_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S
|
||||
int count = indices ? num_indices : num_vertices;
|
||||
VertexPositionColor *verts = (VertexPositionColor *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertexPositionColor), 0, &cmd->data.draw.first);
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2965,13 +2965,13 @@ SDL_Renderer *D3D12_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||
D3D12_RenderData *data;
|
||||
|
||||
renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer));
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = (D3D12_RenderData *)SDL_calloc(1, sizeof(*data));
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
SDL_free(renderer);
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
|
||||
@@ -186,7 +186,7 @@ GL_ClearErrors(SDL_Renderer *renderer)
|
||||
data->errors = 0;
|
||||
data->error_messages = NULL;
|
||||
}
|
||||
} else if (data->glGetError != NULL) {
|
||||
} else if (data->glGetError) {
|
||||
while (data->glGetError() != GL_NO_ERROR) {
|
||||
/* continue; */
|
||||
}
|
||||
@@ -306,7 +306,7 @@ static GL_FBOList *GL_GetFBO(GL_RenderData *data, Uint32 w, Uint32 h)
|
||||
result = result->next;
|
||||
}
|
||||
|
||||
if (result == NULL) {
|
||||
if (!result) {
|
||||
result = SDL_malloc(sizeof(GL_FBOList));
|
||||
if (result) {
|
||||
result->w = w;
|
||||
@@ -471,7 +471,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
}
|
||||
|
||||
data = (GL_TextureData *)SDL_calloc(1, sizeof(*data));
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -888,7 +888,7 @@ static int GL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
|
||||
data->drawstate.viewport_dirty = SDL_TRUE;
|
||||
|
||||
if (texture == NULL) {
|
||||
if (!texture) {
|
||||
data->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
return 0;
|
||||
}
|
||||
@@ -918,7 +918,7 @@ static int GL_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, co
|
||||
GLfloat *verts = (GLfloat *)SDL_AllocateRenderVertices(renderer, count * 2 * sizeof(GLfloat), 0, &cmd->data.draw.first);
|
||||
int i;
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -938,7 +938,7 @@ static int GL_QueueDrawLines(SDL_Renderer *renderer, SDL_RenderCommand *cmd, con
|
||||
const size_t vertlen = (sizeof(GLfloat) * 2) * count;
|
||||
GLfloat *verts = (GLfloat *)SDL_AllocateRenderVertices(renderer, vertlen, 0, &cmd->data.draw.first);
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
cmd->data.draw.count = count;
|
||||
@@ -983,7 +983,7 @@ static int GL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_
|
||||
size_t sz = 2 * sizeof(GLfloat) + 4 * sizeof(Uint8) + (texture ? 2 : 0) * sizeof(GLfloat);
|
||||
|
||||
verts = (GLfloat *)SDL_AllocateRenderVertices(renderer, count * sz, 0, &cmd->data.draw.first);
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1089,7 +1089,7 @@ static int SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const
|
||||
}
|
||||
|
||||
if ((cmd->data.draw.texture != NULL) != data->drawstate.texturing) {
|
||||
if (cmd->data.draw.texture == NULL) {
|
||||
if (!cmd->data.draw.texture) {
|
||||
data->glDisable(data->textype);
|
||||
data->drawstate.texturing = SDL_FALSE;
|
||||
} else {
|
||||
@@ -1294,7 +1294,7 @@ static int GL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
SDL_RenderCommand *nextcmd = cmd->next;
|
||||
SDL_BlendMode thisblend = cmd->data.draw.blend;
|
||||
|
||||
while (nextcmd != NULL) {
|
||||
while (nextcmd) {
|
||||
const SDL_RenderCommandType nextcmdtype = nextcmd->command;
|
||||
if (nextcmdtype != SDL_RENDERCMD_DRAW_LINES) {
|
||||
break; /* can't go any further on this draw call, different render command up next. */
|
||||
@@ -1328,7 +1328,7 @@ static int GL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
SDL_RenderCommand *nextcmd = cmd->next;
|
||||
size_t count = cmd->data.draw.count;
|
||||
int ret;
|
||||
while (nextcmd != NULL) {
|
||||
while (nextcmd) {
|
||||
const SDL_RenderCommandType nextcmdtype = nextcmd->command;
|
||||
if (nextcmdtype != thiscmdtype) {
|
||||
break; /* can't go any further on this draw call, different render command up next. */
|
||||
@@ -1437,7 +1437,7 @@ static int GL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect,
|
||||
|
||||
temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format);
|
||||
temp_pixels = SDL_malloc((size_t)rect->h * temp_pitch);
|
||||
if (temp_pixels == NULL) {
|
||||
if (!temp_pixels) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -1502,7 +1502,7 @@ static void GL_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
renderdata->drawstate.target = NULL;
|
||||
}
|
||||
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
if (data->texture) {
|
||||
@@ -1524,7 +1524,7 @@ static void GL_DestroyRenderer(SDL_Renderer *renderer)
|
||||
GL_RenderData *data = (GL_RenderData *)renderer->driverdata;
|
||||
|
||||
if (data) {
|
||||
if (data->context != NULL) {
|
||||
if (data->context) {
|
||||
/* make sure we delete the right resources! */
|
||||
GL_ActivateRenderer(renderer);
|
||||
}
|
||||
@@ -1730,13 +1730,13 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||
#endif
|
||||
|
||||
renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer));
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_OutOfMemory();
|
||||
goto error;
|
||||
}
|
||||
|
||||
data = (GL_RenderData *)SDL_calloc(1, sizeof(*data));
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
SDL_free(renderer);
|
||||
SDL_OutOfMemory();
|
||||
goto error;
|
||||
@@ -1831,7 +1831,7 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||
}
|
||||
|
||||
hint = SDL_getenv("GL_ARB_texture_non_power_of_two");
|
||||
if (hint == NULL || *hint != '0') {
|
||||
if (!hint || *hint != '0') {
|
||||
SDL_bool isGL2 = SDL_FALSE;
|
||||
const char *verstr = (const char *)data->glGetString(GL_VERSION);
|
||||
if (verstr) {
|
||||
|
||||
@@ -497,7 +497,7 @@ GL_ShaderContext *GL_CreateShaderContext(void)
|
||||
int i;
|
||||
|
||||
ctx = (GL_ShaderContext *)SDL_calloc(1, sizeof(*ctx));
|
||||
if (ctx == NULL) {
|
||||
if (!ctx) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ static GLES_FBOList *GLES_GetFBO(GLES_RenderData *data, Uint32 w, Uint32 h)
|
||||
while ((result) && ((result->w != w) || (result->h != h))) {
|
||||
result = result->next;
|
||||
}
|
||||
if (result == NULL) {
|
||||
if (!result) {
|
||||
result = SDL_malloc(sizeof(GLES_FBOList));
|
||||
result->w = w;
|
||||
result->h = h;
|
||||
@@ -332,7 +332,7 @@ static int GLES_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
}
|
||||
|
||||
data = (GLES_TextureData *)SDL_calloc(1, sizeof(*data));
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ static int GLES_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
src = (Uint8 *)pixels;
|
||||
if (pitch != srcPitch) {
|
||||
blob = (Uint8 *)SDL_malloc(srcPitch * rect->h);
|
||||
if (blob == NULL) {
|
||||
if (!blob) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
src = blob;
|
||||
@@ -510,7 +510,7 @@ static int GLES_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
|
||||
data->drawstate.viewport_dirty = SDL_TRUE;
|
||||
|
||||
if (texture == NULL) {
|
||||
if (!texture) {
|
||||
data->glBindFramebufferOES(GL_FRAMEBUFFER_OES, data->window_framebuffer);
|
||||
return 0;
|
||||
}
|
||||
@@ -537,7 +537,7 @@ static int GLES_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
GLfloat *verts = (GLfloat *)SDL_AllocateRenderVertices(renderer, count * 2 * sizeof(GLfloat), 0, &cmd->data.draw.first);
|
||||
int i;
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -557,7 +557,7 @@ static int GLES_QueueDrawLines(SDL_Renderer *renderer, SDL_RenderCommand *cmd, c
|
||||
const size_t vertlen = (sizeof(GLfloat) * 2) * count;
|
||||
GLfloat *verts = (GLfloat *)SDL_AllocateRenderVertices(renderer, vertlen, 0, &cmd->data.draw.first);
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
cmd->data.draw.count = count;
|
||||
@@ -602,7 +602,7 @@ static int GLES_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SD
|
||||
int sz = 2 + 4 + (texture ? 2 : 0);
|
||||
|
||||
verts = (GLfloat *)SDL_AllocateRenderVertices(renderer, count * sz * sizeof(GLfloat), 0, &cmd->data.draw.first);
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -911,7 +911,7 @@ static int GLES_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect,
|
||||
|
||||
temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format);
|
||||
temp_pixels = SDL_malloc(rect->h * temp_pitch);
|
||||
if (temp_pixels == NULL) {
|
||||
if (!temp_pixels) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -970,7 +970,7 @@ static void GLES_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
renderdata->drawstate.target = NULL;
|
||||
}
|
||||
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
if (data->texture) {
|
||||
@@ -1082,13 +1082,13 @@ static SDL_Renderer *GLES_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||
}
|
||||
|
||||
renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer));
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_OutOfMemory();
|
||||
goto error;
|
||||
}
|
||||
|
||||
data = (GLES_RenderData *)SDL_calloc(1, sizeof(*data));
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
GLES_DestroyRenderer(renderer);
|
||||
SDL_OutOfMemory();
|
||||
goto error;
|
||||
|
||||
@@ -220,7 +220,7 @@ GL_CheckAllErrors(const char *prefix, SDL_Renderer *renderer, const char *file,
|
||||
for (;;) {
|
||||
GLenum error = data->glGetError();
|
||||
if (error != GL_NO_ERROR) {
|
||||
if (prefix == NULL || prefix[0] == '\0') {
|
||||
if (!prefix || prefix[0] == '\0') {
|
||||
prefix = "generic";
|
||||
}
|
||||
SDL_SetError("%s: %s (%d): %s %s (0x%X)", prefix, file, line, function, GL_TranslateError(error), error);
|
||||
@@ -275,7 +275,7 @@ static GLES2_FBOList *GLES2_GetFBO(GLES2_RenderData *data, Uint32 w, Uint32 h)
|
||||
while ((result) && ((result->w != w) || (result->h != h))) {
|
||||
result = result->next;
|
||||
}
|
||||
if (result == NULL) {
|
||||
if (!result) {
|
||||
result = SDL_malloc(sizeof(GLES2_FBOList));
|
||||
result->w = w;
|
||||
result->h = h;
|
||||
@@ -427,7 +427,7 @@ static GLES2_ProgramCacheEntry *GLES2_CacheProgram(GLES2_RenderData *data, GLuin
|
||||
|
||||
/* Create a program cache entry */
|
||||
entry = (GLES2_ProgramCacheEntry *)SDL_calloc(1, sizeof(GLES2_ProgramCacheEntry));
|
||||
if (entry == NULL) {
|
||||
if (!entry) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
@@ -488,7 +488,7 @@ static GLES2_ProgramCacheEntry *GLES2_CacheProgram(GLES2_RenderData *data, GLuin
|
||||
if (data->program_cache.count > GLES2_MAX_CACHED_PROGRAMS) {
|
||||
data->glDeleteProgram(data->program_cache.tail->id);
|
||||
data->program_cache.tail = data->program_cache.tail->prev;
|
||||
if (data->program_cache.tail != NULL) {
|
||||
if (data->program_cache.tail) {
|
||||
SDL_free(data->program_cache.tail->next);
|
||||
data->program_cache.tail->next = NULL;
|
||||
}
|
||||
@@ -505,7 +505,7 @@ static GLuint GLES2_CacheShader(GLES2_RenderData *data, GLES2_ShaderType type, G
|
||||
const GLchar *shader_src_list[3];
|
||||
const GLchar *shader_body = GLES2_GetShader(type);
|
||||
|
||||
if (shader_body == NULL) {
|
||||
if (!shader_body) {
|
||||
SDL_SetError("No shader body src");
|
||||
return 0;
|
||||
}
|
||||
@@ -715,7 +715,7 @@ static int GLES2_SelectProgram(GLES2_RenderData *data, GLES2_ImageSource source,
|
||||
|
||||
/* Generate a matching program */
|
||||
program = GLES2_CacheProgram(data, vertex, fragment);
|
||||
if (program == NULL) {
|
||||
if (!program) {
|
||||
goto fault;
|
||||
}
|
||||
|
||||
@@ -748,7 +748,7 @@ static int GLES2_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
color.b = cmd->data.draw.b;
|
||||
color.a = cmd->data.draw.a;
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -781,7 +781,7 @@ static int GLES2_QueueDrawLines(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
color.b = cmd->data.draw.b;
|
||||
color.a = cmd->data.draw.a;
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -839,7 +839,7 @@ static int GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S
|
||||
|
||||
if (texture) {
|
||||
SDL_Vertex *verts = (SDL_Vertex *)SDL_AllocateRenderVertices(renderer, count * sizeof(*verts), 0, &cmd->data.draw.first);
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -879,7 +879,7 @@ static int GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S
|
||||
|
||||
} else {
|
||||
SDL_VertexSolid *verts = (SDL_VertexSolid *)SDL_AllocateRenderVertices(renderer, count * sizeof(*verts), 0, &cmd->data.draw.first);
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -959,7 +959,7 @@ static int SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, co
|
||||
}
|
||||
|
||||
if ((texture != NULL) != data->drawstate.texturing) {
|
||||
if (texture == NULL) {
|
||||
if (!texture) {
|
||||
data->glDisableVertexAttribArray((GLenum)GLES2_ATTRIBUTE_TEXCOORD);
|
||||
data->drawstate.texturing = SDL_FALSE;
|
||||
} else {
|
||||
@@ -1282,7 +1282,7 @@ static int GLES2_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
SDL_RenderCommand *nextcmd = cmd->next;
|
||||
SDL_BlendMode thisblend = cmd->data.draw.blend;
|
||||
|
||||
while (nextcmd != NULL) {
|
||||
while (nextcmd) {
|
||||
const SDL_RenderCommandType nextcmdtype = nextcmd->command;
|
||||
if (nextcmdtype != SDL_RENDERCMD_DRAW_LINES) {
|
||||
break; /* can't go any further on this draw call, different render command up next. */
|
||||
@@ -1316,7 +1316,7 @@ static int GLES2_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
SDL_RenderCommand *nextcmd = cmd->next;
|
||||
size_t count = cmd->data.draw.count;
|
||||
int ret;
|
||||
while (nextcmd != NULL) {
|
||||
while (nextcmd) {
|
||||
const SDL_RenderCommandType nextcmdtype = nextcmd->command;
|
||||
if (nextcmdtype != thiscmdtype) {
|
||||
break; /* can't go any further on this draw call, different render command up next. */
|
||||
@@ -1455,7 +1455,7 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
|
||||
/* Allocate a texture struct */
|
||||
data = (GLES2_TextureData *)SDL_calloc(1, sizeof(GLES2_TextureData));
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
data->texture = 0;
|
||||
@@ -1590,7 +1590,7 @@ static int GLES2_TexSubImage2D(GLES2_RenderData *data, GLenum target, GLint xoff
|
||||
src = (Uint8 *)pixels;
|
||||
if (pitch != src_pitch) {
|
||||
blob = (Uint8 *)SDL_malloc(src_pitch * height);
|
||||
if (blob == NULL) {
|
||||
if (!blob) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
src = blob;
|
||||
@@ -1607,7 +1607,7 @@ static int GLES2_TexSubImage2D(GLES2_RenderData *data, GLenum target, GLint xoff
|
||||
int i;
|
||||
Uint32 *src32 = (Uint32 *)src;
|
||||
blob2 = (Uint32 *)SDL_malloc(src_pitch * height);
|
||||
if (blob2 == NULL) {
|
||||
if (!blob2) {
|
||||
if (blob) {
|
||||
SDL_free(blob);
|
||||
}
|
||||
@@ -1868,7 +1868,7 @@ static int GLES2_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
|
||||
data->drawstate.viewport_dirty = SDL_TRUE;
|
||||
|
||||
if (texture == NULL) {
|
||||
if (!texture) {
|
||||
data->glBindFramebuffer(GL_FRAMEBUFFER, data->window_framebuffer);
|
||||
} else {
|
||||
texturedata = (GLES2_TextureData *)texture->driverdata;
|
||||
@@ -1934,7 +1934,7 @@ static int GLES2_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect,
|
||||
}
|
||||
|
||||
temp_pixels = SDL_malloc(buflen);
|
||||
if (temp_pixels == NULL) {
|
||||
if (!temp_pixels) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -2093,13 +2093,13 @@ static SDL_Renderer *GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||
|
||||
/* Create the renderer struct */
|
||||
renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(SDL_Renderer));
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_OutOfMemory();
|
||||
goto error;
|
||||
}
|
||||
|
||||
data = (GLES2_RenderData *)SDL_calloc(1, sizeof(GLES2_RenderData));
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
SDL_free(renderer);
|
||||
SDL_OutOfMemory();
|
||||
goto error;
|
||||
|
||||
@@ -105,7 +105,7 @@ static int PS2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
{
|
||||
GSTEXTURE *ps2_tex = (GSTEXTURE *)SDL_calloc(1, sizeof(GSTEXTURE));
|
||||
|
||||
if (ps2_tex == NULL) {
|
||||
if (!ps2_tex) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ static int PS2_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, c
|
||||
gs_rgbaq rgbaq;
|
||||
int i;
|
||||
|
||||
if (vertices == NULL) {
|
||||
if (!vertices) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ static int PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL
|
||||
GSPRIMUVPOINT *vertices = (GSPRIMUVPOINT *) SDL_AllocateRenderVertices(renderer, count * sizeof(GSPRIMUVPOINT), 4, &cmd->data.draw.first);
|
||||
GSTEXTURE *ps2_tex = (GSTEXTURE *) texture->driverdata;
|
||||
|
||||
if (vertices == NULL) {
|
||||
if (!vertices) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ static int PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL
|
||||
} else {
|
||||
GSPRIMPOINT *vertices = (GSPRIMPOINT *)SDL_AllocateRenderVertices(renderer, count * sizeof(GSPRIMPOINT), 4, &cmd->data.draw.first);
|
||||
|
||||
if (vertices == NULL) {
|
||||
if (!vertices) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -531,11 +531,11 @@ static void PS2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
GSTEXTURE *ps2_texture = (GSTEXTURE *)texture->driverdata;
|
||||
PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata;
|
||||
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ps2_texture == NULL) {
|
||||
if (!ps2_texture) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -584,13 +584,13 @@ static SDL_Renderer *PS2_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||
SDL_bool dynamicVsync;
|
||||
|
||||
renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer));
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = (PS2_RenderData *)SDL_calloc(1, sizeof(*data));
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
PS2_DestroyRenderer(renderer);
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
|
||||
@@ -282,11 +282,11 @@ static int TextureSwizzle(PSP_TextureData *psp_texture, void *dst)
|
||||
src = (unsigned int *)psp_texture->data;
|
||||
|
||||
data = dst;
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
data = SDL_malloc(psp_texture->size);
|
||||
}
|
||||
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -344,11 +344,11 @@ static int TextureUnswizzle(PSP_TextureData *psp_texture, void *dst)
|
||||
|
||||
data = dst;
|
||||
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
data = SDL_malloc(psp_texture->size);
|
||||
}
|
||||
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -392,7 +392,7 @@ static int TextureSpillToSram(PSP_RenderData *data, PSP_TextureData *psp_texture
|
||||
if (psp_texture->swizzled) {
|
||||
// Texture was swizzled in vram, just copy to system memory
|
||||
void *sdata = SDL_malloc(psp_texture->size);
|
||||
if (sdata == NULL) {
|
||||
if (!sdata) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -484,7 +484,7 @@ static int PSP_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
PSP_RenderData *data = renderer->driverdata;
|
||||
PSP_TextureData *psp_texture = (PSP_TextureData *)SDL_calloc(1, sizeof(*psp_texture));
|
||||
|
||||
if (psp_texture == NULL) {
|
||||
if (!psp_texture) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -630,7 +630,7 @@ static int PSP_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, c
|
||||
VertV *verts = (VertV *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertV), 4, &cmd->data.draw.first);
|
||||
int i;
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -656,10 +656,10 @@ static int PSP_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL
|
||||
cmd->data.draw.count = count;
|
||||
size_indices = indices ? size_indices : 0;
|
||||
|
||||
if (texture == NULL) {
|
||||
if (!texture) {
|
||||
VertCV *verts;
|
||||
verts = (VertCV *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertCV), 4, &cmd->data.draw.first);
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -692,7 +692,7 @@ static int PSP_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL
|
||||
PSP_TextureData *psp_texture = (PSP_TextureData *)texture->driverdata;
|
||||
VertTCV *verts;
|
||||
verts = (VertTCV *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertTCV), 4, &cmd->data.draw.first);
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -737,7 +737,7 @@ static int PSP_QueueFillRects(SDL_Renderer *renderer, SDL_RenderCommand *cmd, co
|
||||
VertV *verts = (VertV *)SDL_AllocateRenderVertices(renderer, count * 2 * sizeof(VertV), 4, &cmd->data.draw.first);
|
||||
int i;
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -773,7 +773,7 @@ static int PSP_QueueCopy(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Tex
|
||||
|
||||
if ((MathAbs(u1) - MathAbs(u0)) < 64.0f) {
|
||||
verts = (VertTV *)SDL_AllocateRenderVertices(renderer, 2 * sizeof(VertTV), 4, &cmd->data.draw.first);
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -809,7 +809,7 @@ static int PSP_QueueCopy(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Tex
|
||||
cmd->data.draw.count = count;
|
||||
|
||||
verts = (VertTV *)SDL_AllocateRenderVertices(renderer, count * 2 * sizeof(VertTV), 4, &cmd->data.draw.first);
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -860,7 +860,7 @@ static int PSP_QueueCopyEx(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_T
|
||||
float u1 = srcrect->x + srcrect->w;
|
||||
float v1 = srcrect->y + srcrect->h;
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1011,7 +1011,7 @@ static void PSP_SetBlendState(PSP_RenderData *data, PSP_BlendState *state)
|
||||
}
|
||||
|
||||
if (state->texture != current->texture) {
|
||||
if (state->texture != NULL) {
|
||||
if (state->texture) {
|
||||
TextureActivate(state->texture);
|
||||
sceGuEnable(GU_TEXTURE_2D);
|
||||
} else {
|
||||
@@ -1035,7 +1035,7 @@ static int PSP_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v
|
||||
rendering backends report a reasonable maximum, so the higher level can flush
|
||||
if we appear to be exceeding that. */
|
||||
gpumem = (Uint8 *)sceGuGetMemory(vertsize);
|
||||
if (gpumem == NULL) {
|
||||
if (!gpumem) {
|
||||
return SDL_SetError("Couldn't obtain a %d-byte vertex buffer!", (int)vertsize);
|
||||
}
|
||||
SDL_memcpy(gpumem, vertices, vertsize);
|
||||
@@ -1177,7 +1177,7 @@ static int PSP_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v
|
||||
case SDL_RENDERCMD_GEOMETRY:
|
||||
{
|
||||
const size_t count = cmd->data.draw.count;
|
||||
if (cmd->data.draw.texture == NULL) {
|
||||
if (!cmd->data.draw.texture) {
|
||||
const VertCV *verts = (VertCV *)(gpumem + cmd->data.draw.first);
|
||||
sceGuDisable(GU_TEXTURE_2D);
|
||||
/* In GU_SMOOTH mode */
|
||||
@@ -1245,11 +1245,11 @@ static void PSP_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
PSP_RenderData *renderdata = (PSP_RenderData *)renderer->driverdata;
|
||||
PSP_TextureData *psp_texture = (PSP_TextureData *)texture->driverdata;
|
||||
|
||||
if (renderdata == NULL) {
|
||||
if (!renderdata) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (psp_texture == NULL) {
|
||||
if (!psp_texture) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1300,13 +1300,13 @@ SDL_Renderer *PSP_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||
void *doublebuffer = NULL;
|
||||
|
||||
renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer));
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = (PSP_RenderData *)SDL_calloc(1, sizeof(*data));
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
PSP_DestroyRenderer(renderer);
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
|
||||
@@ -211,7 +211,7 @@ int SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect,
|
||||
{
|
||||
SDL_Rect clipped;
|
||||
|
||||
if (dst == NULL) {
|
||||
if (!dst) {
|
||||
return SDL_InvalidParamError("SDL_BlendFillRect(): dst");
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL;
|
||||
int status = 0;
|
||||
|
||||
if (dst == NULL) {
|
||||
if (!dst) {
|
||||
return SDL_InvalidParamError("SDL_BlendFillRects(): dst");
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||
break;
|
||||
}
|
||||
|
||||
if (func == NULL) {
|
||||
if (!func) {
|
||||
if (!dst->format->Amask) {
|
||||
func = SDL_BlendFillRect_RGB;
|
||||
} else {
|
||||
|
||||
@@ -798,12 +798,12 @@ int SDL_BlendLine(SDL_Surface *dst, int x1, int y1, int x2, int y2,
|
||||
{
|
||||
BlendLineFunc func;
|
||||
|
||||
if (dst == NULL) {
|
||||
if (!dst) {
|
||||
return SDL_InvalidParamError("SDL_BlendLine(): dst");
|
||||
}
|
||||
|
||||
func = SDL_CalculateBlendLineFunc(dst->format);
|
||||
if (func == NULL) {
|
||||
if (!func) {
|
||||
return SDL_SetError("SDL_BlendLine(): Unsupported surface format");
|
||||
}
|
||||
|
||||
@@ -826,12 +826,12 @@ int SDL_BlendLines(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||
SDL_bool draw_end;
|
||||
BlendLineFunc func;
|
||||
|
||||
if (dst == NULL) {
|
||||
if (!dst) {
|
||||
return SDL_SetError("SDL_BlendLines(): Passed NULL destination surface");
|
||||
}
|
||||
|
||||
func = SDL_CalculateBlendLineFunc(dst->format);
|
||||
if (func == NULL) {
|
||||
if (!func) {
|
||||
return SDL_SetError("SDL_BlendLines(): Unsupported surface format");
|
||||
}
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ static int SDL_BlendPoint_RGBA(SDL_Surface *dst, int x, int y, SDL_BlendMode ble
|
||||
int SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
|
||||
Uint8 g, Uint8 b, Uint8 a)
|
||||
{
|
||||
if (dst == NULL) {
|
||||
if (!dst) {
|
||||
return SDL_InvalidParamError("SDL_BlendPoint(): dst");
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||
SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL;
|
||||
int status = 0;
|
||||
|
||||
if (dst == NULL) {
|
||||
if (!dst) {
|
||||
return SDL_InvalidParamError("SDL_BlendPoints(): dst");
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||
break;
|
||||
}
|
||||
|
||||
if (func == NULL) {
|
||||
if (!func) {
|
||||
if (!dst->format->Amask) {
|
||||
func = SDL_BlendPoint_RGB;
|
||||
} else {
|
||||
|
||||
@@ -137,12 +137,12 @@ int SDL_DrawLine(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint32 color)
|
||||
{
|
||||
DrawLineFunc func;
|
||||
|
||||
if (dst == NULL) {
|
||||
if (!dst) {
|
||||
return SDL_InvalidParamError("SDL_DrawLine(): dst");
|
||||
}
|
||||
|
||||
func = SDL_CalculateDrawLineFunc(dst->format);
|
||||
if (func == NULL) {
|
||||
if (!func) {
|
||||
return SDL_SetError("SDL_DrawLine(): Unsupported surface format");
|
||||
}
|
||||
|
||||
@@ -165,12 +165,12 @@ int SDL_DrawLines(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||
SDL_bool draw_end;
|
||||
DrawLineFunc func;
|
||||
|
||||
if (dst == NULL) {
|
||||
if (!dst) {
|
||||
return SDL_InvalidParamError("SDL_DrawLines(): dst");
|
||||
}
|
||||
|
||||
func = SDL_CalculateDrawLineFunc(dst->format);
|
||||
if (func == NULL) {
|
||||
if (!func) {
|
||||
return SDL_SetError("SDL_DrawLines(): Unsupported surface format");
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
int SDL_DrawPoint(SDL_Surface *dst, int x, int y, Uint32 color)
|
||||
{
|
||||
if (dst == NULL) {
|
||||
if (!dst) {
|
||||
return SDL_InvalidParamError("SDL_DrawPoint(): dst");
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ int SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||
int i;
|
||||
int x, y;
|
||||
|
||||
if (dst == NULL) {
|
||||
if (!dst) {
|
||||
return SDL_InvalidParamError("SDL_DrawPoints(): dst");
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ static int SW_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, co
|
||||
SDL_Point *verts = (SDL_Point *)SDL_AllocateRenderVertices(renderer, count * sizeof(SDL_Point), 0, &cmd->data.draw.first);
|
||||
int i;
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ static int SW_QueueFillRects(SDL_Renderer *renderer, SDL_RenderCommand *cmd, con
|
||||
SDL_Rect *verts = (SDL_Rect *)SDL_AllocateRenderVertices(renderer, count * sizeof(SDL_Rect), 0, &cmd->data.draw.first);
|
||||
int i;
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ static int SW_QueueCopy(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Text
|
||||
{
|
||||
SDL_Rect *verts = (SDL_Rect *)SDL_AllocateRenderVertices(renderer, 2 * sizeof(SDL_Rect), 0, &cmd->data.draw.first);
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ static int SW_QueueCopyEx(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Te
|
||||
{
|
||||
CopyExData *verts = (CopyExData *)SDL_AllocateRenderVertices(renderer, sizeof(CopyExData), 0, &cmd->data.draw.first);
|
||||
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||
int blitRequired = SDL_FALSE;
|
||||
int isOpaque = SDL_FALSE;
|
||||
|
||||
if (surface == NULL) {
|
||||
if (!surface) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||
src_clone = SDL_CreateRGBSurfaceFrom(src->pixels, src->w, src->h, src->format->BitsPerPixel, src->pitch,
|
||||
src->format->Rmask, src->format->Gmask,
|
||||
src->format->Bmask, src->format->Amask);
|
||||
if (src_clone == NULL) {
|
||||
if (!src_clone) {
|
||||
if (SDL_MUSTLOCK(src)) {
|
||||
SDL_UnlockSurface(src);
|
||||
}
|
||||
@@ -390,7 +390,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||
if (blendmode == SDL_BLENDMODE_NONE && !isOpaque) {
|
||||
mask = SDL_CreateRGBSurface(0, final_rect->w, final_rect->h, 32,
|
||||
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
|
||||
if (mask == NULL) {
|
||||
if (!mask) {
|
||||
retval = -1;
|
||||
} else {
|
||||
SDL_SetSurfaceBlendMode(mask, SDL_BLENDMODE_MOD);
|
||||
@@ -404,7 +404,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||
SDL_Rect scale_rect = tmp_rect;
|
||||
src_scaled = SDL_CreateRGBSurface(0, final_rect->w, final_rect->h, 32,
|
||||
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
|
||||
if (src_scaled == NULL) {
|
||||
if (!src_scaled) {
|
||||
retval = -1;
|
||||
} else {
|
||||
SDL_SetSurfaceBlendMode(src_clone, SDL_BLENDMODE_NONE);
|
||||
@@ -427,15 +427,15 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||
src_rotated = SDLgfx_rotateSurface(src_clone, angle,
|
||||
(texture->scaleMode == SDL_ScaleModeNearest) ? 0 : 1, flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL,
|
||||
&rect_dest, cangle, sangle, center);
|
||||
if (src_rotated == NULL) {
|
||||
if (!src_rotated) {
|
||||
retval = -1;
|
||||
}
|
||||
if (!retval && mask != NULL) {
|
||||
if (!retval && mask) {
|
||||
/* The mask needed for the NONE blend mode gets rotated with the same parameters. */
|
||||
mask_rotated = SDLgfx_rotateSurface(mask, angle,
|
||||
SDL_FALSE, 0, 0,
|
||||
&rect_dest, cangle, sangle, center);
|
||||
if (mask_rotated == NULL) {
|
||||
if (!mask_rotated) {
|
||||
retval = -1;
|
||||
}
|
||||
}
|
||||
@@ -487,7 +487,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||
src_rotated->format->BitsPerPixel, src_rotated->pitch,
|
||||
src_rotated->format->Rmask, src_rotated->format->Gmask,
|
||||
src_rotated->format->Bmask, 0);
|
||||
if (src_rotated_rgb == NULL) {
|
||||
if (!src_rotated_rgb) {
|
||||
retval = -1;
|
||||
} else {
|
||||
SDL_SetSurfaceBlendMode(src_rotated_rgb, SDL_BLENDMODE_ADD);
|
||||
@@ -499,7 +499,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||
}
|
||||
SDL_FreeSurface(mask_rotated);
|
||||
}
|
||||
if (src_rotated != NULL) {
|
||||
if (src_rotated) {
|
||||
SDL_FreeSurface(src_rotated);
|
||||
}
|
||||
}
|
||||
@@ -508,10 +508,10 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||
if (SDL_MUSTLOCK(src)) {
|
||||
SDL_UnlockSurface(src);
|
||||
}
|
||||
if (mask != NULL) {
|
||||
if (mask) {
|
||||
SDL_FreeSurface(mask);
|
||||
}
|
||||
if (src_clone != NULL) {
|
||||
if (src_clone) {
|
||||
SDL_FreeSurface(src_clone);
|
||||
}
|
||||
return retval;
|
||||
@@ -538,10 +538,10 @@ static int SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_
|
||||
int i;
|
||||
int count = indices ? num_indices : num_vertices;
|
||||
void *verts;
|
||||
size_t sz = texture != NULL ? sizeof(GeometryCopyData) : sizeof(GeometryFillData);
|
||||
size_t sz = texture ? sizeof(GeometryCopyData) : sizeof(GeometryFillData);
|
||||
|
||||
verts = SDL_AllocateRenderVertices(renderer, count * sz, 0, &cmd->data.draw.first);
|
||||
if (verts == NULL) {
|
||||
if (!verts) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -641,9 +641,9 @@ static void SetDrawState(SDL_Surface *surface, SW_DrawStateCache *drawstate)
|
||||
if (drawstate->surface_cliprect_dirty) {
|
||||
const SDL_Rect *viewport = drawstate->viewport;
|
||||
const SDL_Rect *cliprect = drawstate->cliprect;
|
||||
SDL_assert_release(viewport != NULL); /* the higher level should have forced a SDL_RENDERCMD_SETVIEWPORT */
|
||||
SDL_assert_release(viewport); /* the higher level should have forced a SDL_RENDERCMD_SETVIEWPORT */
|
||||
|
||||
if (cliprect != NULL) {
|
||||
if (cliprect) {
|
||||
SDL_Rect clip_rect;
|
||||
clip_rect.x = cliprect->x + viewport->x;
|
||||
clip_rect.y = cliprect->y + viewport->y;
|
||||
@@ -663,7 +663,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
SDL_Surface *surface = SW_ActivateRenderer(renderer);
|
||||
SW_DrawStateCache drawstate;
|
||||
|
||||
if (surface == NULL) {
|
||||
if (!surface) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -712,7 +712,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
SetDrawState(surface, &drawstate);
|
||||
|
||||
/* Apply viewport */
|
||||
if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) {
|
||||
if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) {
|
||||
int i;
|
||||
for (i = 0; i < count; i++) {
|
||||
verts[i].x += drawstate.viewport->x;
|
||||
@@ -739,7 +739,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
SetDrawState(surface, &drawstate);
|
||||
|
||||
/* Apply viewport */
|
||||
if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) {
|
||||
if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) {
|
||||
int i;
|
||||
for (i = 0; i < count; i++) {
|
||||
verts[i].x += drawstate.viewport->x;
|
||||
@@ -766,7 +766,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
SetDrawState(surface, &drawstate);
|
||||
|
||||
/* Apply viewport */
|
||||
if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) {
|
||||
if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) {
|
||||
int i;
|
||||
for (i = 0; i < count; i++) {
|
||||
verts[i].x += drawstate.viewport->x;
|
||||
@@ -794,7 +794,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
PrepTextureForCopy(cmd);
|
||||
|
||||
/* Apply viewport */
|
||||
if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) {
|
||||
if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) {
|
||||
dstrect->x += drawstate.viewport->x;
|
||||
dstrect->y += drawstate.viewport->y;
|
||||
}
|
||||
@@ -852,7 +852,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
PrepTextureForCopy(cmd);
|
||||
|
||||
/* Apply viewport */
|
||||
if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) {
|
||||
if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) {
|
||||
copydata->dstrect.x += drawstate.viewport->x;
|
||||
copydata->dstrect.y += drawstate.viewport->y;
|
||||
}
|
||||
@@ -880,7 +880,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
PrepTextureForCopy(cmd);
|
||||
|
||||
/* Apply viewport */
|
||||
if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) {
|
||||
if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) {
|
||||
SDL_Point vp;
|
||||
vp.x = drawstate.viewport->x;
|
||||
vp.y = drawstate.viewport->y;
|
||||
@@ -903,7 +903,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||
GeometryFillData *ptr = (GeometryFillData *) verts;
|
||||
|
||||
/* Apply viewport */
|
||||
if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) {
|
||||
if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) {
|
||||
SDL_Point vp;
|
||||
vp.x = drawstate.viewport->x;
|
||||
vp.y = drawstate.viewport->y;
|
||||
@@ -938,7 +938,7 @@ static int SW_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect,
|
||||
Uint32 src_format;
|
||||
void *src_pixels;
|
||||
|
||||
if (surface == NULL) {
|
||||
if (!surface) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -965,7 +965,7 @@ static int SW_RenderPresent(SDL_Renderer *renderer)
|
||||
{
|
||||
SDL_Window *window = renderer->window;
|
||||
|
||||
if (window == NULL) {
|
||||
if (!window) {
|
||||
return -1;
|
||||
}
|
||||
return SDL_UpdateWindowSurface(window);
|
||||
@@ -995,19 +995,19 @@ SDL_Renderer *SW_CreateRendererForSurface(SDL_Surface *surface)
|
||||
SDL_Renderer *renderer;
|
||||
SW_RenderData *data;
|
||||
|
||||
if (surface == NULL) {
|
||||
if (!surface) {
|
||||
SDL_InvalidParamError("surface");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer));
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = (SW_RenderData *)SDL_calloc(1, sizeof(*data));
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
SW_DestroyRenderer(renderer);
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
@@ -1050,7 +1050,7 @@ static SDL_Renderer *SW_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||
|
||||
/* Set the vsync hint based on our flags, if it's not already set */
|
||||
hint = SDL_GetHint(SDL_HINT_RENDER_VSYNC);
|
||||
if (hint == NULL || !*hint) {
|
||||
if (!hint || !*hint) {
|
||||
no_hint_set = SDL_TRUE;
|
||||
} else {
|
||||
no_hint_set = SDL_FALSE;
|
||||
@@ -1067,7 +1067,7 @@ static SDL_Renderer *SW_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||
SDL_SetHint(SDL_HINT_RENDER_VSYNC, "");
|
||||
}
|
||||
|
||||
if (surface == NULL) {
|
||||
if (!surface) {
|
||||
return NULL;
|
||||
}
|
||||
return SW_CreateRendererForSurface(surface);
|
||||
|
||||
@@ -500,7 +500,7 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in
|
||||
double sangleinv, cangleinv;
|
||||
|
||||
/* Sanity check */
|
||||
if (src == NULL) {
|
||||
if (!src) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -524,7 +524,7 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in
|
||||
if (is8bit) {
|
||||
/* Target surface is 8 bit */
|
||||
rz_dst = SDL_CreateRGBSurfaceWithFormat(0, rect_dest->w, rect_dest->h + GUARD_ROWS, 8, src->format->format);
|
||||
if (rz_dst != NULL) {
|
||||
if (rz_dst) {
|
||||
if (src->format->palette) {
|
||||
for (i = 0; i < src->format->palette->ncolors; i++) {
|
||||
rz_dst->format->palette->colors[i] = src->format->palette->colors[i];
|
||||
@@ -540,7 +540,7 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in
|
||||
}
|
||||
|
||||
/* Check target */
|
||||
if (rz_dst == NULL) {
|
||||
if (!rz_dst) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
|
||||
|
||||
SDL_Surface *tmp = NULL;
|
||||
|
||||
if (dst == NULL) {
|
||||
if (!dst) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
|
||||
|
||||
/* Use an intermediate surface */
|
||||
tmp = SDL_CreateRGBSurfaceWithFormat(0, dstrect.w, dstrect.h, 0, format);
|
||||
if (tmp == NULL) {
|
||||
if (!tmp) {
|
||||
ret = -1;
|
||||
goto end;
|
||||
}
|
||||
@@ -460,7 +460,7 @@ int SDL_SW_BlitTriangle(
|
||||
|
||||
int has_modulation;
|
||||
|
||||
if (src == NULL || dst == NULL) {
|
||||
if (!src || !dst) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ void StartDrawing(SDL_Renderer *renderer)
|
||||
// data->colorFragmentProgram = in->color;
|
||||
// data->textureFragmentProgram = in->texture;
|
||||
|
||||
if (renderer->target == NULL) {
|
||||
if (!renderer->target) {
|
||||
sceGxmBeginScene(
|
||||
data->gxm_context,
|
||||
0,
|
||||
@@ -217,13 +217,13 @@ SDL_Renderer *VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||
VITA_GXM_RenderData *data;
|
||||
|
||||
renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer));
|
||||
if (renderer == NULL) {
|
||||
if (!renderer) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = (VITA_GXM_RenderData *)SDL_calloc(1, sizeof(VITA_GXM_RenderData));
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
SDL_free(renderer);
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
@@ -295,7 +295,7 @@ static int VITA_GXM_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture)
|
||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
||||
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)SDL_calloc(1, sizeof(VITA_GXM_TextureData));
|
||||
|
||||
if (vita_texture == NULL) {
|
||||
if (!vita_texture) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -583,7 +583,7 @@ static int VITA_GXM_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
*pitch = vita_texture->pitch;
|
||||
|
||||
// make sure that rendering is finished on render target textures
|
||||
if (vita_texture->tex->gxm_rendertarget != NULL) {
|
||||
if (vita_texture->tex->gxm_rendertarget) {
|
||||
sceGxmFinish(data->gxm_context);
|
||||
}
|
||||
|
||||
@@ -733,7 +733,7 @@ static int VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd
|
||||
data,
|
||||
count * sizeof(texture_vertex));
|
||||
|
||||
if (vertices == NULL) {
|
||||
if (!vertices) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -772,7 +772,7 @@ static int VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd
|
||||
data,
|
||||
count * sizeof(color_vertex));
|
||||
|
||||
if (vertices == NULL) {
|
||||
if (!vertices) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1006,7 +1006,7 @@ static int VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *c
|
||||
SDL_RenderCommand *nextcmd = cmd->next;
|
||||
size_t count = cmd->data.draw.count;
|
||||
int ret;
|
||||
while (nextcmd != NULL) {
|
||||
while (nextcmd) {
|
||||
const SDL_RenderCommandType nextcmdtype = nextcmd->command;
|
||||
if (nextcmdtype != thiscmdtype) {
|
||||
break; /* can't go any further on this draw call, different render command up next. */
|
||||
@@ -1103,7 +1103,7 @@ static int VITA_GXM_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rec
|
||||
}
|
||||
|
||||
temp_pixels = SDL_malloc(buflen);
|
||||
if (temp_pixels == NULL) {
|
||||
if (!temp_pixels) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
@@ -1186,15 +1186,15 @@ static void VITA_GXM_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture
|
||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata;
|
||||
VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->driverdata;
|
||||
|
||||
if (data == NULL) {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (vita_texture == NULL) {
|
||||
if (!vita_texture) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (vita_texture->tex == NULL) {
|
||||
if (!vita_texture->tex) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ void *vita_gpu_mem_alloc(VITA_GXM_RenderData *data, unsigned int size)
|
||||
{
|
||||
void *mem;
|
||||
|
||||
if (data->texturePool == NULL) {
|
||||
if (!data->texturePool) {
|
||||
int poolsize;
|
||||
int ret;
|
||||
SceKernelFreeMemorySizeInfo info;
|
||||
@@ -88,7 +88,7 @@ void *vita_gpu_mem_alloc(VITA_GXM_RenderData *data, unsigned int size)
|
||||
}
|
||||
data->texturePool = sceClibMspaceCreate(mem, poolsize);
|
||||
|
||||
if (data->texturePool == NULL) {
|
||||
if (!data->texturePool) {
|
||||
return NULL;
|
||||
}
|
||||
ret = sceGxmMapMemory(mem, poolsize, SCE_GXM_MEMORY_ATTRIB_READ | SCE_GXM_MEMORY_ATTRIB_WRITE);
|
||||
@@ -101,7 +101,7 @@ void *vita_gpu_mem_alloc(VITA_GXM_RenderData *data, unsigned int size)
|
||||
|
||||
void vita_gpu_mem_free(VITA_GXM_RenderData *data, void *ptr)
|
||||
{
|
||||
if (data->texturePool != NULL) {
|
||||
if (data->texturePool) {
|
||||
sceClibMspaceFree(data->texturePool, ptr);
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ void vita_gpu_mem_free(VITA_GXM_RenderData *data, void *ptr)
|
||||
void vita_gpu_mem_destroy(VITA_GXM_RenderData *data)
|
||||
{
|
||||
void *mem = NULL;
|
||||
if (data->texturePool != NULL) {
|
||||
if (data->texturePool) {
|
||||
sceClibMspaceDestroy(data->texturePool);
|
||||
data->texturePool = NULL;
|
||||
if (sceKernelGetMemBlockBase(data->texturePoolUID, &mem) < 0) {
|
||||
|
||||
@@ -1003,7 +1003,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
|
||||
tex_size += (((aligned_w + 1) / 2) * ((h + 1) / 2)) * 2;
|
||||
}
|
||||
|
||||
if (texture == NULL) {
|
||||
if (!texture) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1017,7 +1017,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
|
||||
tex_size);
|
||||
|
||||
/* Try SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE in case we're out of VRAM */
|
||||
if (texture_data == NULL) {
|
||||
if (!texture_data) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_RENDER, "CDRAM texture allocation failed\n");
|
||||
texture_data = vita_mem_alloc(
|
||||
SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE,
|
||||
@@ -1030,7 +1030,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
|
||||
texture->cdram = 1;
|
||||
}
|
||||
|
||||
if (texture_data == NULL) {
|
||||
if (!texture_data) {
|
||||
SDL_free(texture);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user