Removed libc dependency on Windows again, to fix building with Visual C++ 2005 Express Edition.
authorSam Lantinga <slouken@libsdl.org>
Thu, 13 Jul 2006 08:13:02 +0000
changeset 1901f1828a500391
parent 1900 5c6bdbf3aadf
child 1902 eb2891493b66
Removed libc dependency on Windows again, to fix building with Visual C++ 2005 Express Edition.
Fixed performance problem with testsprite2 on the D3D driver.
include/SDL_config_win32.h
include/SDL_stdinc.h
src/audio/SDL_audio.c
src/stdlib/SDL_string.c
src/video/win32/SDL_d3drender.c
src/video/win32/SDL_gdirender.c
src/video/win32/SDL_win32video.h
     1.1 --- a/include/SDL_config_win32.h	Wed Jul 12 09:25:17 2006 +0000
     1.2 +++ b/include/SDL_config_win32.h	Thu Jul 13 08:13:02 2006 +0000
     1.3 @@ -64,7 +64,7 @@
     1.4  #define SDL_HAS_64BIT_TYPE	1
     1.5  
     1.6  /* Enabled for SDL 1.2 (binary compatibility) */
     1.7 -#define HAVE_LIBC	1
     1.8 +//#define HAVE_LIBC	1
     1.9  #ifdef HAVE_LIBC
    1.10  /* Useful headers */
    1.11  #define HAVE_STDIO_H 1
     2.1 --- a/include/SDL_stdinc.h	Wed Jul 12 09:25:17 2006 +0000
     2.2 +++ b/include/SDL_stdinc.h	Thu Jul 13 08:13:02 2006 +0000
     2.3 @@ -413,6 +413,12 @@
     2.4  extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
     2.5  #endif
     2.6  
     2.7 +#ifdef HAVE_WCSLEN
     2.8 +#define SDL_wcslen      wcslen
     2.9 +#else
    2.10 +extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *string);
    2.11 +#endif
    2.12 +
    2.13  #ifdef HAVE_STRLCPY
    2.14  #define SDL_strlcpy     strlcpy
    2.15  #else
     3.1 --- a/src/audio/SDL_audio.c	Wed Jul 12 09:25:17 2006 +0000
     3.2 +++ b/src/audio/SDL_audio.c	Thu Jul 13 08:13:02 2006 +0000
     3.3 @@ -497,7 +497,7 @@
     3.4      if (desired->channels == 0) {
     3.5          env = SDL_getenv("SDL_AUDIO_CHANNELS");
     3.6          if (env) {
     3.7 -            desired->channels = SDL_atoi(env);
     3.8 +            desired->channels = (Uint8)SDL_atoi(env);
     3.9          }
    3.10      }
    3.11      if (desired->channels == 0) {
    3.12 @@ -517,7 +517,7 @@
    3.13      if (desired->samples == 0) {
    3.14          env = SDL_getenv("SDL_AUDIO_SAMPLES");
    3.15          if (env) {
    3.16 -            desired->samples = SDL_atoi(env);
    3.17 +            desired->samples = (Uint16)SDL_atoi(env);
    3.18          }
    3.19      }
    3.20      if (desired->samples == 0) {
     4.1 --- a/src/stdlib/SDL_string.c	Wed Jul 12 09:25:17 2006 +0000
     4.2 +++ b/src/stdlib/SDL_string.c	Thu Jul 13 08:13:02 2006 +0000
     4.3 @@ -336,6 +336,18 @@
     4.4  }
     4.5  #endif
     4.6  
     4.7 +#ifndef HAVE_WCSLEN
     4.8 +size_t
     4.9 +SDL_wcslen(const wchar_t *string)
    4.10 +{
    4.11 +    size_t len = 0;
    4.12 +    while (*string++) {
    4.13 +        ++len;
    4.14 +    }
    4.15 +    return len;
    4.16 +}
    4.17 +#endif
    4.18 +
    4.19  #ifndef HAVE_STRLCPY
    4.20  size_t
    4.21  SDL_strlcpy(char *dst, const char *src, size_t maxlen)
     5.1 --- a/src/video/win32/SDL_d3drender.c	Wed Jul 12 09:25:17 2006 +0000
     5.2 +++ b/src/video/win32/SDL_d3drender.c	Thu Jul 13 08:13:02 2006 +0000
     5.3 @@ -287,6 +287,7 @@
     5.4          pparams.Windowed = TRUE;
     5.5      }
     5.6      pparams.FullScreen_RefreshRateInHz = 0;     /* FIXME */
     5.7 +    pparams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
     5.8  
     5.9      result = IDirect3D9_CreateDevice(videodata->d3d, D3DADAPTER_DEFAULT,        /* FIXME */
    5.10                                       D3DDEVTYPE_HAL,
    5.11 @@ -431,6 +432,7 @@
    5.12                     Uint32 color)
    5.13  {
    5.14      SDL_D3D_RenderData *data = (SDL_D3D_RenderData *) renderer->driverdata;
    5.15 +    D3DRECT d3drect;
    5.16      HRESULT result;
    5.17  
    5.18      if (data->beginScene) {
    5.19 @@ -438,9 +440,12 @@
    5.20          data->beginScene = SDL_FALSE;
    5.21      }
    5.22  
    5.23 -    result =
    5.24 -        IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET,
    5.25 -                               (D3DCOLOR) color, 1.0f, 0);
    5.26 +    d3drect.x1 = rect->x;
    5.27 +    d3drect.x2 = rect->x+rect->w;
    5.28 +    d3drect.y1 = rect->y;
    5.29 +    d3drect.y2 = rect->y+rect->h;
    5.30 +
    5.31 +    result = IDirect3DDevice9_Clear(data->device, 1, &d3drect, D3DCLEAR_TARGET, (D3DCOLOR) color, 1.0f, 0);
    5.32      if (FAILED(result)) {
    5.33          D3D_SetError("Clear()", result);
    5.34          return -1;
     6.1 --- a/src/video/win32/SDL_gdirender.c	Wed Jul 12 09:25:17 2006 +0000
     6.2 +++ b/src/video/win32/SDL_gdirender.c	Thu Jul 13 08:13:02 2006 +0000
     6.3 @@ -79,7 +79,7 @@
     6.4      SDL_GDI_CreateRenderer,
     6.5      {
     6.6       "gdi",
     6.7 -     (                          //SDL_Renderer_Minimal |
     6.8 +     (SDL_Renderer_Minimal |
     6.9           SDL_Renderer_SingleBuffer | SDL_Renderer_PresentCopy |
    6.10           SDL_Renderer_PresentFlip2 | SDL_Renderer_PresentFlip3 |
    6.11           SDL_Renderer_PresentDiscard | SDL_Renderer_RenderTarget),
    6.12 @@ -735,7 +735,6 @@
    6.13  {
    6.14      SDL_GDI_RenderData *data = (SDL_GDI_RenderData *) renderer->driverdata;
    6.15      SDL_DirtyRect *dirty;
    6.16 -    int new_hbm;
    6.17  
    6.18      /* Send the data to the display */
    6.19      if (!(renderer->info.flags & SDL_Renderer_SingleBuffer)) {
     7.1 --- a/src/video/win32/SDL_win32video.h	Wed Jul 12 09:25:17 2006 +0000
     7.2 +++ b/src/video/win32/SDL_win32video.h	Thu Jul 13 08:13:02 2006 +0000
     7.3 @@ -32,7 +32,9 @@
     7.4  #include <windows.h>
     7.5  
     7.6  #if SDL_VIDEO_RENDER_D3D
     7.7 -#include <d3d9.h>
     7.8 +//#include <d3d9.h>
     7.9 +#define D3D_DEBUG_INFO
    7.10 +#include "d3d9.h"
    7.11  #endif
    7.12  
    7.13  #include "SDL_win32events.h"
    7.14 @@ -43,10 +45,10 @@
    7.15  #include "SDL_win32window.h"
    7.16  
    7.17  #ifdef UNICODE
    7.18 -#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2", (char *)S, (wcslen(S)+1)*sizeof(WCHAR))
    7.19 +#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "UCS-2", (char *)S, (SDL_wcslen(S)+1)*sizeof(WCHAR))
    7.20  #define WIN_UTF8ToString(S) (WCHAR *)SDL_iconv_string("UCS-2", "UTF-8", (char *)S, SDL_strlen(S)+1)
    7.21  #else
    7.22 -#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)S, (strlen(S)+1))
    7.23 +#define WIN_StringToUTF8(S) SDL_iconv_string("UTF-8", "ASCII", (char *)S, (SDL_strlen(S)+1))
    7.24  #define WIN_UTF8ToString(S) SDL_iconv_string("ASCII", "UTF-8", (char *)S, SDL_strlen(S)+1)
    7.25  #endif
    7.26