Fix warnings
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 123c3a7..1199503 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -213,6 +213,16 @@ DebugLogRenderCommands(const SDL_RenderCommand *cmd)
(int) cmd->data.draw.b, (int) cmd->data.draw.a,
(int) cmd->data.draw.blend, cmd->data.draw.texture);
break;
+
+ case SDL_RENDERCMD_GEOMETRY:
+ SDL_Log(" %u. geometry (first=%u, count=%u, r=%d, g=%d, b=%d, a=%d, blend=%d, tex=%p)", i++,
+ (unsigned int) cmd->data.draw.first,
+ (unsigned int) cmd->data.draw.count,
+ (int) cmd->data.draw.r, (int) cmd->data.draw.g,
+ (int) cmd->data.draw.b, (int) cmd->data.draw.a,
+ (int) cmd->data.draw.blend, cmd->data.draw.texture);
+ break;
+
}
cmd = cmd->next;
}
@@ -3427,8 +3437,8 @@ SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
const int debug = 0;
int prev[3]; /* Previous triangle vertex indices */
int texw = 0, texh = 0;
- SDL_BlendMode blendMode;
- Uint8 r, g, b, a;
+ SDL_BlendMode blendMode = SDL_BLENDMODE_NONE;
+ Uint8 r = 0, g = 0, b = 0, a = 0;
/* Save */
SDL_GetRenderDrawBlendMode(renderer, &blendMode);
@@ -3604,10 +3614,10 @@ SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
if (texture) {
uv0_ = (const float *)((const char*)uv + A * uv_stride);
uv1_ = (const float *)((const char*)uv + B * uv_stride);
- s.x = uv0_[0] * texw;
- s.y = uv0_[1] * texh;
- s.w = uv1_[0] * texw - s.x;
- s.h = uv1_[1] * texh - s.y;
+ s.x = (int) (uv0_[0] * texw);
+ s.y = (int) (uv0_[1] * texh);
+ s.w = (int) (uv1_[0] * texw - s.x);
+ s.h = (int) (uv1_[1] * texh - s.y);
}
d.x = xy0_[0];
diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c
index 9bf5698..47242a4 100644
--- a/src/render/software/SDL_render_sw.c
+++ b/src/render/software/SDL_render_sw.c
@@ -615,11 +615,11 @@ SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
uv_ = (float *)((char*)uv + j * uv_stride);
- ptr->src.x = uv_[0] * texture->w;
- ptr->src.y = uv_[1] * texture->h;
+ ptr->src.x = (int)(uv_[0] * texture->w);
+ ptr->src.y = (int)(uv_[1] * texture->h);
- ptr->dst.x = xy_[0] * scale_x + renderer->viewport.x;
- ptr->dst.y = xy_[1] * scale_y + renderer->viewport.y;
+ ptr->dst.x = (int)(xy_[0] * scale_x + renderer->viewport.x);
+ ptr->dst.y = (int)(xy_[1] * scale_y + renderer->viewport.y);
trianglepoint_2_fixedpoint(&ptr->dst);
ptr->color = col_;
@@ -646,8 +646,8 @@ SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
xy_ = (float *)((char*)xy + j * xy_stride);
col_ = *(SDL_Color *)((char*)color + j * color_stride);
- ptr->dst.x = xy_[0] * scale_x + renderer->viewport.x;
- ptr->dst.y = xy_[1] * scale_y + renderer->viewport.y;
+ ptr->dst.x = (int)(xy_[0] * scale_x + renderer->viewport.x);
+ ptr->dst.y = (int)(xy_[1] * scale_y + renderer->viewport.y);
trianglepoint_2_fixedpoint(&ptr->dst);
ptr->color = col_;
diff --git a/src/render/software/SDL_triangle.c b/src/render/software/SDL_triangle.c
index 41fdebf..03f4a52 100644
--- a/src/render/software/SDL_triangle.c
+++ b/src/render/software/SDL_triangle.c
@@ -88,7 +88,7 @@ int SDL_FillTriangle(SDL_Surface *dst, const SDL_Point points[3], Uint32 color)
#endif
/* cross product AB x AC */
-static float cross_product(const SDL_Point *a, const SDL_Point *b, int c_x, int c_y)
+static int cross_product(const SDL_Point *a, const SDL_Point *b, int c_x, int c_y)
{
return (b->x - a->x) * (c_y - a->y) - (b->y - a->y) * (c_x - a->x);
}