diff --git a/include/SDL_config_win32.h b/include/SDL_config_win32.h index 9ef5784f1..fdbec958b 100644 --- a/include/SDL_config_win32.h +++ b/include/SDL_config_win32.h @@ -64,7 +64,7 @@ typedef unsigned int uintptr_t; #define SDL_HAS_64BIT_TYPE 1 /* Enabled for SDL 1.2 (binary compatibility) */ -#define HAVE_LIBC 1 +//#define HAVE_LIBC 1 #ifdef HAVE_LIBC /* Useful headers */ #define HAVE_STDIO_H 1 diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index 83c8ef272..812a435f9 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -413,6 +413,12 @@ extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string); #endif +#ifdef HAVE_WCSLEN +#define SDL_wcslen wcslen +#else +extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *string); +#endif + #ifdef HAVE_STRLCPY #define SDL_strlcpy strlcpy #else diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 4fd9d57e7..aeca515f3 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -497,7 +497,7 @@ SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained) if (desired->channels == 0) { env = SDL_getenv("SDL_AUDIO_CHANNELS"); if (env) { - desired->channels = SDL_atoi(env); + desired->channels = (Uint8)SDL_atoi(env); } } if (desired->channels == 0) { @@ -517,7 +517,7 @@ SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained) if (desired->samples == 0) { env = SDL_getenv("SDL_AUDIO_SAMPLES"); if (env) { - desired->samples = SDL_atoi(env); + desired->samples = (Uint16)SDL_atoi(env); } } if (desired->samples == 0) { diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c index fa9672a3a..3b1f73e30 100644 --- a/src/stdlib/SDL_string.c +++ b/src/stdlib/SDL_string.c @@ -336,6 +336,18 @@ SDL_strlen(const char *string) } #endif +#ifndef HAVE_WCSLEN +size_t +SDL_wcslen(const wchar_t *string) +{ + size_t len = 0; + while (*string++) { + ++len; + } + return len; +} +#endif + #ifndef HAVE_STRLCPY size_t SDL_strlcpy(char *dst, const char *src, size_t maxlen) diff --git a/src/video/win32/SDL_d3drender.c b/src/video/win32/SDL_d3drender.c index 9a57101e3..fe05d8433 100644 --- a/src/video/win32/SDL_d3drender.c +++ b/src/video/win32/SDL_d3drender.c @@ -287,6 +287,7 @@ SDL_D3D_CreateRenderer(SDL_Window * window, Uint32 flags) pparams.Windowed = TRUE; } pparams.FullScreen_RefreshRateInHz = 0; /* FIXME */ + pparams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; result = IDirect3D9_CreateDevice(videodata->d3d, D3DADAPTER_DEFAULT, /* FIXME */ D3DDEVTYPE_HAL, @@ -431,6 +432,7 @@ SDL_D3D_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 color) { SDL_D3D_RenderData *data = (SDL_D3D_RenderData *) renderer->driverdata; + D3DRECT d3drect; HRESULT result; if (data->beginScene) { @@ -438,9 +440,12 @@ SDL_D3D_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect, data->beginScene = SDL_FALSE; } - result = - IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, - (D3DCOLOR) color, 1.0f, 0); + d3drect.x1 = rect->x; + d3drect.x2 = rect->x+rect->w; + d3drect.y1 = rect->y; + d3drect.y2 = rect->y+rect->h; + + result = IDirect3DDevice9_Clear(data->device, 1, &d3drect, D3DCLEAR_TARGET, (D3DCOLOR) color, 1.0f, 0); if (FAILED(result)) { D3D_SetError("Clear()", result); return -1; diff --git a/src/video/win32/SDL_gdirender.c b/src/video/win32/SDL_gdirender.c index 2c0b528b5..86785f244 100644 --- a/src/video/win32/SDL_gdirender.c +++ b/src/video/win32/SDL_gdirender.c @@ -79,7 +79,7 @@ SDL_RenderDriver SDL_GDI_RenderDriver = { SDL_GDI_CreateRenderer, { "gdi", - ( //SDL_Renderer_Minimal | + (SDL_Renderer_Minimal | SDL_Renderer_SingleBuffer | SDL_Renderer_PresentCopy | SDL_Renderer_PresentFlip2 | SDL_Renderer_PresentFlip3 | SDL_Renderer_PresentDiscard | SDL_Renderer_RenderTarget), @@ -735,7 +735,6 @@ SDL_GDI_RenderPresent(SDL_Renderer * renderer) { SDL_GDI_RenderData *data = (SDL_GDI_RenderData *) renderer->driverdata; SDL_DirtyRect *dirty; - int new_hbm; /* Send the data to the display */ if (!(renderer->info.flags & SDL_Renderer_SingleBuffer)) { diff --git a/src/video/win32/SDL_win32video.h b/src/video/win32/SDL_win32video.h index a1f5033ac..5a06bae44 100644 --- a/src/video/win32/SDL_win32video.h +++ b/src/video/win32/SDL_win32video.h @@ -32,7 +32,9 @@ #include #if SDL_VIDEO_RENDER_D3D -#include +//#include +#define D3D_DEBUG_INFO +#include "d3d9.h" #endif #include "SDL_win32events.h" @@ -43,10 +45,10 @@ #include "SDL_win32window.h" #ifdef UNICODE -#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2", (char *)S, (wcslen(S)+1)*sizeof(WCHAR)) +#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2", (char *)S, (SDL_wcslen(S)+1)*sizeof(WCHAR)) #define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UCS-2", "UTF-8", (char *)S, SDL_strlen(S)+1) #else -#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)S, (strlen(S)+1)) +#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)S, (SDL_strlen(S)+1)) #define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)S, SDL_strlen(S)+1) #endif