fix build using Watcom :

./src/render/SDL_render.c(2168): Error! E1054: Expression must be constant
./src/render/SDL_render.c(2168): Error! E1054: Expression must be constant
./src/render/SDL_render.c(2175): Error! E1054: Expression must be constant
./src/render/SDL_render.c(2175): Error! E1054: Expression must be constant
./src/render/SDL_render.c(2322): Error! E1054: Expression must be constant
./src/render/SDL_render.c(2322): Error! E1054: Expression must be constant
./src/render/SDL_render.c(2322): Error! E1054: Expression must be constant
./src/render/SDL_render.c(2322): Error! E1054: Expression must be constant
./src/render/SDL_render.c(2329): Error! E1054: Expression must be constant
./src/render/SDL_render.c(2329): Error! E1054: Expression must be constant
./src/render/SDL_render.c(2329): Error! E1054: Expression must be constant
./src/render/SDL_render.c(2329): Error! E1054: Expression must be constant

./src/render/software/SDL_render_sw.c(602): Error! E1054: Expression must be constant
./src/render/software/SDL_render_sw.c(602): Error! E1054: Expression must be constant
./src/render/software/SDL_render_sw.c(602): Error! E1054: Expression must be constant
./src/render/software/SDL_render_sw.c(602): Error! E1054: Expression must be constant
This commit is contained in:
Ozkan Sezer 2018-11-01 20:04:24 +03:00
parent 4659e73892
commit 0d79a8a1b2
2 changed files with 21 additions and 5 deletions

View File

@ -2165,14 +2165,18 @@ SDL_RenderClear(SDL_Renderer * renderer)
int int
SDL_RenderDrawPoint(SDL_Renderer * renderer, int x, int y) SDL_RenderDrawPoint(SDL_Renderer * renderer, int x, int y)
{ {
const SDL_FPoint fpoint = { (float) x, (float) y }; SDL_FPoint fpoint;
fpoint.x = (float) x;
fpoint.y = (float) y;
return SDL_RenderDrawPointsF(renderer, &fpoint, 1); return SDL_RenderDrawPointsF(renderer, &fpoint, 1);
} }
int int
SDL_RenderDrawPointF(SDL_Renderer * renderer, float x, float y) SDL_RenderDrawPointF(SDL_Renderer * renderer, float x, float y)
{ {
const SDL_FPoint fpoint = { x, y }; SDL_FPoint fpoint;
fpoint.x = x;
fpoint.y = y;
return SDL_RenderDrawPointsF(renderer, &fpoint, 1); return SDL_RenderDrawPointsF(renderer, &fpoint, 1);
} }
@ -2319,14 +2323,22 @@ SDL_RenderDrawPointsF(SDL_Renderer * renderer,
int int
SDL_RenderDrawLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2) SDL_RenderDrawLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
{ {
const SDL_FPoint points[2] = { { (float) x1, (float) y1 }, { (float) x2, (float) y2 } }; SDL_FPoint points[2];
points[0].x = (float) x1;
points[0].y = (float) y1;
points[1].x = (float) x2;
points[1].y = (float) y2;
return SDL_RenderDrawLinesF(renderer, points, 2); return SDL_RenderDrawLinesF(renderer, points, 2);
} }
int int
SDL_RenderDrawLineF(SDL_Renderer * renderer, float x1, float y1, float x2, float y2) SDL_RenderDrawLineF(SDL_Renderer * renderer, float x1, float y1, float x2, float y2)
{ {
const SDL_FPoint points[2] = { { x1, y1 }, { x2, y2 } }; SDL_FPoint points[2];
points[0].x = x1;
points[0].y = y1;
points[1].x = x2;
points[1].y = y2;
return SDL_RenderDrawLinesF(renderer, points, 2); return SDL_RenderDrawLinesF(renderer, points, 2);
} }

View File

@ -599,7 +599,11 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic
SDL_assert(viewport != NULL); SDL_assert(viewport != NULL);
cliprect = cmd->data.cliprect.enabled ? &cmd->data.cliprect.rect : NULL; cliprect = cmd->data.cliprect.enabled ? &cmd->data.cliprect.rect : NULL;
if (cliprect) { if (cliprect) {
SDL_Rect clip_rect = { cliprect->x + viewport->x, cliprect->y + viewport->y, cliprect->w, cliprect->h }; SDL_Rect clip_rect;
clip_rect.x = cliprect->x + viewport->x;
clip_rect.y = cliprect->y + viewport->y;
clip_rect.w = cliprect->w;
clip_rect.h = cliprect->h;
SDL_IntersectRect(viewport, &clip_rect, &clip_rect); SDL_IntersectRect(viewport, &clip_rect, &clip_rect);
SDL_SetClipRect(surface, &clip_rect); SDL_SetClipRect(surface, &clip_rect);
} else { } else {