mirror of
https://github.com/joel16/SDL2.git
synced 2025-01-09 04:40:17 +00:00
Removed libc dependency on Windows again, to fix building with Visual C++ 2005 Express Edition.
Fixed performance problem with testsprite2 on the D3D driver. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401946
This commit is contained in:
parent
ddce62b162
commit
9cbad57c92
@ -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
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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)) {
|
||||
|
@ -32,7 +32,9 @@
|
||||
#include <windows.h>
|
||||
|
||||
#if SDL_VIDEO_RENDER_D3D
|
||||
#include <d3d9.h>
|
||||
//#include <d3d9.h>
|
||||
#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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user