Skip to content

Commit

Permalink
Fixed Windows RT build
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Mar 19, 2019
1 parent a714892 commit b2e76d8
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/core/winrt/SDL_winrtapp_common.cpp
Expand Up @@ -20,6 +20,7 @@
*/
#include "../../SDL_internal.h"

#include "SDL_main.h"
#include "SDL_system.h"
#include "SDL_winrtapp_direct3d.h"
#include "SDL_winrtapp_xaml.h"
Expand Down
2 changes: 1 addition & 1 deletion src/cpuinfo/SDL_cpuinfo.c
Expand Up @@ -25,7 +25,7 @@
#include "SDL_simd.h"
#endif

#if defined(__WIN32__)
#if defined(__WIN32__) || defined(__WINRT__)
#include "../core/windows/SDL_windows.h"
#endif
#if defined(__OS2__)
Expand Down
4 changes: 2 additions & 2 deletions src/render/SDL_render.c
Expand Up @@ -1188,7 +1188,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface)
const SDL_PixelFormat *fmt;
SDL_bool needAlpha;
SDL_bool direct_update;
Uint32 i;
int i;
Uint32 format;
SDL_Texture *texture;

Expand Down Expand Up @@ -1219,7 +1219,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface)
}

format = renderer->info.texture_formats[0];
for (i = 0; i < renderer->info.num_texture_formats; ++i) {
for (i = 0; i < (int)renderer->info.num_texture_formats; ++i) {
if (!SDL_ISPIXELFORMAT_FOURCC(renderer->info.texture_formats[i]) &&
SDL_ISPIXELFORMAT_ALPHA(renderer->info.texture_formats[i]) == needAlpha) {
format = renderer->info.texture_formats[i];
Expand Down
4 changes: 2 additions & 2 deletions src/render/direct3d/SDL_render_d3d.c
Expand Up @@ -791,7 +791,7 @@ D3D_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_F
const DWORD color = D3DCOLOR_ARGB(cmd->data.draw.a, cmd->data.draw.r, cmd->data.draw.g, cmd->data.draw.b);
const size_t vertslen = count * sizeof (Vertex);
Vertex *verts = (Vertex *) SDL_AllocateRenderVertices(renderer, vertslen, 0, &cmd->data.draw.first);
size_t i;
int i;

if (!verts) {
return -1;
Expand All @@ -815,7 +815,7 @@ D3D_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FR
const DWORD color = D3DCOLOR_ARGB(cmd->data.draw.a, cmd->data.draw.r, cmd->data.draw.g, cmd->data.draw.b);
const size_t vertslen = count * sizeof (Vertex) * 4;
Vertex *verts = (Vertex *) SDL_AllocateRenderVertices(renderer, vertslen, 0, &cmd->data.draw.first);
size_t i;
int i;

if (!verts) {
return -1;
Expand Down
4 changes: 2 additions & 2 deletions src/render/direct3d11/SDL_render_d3d11.c
Expand Up @@ -1559,7 +1559,7 @@ D3D11_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL
const float g = (float)(cmd->data.draw.g / 255.0f);
const float b = (float)(cmd->data.draw.b / 255.0f);
const float a = (float)(cmd->data.draw.a / 255.0f);
size_t i;
int i;

if (!verts) {
return -1;
Expand Down Expand Up @@ -1591,7 +1591,7 @@ D3D11_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_
const float g = (float)(cmd->data.draw.g / 255.0f);
const float b = (float)(cmd->data.draw.b / 255.0f);
const float a = (float)(cmd->data.draw.a / 255.0f);
size_t i;
int i;

if (!verts) {
return -1;
Expand Down
4 changes: 2 additions & 2 deletions src/render/opengl/SDL_render_gl.c
Expand Up @@ -805,7 +805,7 @@ static int
GL_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count)
{
GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (GLfloat), 0, &cmd->data.draw.first);
size_t i;
int i;

if (!verts) {
return -1;
Expand All @@ -824,7 +824,7 @@ static int
GL_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count)
{
GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 4 * sizeof (GLfloat), 0, &cmd->data.draw.first);
size_t i;
int i;

if (!verts) {
return -1;
Expand Down
4 changes: 2 additions & 2 deletions src/render/opengles/SDL_render_gles.c
Expand Up @@ -533,7 +533,7 @@ static int
GLES_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count)
{
GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (GLfloat), 0, &cmd->data.draw.first);
size_t i;
int i;

if (!verts) {
return -1;
Expand All @@ -552,7 +552,7 @@ static int
GLES_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count)
{
GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 8 * sizeof (GLfloat), 0, &cmd->data.draw.first);
size_t i;
int i;

if (!verts) {
return -1;
Expand Down
4 changes: 2 additions & 2 deletions src/render/opengles2/SDL_render_gles2.c
Expand Up @@ -766,7 +766,7 @@ static int
GLES2_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count)
{
GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (GLfloat), 0, &cmd->data.draw.first);
size_t i;
int i;

if (!verts) {
return -1;
Expand All @@ -785,7 +785,7 @@ static int
GLES2_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count)
{
GLfloat *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 8 * sizeof (GLfloat), 0, &cmd->data.draw.first);
size_t i;
int i;

if (!verts) {
return -1;
Expand Down
4 changes: 2 additions & 2 deletions src/render/psp/SDL_render_psp.c
Expand Up @@ -444,7 +444,7 @@ static int
PSP_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count)
{
VertV *verts = (VertV *) SDL_AllocateRenderVertices(renderer, count * sizeof (VertV), 4, &cmd->data.draw.first);
size_t i;
int i;

if (!verts) {
return -1;
Expand All @@ -465,7 +465,7 @@ static int
PSP_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count)
{
VertV *verts = (GLfloat *) SDL_AllocateRenderVertices(renderer, count * 2 * sizeof (VertV), 4, &cmd->data.draw.first);
size_t i;
int i;

if (!verts) {
return -1;
Expand Down
4 changes: 2 additions & 2 deletions src/render/software/SDL_render_sw.c
Expand Up @@ -190,7 +190,7 @@ static int
SW_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPoint * points, int count)
{
SDL_Point *verts = (SDL_Point *) SDL_AllocateRenderVertices(renderer, count * sizeof (SDL_Point), 0, &cmd->data.draw.first);
size_t i;
int i;

if (!verts) {
return -1;
Expand Down Expand Up @@ -219,7 +219,7 @@ static int
SW_QueueFillRects(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FRect * rects, int count)
{
SDL_Rect *verts = (SDL_Rect *) SDL_AllocateRenderVertices(renderer, count * sizeof (SDL_Rect), 0, &cmd->data.draw.first);
size_t i;
int i;

if (!verts) {
return -1;
Expand Down
1 change: 1 addition & 0 deletions src/thread/windows/SDL_systhread.c
Expand Up @@ -29,6 +29,7 @@
#include "../SDL_thread_c.h"
#include "../SDL_systhread.h"
#include "SDL_systhread_c.h"
#include "../../core/windows/SDL_windows.h"

#ifndef SDL_PASSED_BEGINTHREAD_ENDTHREAD
/* We'll use the C library from this DLL */
Expand Down
7 changes: 7 additions & 0 deletions src/thread/windows/SDL_systls.c
Expand Up @@ -28,6 +28,13 @@
#include "SDL_thread.h"
#include "../SDL_thread_c.h"

#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#define TLS_OUT_OF_INDEXES FLS_OUT_OF_INDEXES
#define TlsAlloc() FlsAlloc(NULL)
#define TlsSetValue FlsSetValue
#define TlsGetValue FlsGetValue
#endif

static DWORD thread_local_storage = TLS_OUT_OF_INDEXES;
static SDL_bool generic_local_storage = SDL_FALSE;

Expand Down
4 changes: 2 additions & 2 deletions src/video/SDL_bmp.c
Expand Up @@ -321,7 +321,7 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc)
SDL_assert(biBitCount <= 8);
if (biClrUsed == 0) {
biClrUsed = 1 << biBitCount;
} else if (biClrUsed > (1 << biBitCount)) {
} else if (biClrUsed > (Uint32)(1 << biBitCount)) {
SDL_SetError("BMP file has an invalid number of colors");
was_error = SDL_TRUE;
goto done;
Expand Down Expand Up @@ -423,7 +423,7 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc)
was_error = SDL_TRUE;
goto done;
}
if (biBitCount == 8 && palette && biClrUsed < (1 << biBitCount)) {
if (biBitCount == 8 && palette && biClrUsed < (Uint32)(1 << biBitCount)) {
for (i = 0; i < surface->w; ++i) {
if (bits[i] >= biClrUsed) {
SDL_SetError("A BMP image contains a pixel with a color out of the palette");
Expand Down

0 comments on commit b2e76d8

Please sign in to comment.