From 0d79a8a1b2670a506abca3dd60b4e44b0f62cc87 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Thu, 1 Nov 2018 20:04:24 +0300 Subject: [PATCH] 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 --- src/render/SDL_render.c | 20 ++++++++++++++++---- src/render/software/SDL_render_sw.c | 6 +++++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 0c098a75bc02c..7f2b47c22e45e 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -2165,14 +2165,18 @@ SDL_RenderClear(SDL_Renderer * renderer) int 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); } int 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); } @@ -2319,14 +2323,22 @@ SDL_RenderDrawPointsF(SDL_Renderer * renderer, int 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); } int 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); } diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c index 4748873e8817c..7effafaa0fdc1 100644 --- a/src/render/software/SDL_render_sw.c +++ b/src/render/software/SDL_render_sw.c @@ -599,7 +599,11 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic SDL_assert(viewport != NULL); cliprect = cmd->data.cliprect.enabled ? &cmd->data.cliprect.rect : NULL; 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_SetClipRect(surface, &clip_rect); } else {