Moved the rendering code out to a separate directory in the hope that it can someday be completely decoupled from the rest of the library and be expanded to an awesome 2D on 3D library.

--HG--
rename : src/video/windows/SDL_d3drender.c => src/render/direct3d/SDL_d3drender.c
rename : src/video/SDL_renderer_gl.c => src/render/opengl/SDL_renderer_gl.c
rename : src/video/SDL_renderer_gles.c => src/render/opengles/SDL_renderer_gles.c
rename : src/video/SDL_renderer_sw.c => src/render/software/SDL_renderer_sw.c
This commit is contained in:
Sam Lantinga 2011-02-02 14:34:54 -08:00
parent 9623680313
commit 5897ef7d95
35 changed files with 1620 additions and 2183 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,28 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2010 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#if SDL_VIDEO_RENDER_D3D
extern void D3D_AddRenderDriver(_THIS);
#endif
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -116,7 +116,6 @@ WIN_InitKeyboard(_THIS)
data->ime_candlistindexbase = 0;
data->ime_candvertical = SDL_TRUE;
data->ime_candtex = NULL;
data->ime_dirty = SDL_FALSE;
SDL_memset(&data->ime_rect, 0, sizeof(data->ime_rect));
SDL_memset(&data->ime_candlistrect, 0, sizeof(data->ime_candlistrect));
@ -1274,36 +1273,6 @@ StopDrawToBitmap(HDC hdc, HBITMAP *hhbm)
}
}
static void
BitmapToTexture(HBITMAP hbm, BYTE *bits, int width, int height, SDL_Texture **texture)
{
SDL_Surface *surface = NULL;
BITMAP bm = {0};
if (GetObject(hbm, sizeof(bm), &bm) == 0)
return;
if (bits && texture) {
/*
For transparency:
const Uint8 alpha = 130;
unsigned long *p = (unsigned long *)bits;
unsigned long *end = (unsigned long *)(bits + (bm.bmWidthBytes * bm.bmHeight));
while (p < end) {
*p = RGB(GetRValue(*p), GetGValue(*p), GetBValue(*p)) | (alpha << 24);
++p;
}
surface = SDL_CreateRGBSurfaceFrom(bits, width, height, bm.bmBitsPixel, bm.bmWidthBytes, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
*/
surface = SDL_CreateRGBSurfaceFrom(bits, width, height, bm.bmBitsPixel, bm.bmWidthBytes, 0x00ff0000, 0x0000ff00, 0x000000ff, 0);
if (surface) {
*texture = SDL_CreateTextureFromSurface(0, surface);
SDL_FreeSurface(surface);
}
}
}
/* This draws only within the specified area and fills the entire region. */
static void
DrawRect(HDC hdc, int left, int top, int right, int bottom, int pensize)
@ -1317,19 +1286,9 @@ DrawRect(HDC hdc, int left, int top, int right, int bottom, int pensize)
Rectangle(hdc, left, top, right, bottom);
}
static void
DestroyTexture(SDL_Texture **texture)
{
if (texture && *texture) {
SDL_DestroyTexture(*texture);
*texture = NULL;
}
}
static void
IME_DestroyTextures(SDL_VideoData *videodata)
{
DestroyTexture(&videodata->ime_candtex);
}
#define SDL_swap(a,b) { \
@ -1544,7 +1503,6 @@ IME_RenderCandidateList(SDL_VideoData *videodata, HDC hdc)
DrawRect(hdc, left, top, right, bottom, candborder);
ExtTextOutW(hdc, left + candborder + candpadding, top + candborder + candpadding, 0, NULL, s, SDL_wcslen(s), NULL);
}
BitmapToTexture(hbm, bits, size.cx, size.cy, &videodata->ime_candtex);
StopDrawToBitmap(hdc, &hbm);
DeleteObject(listpen);
@ -1576,7 +1534,7 @@ void IME_Present(SDL_VideoData *videodata)
if (videodata->ime_dirty)
IME_Render(videodata);
SDL_RenderCopy(videodata->ime_candtex, NULL, &videodata->ime_candlistrect);
// FIXME: Need to show the IME bitmap
}
#endif /* SDL_DISABLE_WINDOWS_IME */

View file

@ -29,7 +29,6 @@
#include "SDL_windowsvideo.h"
#include "SDL_windowsshape.h"
#include "SDL_d3drender.h"
/* Initialization/Query functions */
static int WIN_VideoInit(_THIS);
@ -50,12 +49,6 @@ WIN_DeleteDevice(SDL_VideoDevice * device)
SDL_VideoData *data = (SDL_VideoData *) device->driverdata;
SDL_UnregisterApp();
#if SDL_VIDEO_RENDER_D3D
if (data->d3d) {
IDirect3D9_Release(data->d3d);
SDL_UnloadObject(data->d3dDLL);
}
#endif
#ifdef _WIN32_WCE
if(data->hAygShell) {
SDL_UnloadObject(data->hAygShell);
@ -175,10 +168,6 @@ WIN_VideoInit(_THIS)
return -1;
}
#if SDL_VIDEO_RENDER_D3D
D3D_AddRenderDriver(_this);
#endif
WIN_InitKeyboard(_this);
WIN_InitMouse(_this);

View file

@ -39,12 +39,6 @@
#define MAX_CANDLIST 10
#define MAX_CANDLENGTH 256
#if SDL_VIDEO_RENDER_D3D
//#include <d3d9.h>
#define D3D_DEBUG_INFO
#include "d3d9.h"
#endif
#include "SDL_windowsclipboard.h"
#include "SDL_windowsevents.h"
#include "SDL_windowsgamma.h"
@ -57,8 +51,6 @@
#include "SDL_loadso.h"
enum { RENDER_NONE, RENDER_D3D };
#if WINVER < 0x0601
/* Touch input definitions */
#define TWF_FINETOUCH 1
@ -125,10 +117,6 @@ typedef struct SDL_VideoData
{
int render;
#if SDL_VIDEO_RENDER_D3D
void* d3dDLL;
IDirect3D9 *d3d;
#endif
#ifdef _WIN32_WCE
void* hAygShell;
PFNSHFullScreen SHFullScreen;
@ -166,7 +154,6 @@ typedef struct SDL_VideoData
int ime_candlistindexbase;
SDL_bool ime_candvertical;
SDL_Texture *ime_candtex;
SDL_bool ime_dirty;
SDL_Rect ime_rect;
SDL_Rect ime_candlistrect;