# HG changeset patch # User Sam Lantinga # Date 1152778382 0 # Node ID f1828a500391d325d32c7d9c144c1bd63be953b3 # Parent 5c6bdbf3aadf871f4b0a82583a47baeebeaa97a0 Removed libc dependency on Windows again, to fix building with Visual C++ 2005 Express Edition. Fixed performance problem with testsprite2 on the D3D driver. diff -r 5c6bdbf3aadf -r f1828a500391 include/SDL_config_win32.h --- a/include/SDL_config_win32.h Wed Jul 12 09:25:17 2006 +0000 +++ b/include/SDL_config_win32.h Thu Jul 13 08:13:02 2006 +0000 @@ -64,7 +64,7 @@ #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 -r 5c6bdbf3aadf -r f1828a500391 include/SDL_stdinc.h --- a/include/SDL_stdinc.h Wed Jul 12 09:25:17 2006 +0000 +++ b/include/SDL_stdinc.h Thu Jul 13 08:13:02 2006 +0000 @@ -413,6 +413,12 @@ 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 -r 5c6bdbf3aadf -r f1828a500391 src/audio/SDL_audio.c --- a/src/audio/SDL_audio.c Wed Jul 12 09:25:17 2006 +0000 +++ b/src/audio/SDL_audio.c Thu Jul 13 08:13:02 2006 +0000 @@ -497,7 +497,7 @@ 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 @@ 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 -r 5c6bdbf3aadf -r f1828a500391 src/stdlib/SDL_string.c --- a/src/stdlib/SDL_string.c Wed Jul 12 09:25:17 2006 +0000 +++ b/src/stdlib/SDL_string.c Thu Jul 13 08:13:02 2006 +0000 @@ -336,6 +336,18 @@ } #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 -r 5c6bdbf3aadf -r f1828a500391 src/video/win32/SDL_d3drender.c --- a/src/video/win32/SDL_d3drender.c Wed Jul 12 09:25:17 2006 +0000 +++ b/src/video/win32/SDL_d3drender.c Thu Jul 13 08:13:02 2006 +0000 @@ -287,6 +287,7 @@ 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 @@ Uint32 color) { SDL_D3D_RenderData *data = (SDL_D3D_RenderData *) renderer->driverdata; + D3DRECT d3drect; HRESULT result; if (data->beginScene) { @@ -438,9 +440,12 @@ 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 -r 5c6bdbf3aadf -r f1828a500391 src/video/win32/SDL_gdirender.c --- a/src/video/win32/SDL_gdirender.c Wed Jul 12 09:25:17 2006 +0000 +++ b/src/video/win32/SDL_gdirender.c Thu Jul 13 08:13:02 2006 +0000 @@ -79,7 +79,7 @@ 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_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 -r 5c6bdbf3aadf -r f1828a500391 src/video/win32/SDL_win32video.h --- a/src/video/win32/SDL_win32video.h Wed Jul 12 09:25:17 2006 +0000 +++ b/src/video/win32/SDL_win32video.h Thu Jul 13 08:13:02 2006 +0000 @@ -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