Fixed Windows RT build

This commit is contained in:
Sam Lantinga 2019-03-19 16:52:09 -07:00
parent a71489221b
commit b2e76d860f
13 changed files with 28 additions and 19 deletions

View file

@ -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"

View file

@ -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__)

View file

@ -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;
@ -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];

View file

@ -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;
@ -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;

View file

@ -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;
@ -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;

View file

@ -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;
@ -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;

View file

@ -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;
@ -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;

View file

@ -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;
@ -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;

View file

@ -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;
@ -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;

View file

@ -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;
@ -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;

View file

@ -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 */

View file

@ -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;

View file

@ -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;
@ -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");