Removed more partially functional renderers
authorSam Lantinga <slouken@libsdl.org>
Mon, 31 Jan 2011 22:53:45 -0800
changeset 5139 57851a238c8f
parent 5138 da10636e5eca
child 5140 e743b9c3f6d6
Removed more partially functional renderers
configure.in
include/SDL_config.h.in
include/SDL_config_windows.h
src/video/windows/SDL_ceddrawrender.c
src/video/windows/SDL_ceddrawrender.h
src/video/windows/SDL_gapirender.c
src/video/windows/SDL_gapirender.h
src/video/windows/SDL_gapirender_c.h
src/video/windows/SDL_windowsevents.c
src/video/windows/SDL_windowsvideo.c
src/video/windows/SDL_windowsvideo.h
src/video/windows/SDL_windowswindow.c
--- a/configure.in	Mon Jan 31 22:44:43 2011 -0800
+++ b/configure.in	Mon Jan 31 22:53:45 2011 -0800
@@ -2345,18 +2345,6 @@
             AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS)
             SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
             have_video=yes
-            AC_ARG_ENABLE(render-gapi,
-AC_HELP_STRING([--enable-render-gapi], [enable the GAPI/RAWFRAMEBUFFER render driver [[default=yes]]]),
-                                , enable_render_gapi=yes)
-            if test x$enable_render_gapi = xyes -a x$have_wince = xyes; then
-                AC_DEFINE(SDL_VIDEO_RENDER_GAPI)
-            fi
-            AC_ARG_ENABLE(render-ddraw,
-AC_HELP_STRING([--enable-render-ddraw], [enable the Mobile DirectDraw render driver [[default=yes]]]),
-                                , enable_render_ddraw=yes)
-            if test x$enable_render_ddraw = xyes -a x$have_wince = xyes -a x$have_ddraw = xyes; then
-                AC_DEFINE(SDL_VIDEO_RENDER_DDRAW)
-            fi
             AC_ARG_ENABLE(render-d3d,
 AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
                                 , enable_render_d3d=yes)
--- a/include/SDL_config.h.in	Mon Jan 31 22:44:43 2011 -0800
+++ b/include/SDL_config.h.in	Mon Jan 31 22:53:45 2011 -0800
@@ -287,8 +287,6 @@
 #undef SDL_VIDEO_RENDER_D3D
 #undef SDL_VIDEO_RENDER_OGL
 #undef SDL_VIDEO_RENDER_OGL_ES
-#undef SDL_VIDEO_RENDER_GAPI
-#undef SDL_VIDEO_RENDER_DDRAW
 
 /* Enable OpenGL support */
 #undef SDL_VIDEO_OPENGL
--- a/include/SDL_config_windows.h	Mon Jan 31 22:44:43 2011 -0800
+++ b/include/SDL_config_windows.h	Mon Jan 31 22:53:45 2011 -0800
@@ -178,11 +178,7 @@
 #define SDL_VIDEO_DRIVER_DUMMY	1
 #define SDL_VIDEO_DRIVER_WINDOWS	1
 
-#ifdef _WIN32_WCE
-#ifndef SDL_VIDEO_RENDER_GAPI
-#define SDL_VIDEO_RENDER_GAPI	1
-#endif
-#else
+#ifndef _WIN32_WCE
 #ifndef SDL_VIDEO_RENDER_D3D
 #define SDL_VIDEO_RENDER_D3D	1
 #endif
--- a/src/video/windows/SDL_ceddrawrender.c	Mon Jan 31 22:44:43 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,818 +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
-    
-    Stefan Klug
-    klug.stefan@gmx.de
-*/
-#include "SDL_config.h"
-
-#if SDL_VIDEO_RENDER_DDRAW
-
-#include "SDL_windowsvideo.h"
-#include "../SDL_yuv_sw_c.h"
-
-#if 0
-#define DDRAW_LOG(...) printf(__VA_ARGS__)
-#else
-#define DDRAW_LOG(...)
-#endif
-
-
-/* DirectDraw renderer implementation */
-
-static SDL_Renderer *DDRAW_CreateRenderer(SDL_Window * window, Uint32 flags);
-static int DDRAW_DisplayModeChanged(SDL_Renderer * renderer);
-static int DDRAW_CreateTexture(SDL_Renderer * renderer,
-                               SDL_Texture * texture);
-static int DDRAW_QueryTexturePixels(SDL_Renderer * renderer,
-                                    SDL_Texture * texture, void **pixels,
-                                    int *pitch);
-static int DDRAW_SetTextureColorMod(SDL_Renderer * renderer,
-                                    SDL_Texture * texture);
-static int DDRAW_SetTextureAlphaMod(SDL_Renderer * renderer,
-                                    SDL_Texture * texture);
-static int DDRAW_SetTextureBlendMode(SDL_Renderer * renderer,
-                                     SDL_Texture * texture);
-static int DDRAW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
-                               const SDL_Rect * rect, const void *pixels,
-                               int pitch);
-static int DDRAW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
-                             const SDL_Rect * rect, int markDirty,
-                             void **pixels, int *pitch);
-static void DDRAW_UnlockTexture(SDL_Renderer * renderer,
-                                SDL_Texture * texture);
-static void DDRAW_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
-                               int numrects, const SDL_Rect * rects);
-static int DDRAW_RenderPoint(SDL_Renderer * renderer, int x, int y);
-static int DDRAW_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2,
-                            int y2);
-static int DDRAW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect);
-static int DDRAW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
-                            const SDL_Rect * srcrect,
-                            const SDL_Rect * dstrect);
-static void DDRAW_RenderPresent(SDL_Renderer * renderer);
-static void DDRAW_DestroyTexture(SDL_Renderer * renderer,
-                                 SDL_Texture * texture);
-static void DDRAW_DestroyRenderer(SDL_Renderer * renderer);
-
-
-SDL_RenderDriver DDRAW_RenderDriver = {
-    DDRAW_CreateRenderer,
-    {
-     "ddraw",
-     (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY |
-      SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
-      SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED),
-     (SDL_TEXTUREMODULATE_NONE),
-     (SDL_BLENDMODE_NONE),
-     0,
-     {0},
-     0,
-     0}
-};
-
-typedef struct
-{
-    IDirectDraw *ddraw;
-    IDirectDrawSurface *primary;
-} DDRAW_RenderData;
-
-typedef struct
-{
-    RECT lock;
-    IDirectDrawSurface *surface;
-} DDRAW_TextureData;
-
-
-static void
-DDRAW_SetError(const char *prefix, HRESULT result)
-{
-    const char *error;
-
-    switch (result) {
-    case DDERR_CANTCREATEDC:
-        error = "CANTCREATEDC";
-        break;
-    case DDERR_CANTLOCKSURFACE:
-        error = "CANTLOCKSURFACE";
-        break;
-    case DDERR_CLIPPERISUSINGHWND:
-        error = "CLIPPERISUSINGHWND";
-        break;
-    case DDERR_COLORKEYNOTSET:
-        error = "COLORKEYNOTSET";
-        break;
-    case DDERR_CURRENTLYNOTAVAIL:
-        error = "CURRENTLYNOTAVAIL";
-        break;
-    case DDERR_DCALREADYCREATED:
-        error = "DCALREADYCREATED";
-        break;
-    case DDERR_DEVICEDOESNTOWNSURFACE:
-        error = "DEVICEDOESNTOWNSURFACE";
-        break;
-    case DDERR_DIRECTDRAWALREADYCREATED:
-        error = "DIRECTDRAWALREADYCREATED";
-        break;
-    case DDERR_EXCLUSIVEMODEALREADYSET:
-        error = "EXCLUSIVEMODEALREADYSET";
-        break;
-    case DDERR_GENERIC:
-        error = "GENERIC";
-        break;
-    case DDERR_HEIGHTALIGN:
-        error = "HEIGHTALIGN";
-        break;
-    case DDERR_IMPLICITLYCREATED:
-        error = "IMPLICITLYCREATED";
-        break;
-    case DDERR_INCOMPATIBLEPRIMARY:
-        error = "INCOMPATIBLEPRIMARY";
-        break;
-    case DDERR_INVALIDCAPS:
-        error = "INVALIDCAPS";
-        break;
-    case DDERR_INVALIDCLIPLIST:
-        error = "INVALIDCLIPLIST";
-        break;
-    case DDERR_INVALIDMODE:
-        error = "INVALIDMODE";
-        break;
-    case DDERR_INVALIDOBJECT:
-        error = "INVALIDOBJECT";
-        break;
-    case DDERR_INVALIDPARAMS:
-        error = "INVALIDPARAMS";
-        break;
-    case DDERR_INVALIDPIXELFORMAT:
-        error = "INVALIDPIXELFORMAT";
-        break;
-    case DDERR_INVALIDPOSITION:
-        error = "INVALIDPOSITION";
-        break;
-    case DDERR_INVALIDRECT:
-        error = "INVALIDRECT";
-        break;
-    case DDERR_LOCKEDSURFACES:
-        error = "LOCKEDSURFACES";
-        break;
-    case DDERR_MOREDATA:
-        error = "MOREDATA";
-        break;
-    case DDERR_NOALPHAHW:
-        error = "NOALPHAHW";
-        break;
-    case DDERR_NOBLTHW:
-        error = "NOBLTHW";
-        break;
-    case DDERR_NOCLIPLIST:
-        error = "NOCLIPLIST";
-        break;
-    case DDERR_NOCLIPPERATTACHED:
-        error = "NOCLIPPERATTACHED";
-        break;
-    case DDERR_NOCOLORCONVHW:
-        error = "NOCOLORCONVHW";
-        break;
-    case DDERR_NOCOLORKEYHW:
-        error = "NOCOLORKEYHW";
-        break;
-    case DDERR_NOCOOPERATIVELEVELSET:
-        error = "NOCOOPERATIVELEVELSET";
-        break;
-    case DDERR_NODC:
-        error = "NODC";
-        break;
-    case DDERR_NOFLIPHW:
-        error = "NOFLIPHW";
-        break;
-    case DDERR_NOOVERLAYDEST:
-        error = "NOOVERLAYDEST";
-        break;
-    case DDERR_NOOVERLAYHW:
-        error = "NOOVERLAYHW";
-        break;
-    case DDERR_NOPALETTEATTACHED:
-        error = "NOPALETTEATTACHED";
-        break;
-    case DDERR_NOPALETTEHW:
-        error = "NOPALETTEHW";
-        break;
-    case DDERR_NORASTEROPHW:
-        error = "NORASTEROPHW";
-        break;
-    case DDERR_NOSTRETCHHW:
-        error = "NOSTRETCHHW";
-        break;
-    case DDERR_NOTAOVERLAYSURFACE:
-        error = "NOTAOVERLAYSURFACE";
-        break;
-    case DDERR_NOTFLIPPABLE:
-        error = "NOTFLIPPABLE";
-        break;
-    case DDERR_NOTFOUND:
-        error = "NOTFOUND";
-        break;
-    case DDERR_NOTLOCKED:
-        error = "NOTLOCKED";
-        break;
-    case DDERR_NOTPALETTIZED:
-        error = "NOTPALETTIZED";
-        break;
-    case DDERR_NOVSYNCHW:
-        error = "NOVSYNCHW";
-        break;
-    case DDERR_NOZOVERLAYHW:
-        error = "NOZOVERLAYHW";
-        break;
-    case DDERR_OUTOFCAPS:
-        error = "OUTOFCAPS";
-        break;
-    case DDERR_OUTOFMEMORY:
-        error = "OUTOFMEMORY";
-        break;
-    case DDERR_OUTOFVIDEOMEMORY:
-        error = "OUTOFVIDEOMEMORY";
-        break;
-    case DDERR_OVERLAPPINGRECTS:
-        error = "OVERLAPPINGRECTS";
-        break;
-    case DDERR_OVERLAYNOTVISIBLE:
-        error = "OVERLAYNOTVISIBLE";
-        break;
-    case DDERR_PALETTEBUSY:
-        error = "PALETTEBUSY";
-        break;
-    case DDERR_PRIMARYSURFACEALREADYEXISTS:
-        error = "PRIMARYSURFACEALREADYEXISTS";
-        break;
-    case DDERR_REGIONTOOSMALL:
-        error = "REGIONTOOSMALL";
-        break;
-    case DDERR_SURFACEBUSY:
-        error = "SURFACEBUSY";
-        break;
-    case DDERR_SURFACELOST:
-        error = "SURFACELOST";
-        break;
-    case DDERR_TOOBIGHEIGHT:
-        error = "TOOBIGHEIGHT";
-        break;
-    case DDERR_TOOBIGSIZE:
-        error = "TOOBIGSIZE";
-        break;
-    case DDERR_TOOBIGWIDTH:
-        error = "TOOBIGWIDTH";
-        break;
-    case DDERR_UNSUPPORTED:
-        error = "UNSUPPORTED";
-        break;
-    case DDERR_UNSUPPORTEDFORMAT:
-        error = "UNSUPPORTEDFORMAT";
-        break;
-    case DDERR_VERTICALBLANKINPROGRESS:
-        error = "VERTICALBLANKINPROGRESS";
-        break;
-    case DDERR_VIDEONOTACTIVE:
-        error = "VIDEONOTACTIVE";
-        break;
-    case DDERR_WASSTILLDRAWING:
-        error = "WASSTILLDRAWING";
-        break;
-    case DDERR_WRONGMODE:
-        error = "WRONGMODE";
-        break;
-    default:
-        error = "UNKNOWN";
-        break;
-    }
-    SDL_SetError("%s: %s", prefix, error);
-}
-
-static SDL_bool
-PixelFormatToDDPIXELFORMAT(Uint32 format, LPDDPIXELFORMAT dst)
-{
-    SDL_zerop(dst);
-    dst->dwSize = sizeof(*dst);
-
-    if (SDL_ISPIXELFORMAT_FOURCC(format)) {
-        dst->dwFlags = DDPF_FOURCC;
-        dst->dwFourCC = format;
-    } else if (SDL_ISPIXELFORMAT_INDEXED(format)) {
-        SDL_SetError("Indexed pixelformats are not supported.");
-        return SDL_FALSE;
-    } else {
-        int bpp;
-        Uint32 Rmask, Gmask, Bmask, Amask;
-        if (!SDL_PixelFormatEnumToMasks
-            (format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
-            SDL_SetError("pixelformat not supported");
-            return SDL_FALSE;
-        }
-
-        if (!Rmask && !Gmask && !Bmask) {
-            dst->dwFlags = DDPF_ALPHA;
-            dst->dwAlphaBitDepth = bpp;
-        } else {
-            dst->dwFlags = DDPF_RGB;
-            dst->dwRGBBitCount = bpp;
-            dst->dwRBitMask = Rmask;
-            dst->dwGBitMask = Gmask;
-            dst->dwBBitMask = Bmask;
-
-            if (Amask) {
-                dst->dwFlags |= DDPF_ALPHAPIXELS;
-                dst->dwRGBAlphaBitMask = Amask;
-            }
-        }
-    }
-
-    return SDL_TRUE;
-}
-
-static SDL_bool
-DDRAW_IsTextureFormatAvailable(IDirectDraw * ddraw, Uint32 display_format,
-                               Uint32 texture_format)
-{
-    int bpp;
-    Uint32 Rmask, Gmask, Bmask, Amask;
-
-    if (SDL_ISPIXELFORMAT_FOURCC(texture_format)) {
-        //TODO I don't expect DDRAW to support all 4CC formats, but I don't know which ones
-        return SDL_TRUE;
-    }
-    //These are only basic checks
-    if (SDL_ISPIXELFORMAT_INDEXED(texture_format)) {
-        return SDL_FALSE;
-    }
-
-    if (!SDL_PixelFormatEnumToMasks
-        (texture_format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
-        return SDL_FALSE;
-    }
-
-    switch (bpp) {
-    case 4:
-    case 8:
-    case 16:
-    case 24:
-    case 32:
-        break;
-    default:
-        return SDL_FALSE;
-    }
-
-    return SDL_TRUE;
-}
-
-void
-DDRAW_AddRenderDriver(_THIS)
-{
-    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
-    SDL_RendererInfo *info = &DDRAW_RenderDriver.info;
-    SDL_DisplayMode *mode = &SDL_CurrentDisplay->desktop_mode;
-
-    if (data->ddraw) {
-        int i;
-        int formats[] = {
-            SDL_PIXELFORMAT_INDEX8,
-            SDL_PIXELFORMAT_RGB332,
-            SDL_PIXELFORMAT_RGB444,
-            SDL_PIXELFORMAT_RGB555,
-            SDL_PIXELFORMAT_ARGB4444,
-            SDL_PIXELFORMAT_ARGB1555,
-            SDL_PIXELFORMAT_RGB565,
-            SDL_PIXELFORMAT_RGB888,
-            SDL_PIXELFORMAT_ARGB8888,
-            SDL_PIXELFORMAT_ARGB2101010,
-        };
-
-        for (i = 0; i < SDL_arraysize(formats); ++i) {
-            if (DDRAW_IsTextureFormatAvailable
-                (data->ddraw, mode->format, formats[i])) {
-                info->texture_formats[info->num_texture_formats++] =
-                    formats[i];
-            }
-        }
-
-        //TODO the fourcc formats should get fetched from IDirectDraw::GetFourCCCodes
-        info->texture_formats[info->num_texture_formats++] =
-            SDL_PIXELFORMAT_YV12;
-        info->texture_formats[info->num_texture_formats++] =
-            SDL_PIXELFORMAT_IYUV;
-        info->texture_formats[info->num_texture_formats++] =
-            SDL_PIXELFORMAT_YUY2;
-        info->texture_formats[info->num_texture_formats++] =
-            SDL_PIXELFORMAT_UYVY;
-        info->texture_formats[info->num_texture_formats++] =
-            SDL_PIXELFORMAT_YVYU;
-
-        for (i = 0; i < _this->num_displays; ++i)
-            SDL_AddRenderDriver(&_this->displays[i], &DDRAW_RenderDriver);
-        }
-    }
-}
-
-SDL_Renderer *
-DDRAW_CreateRenderer(SDL_Window * window, Uint32 flags)
-{
-    SDL_VideoDisplay *display = window->display;
-    SDL_VideoData *videodata = (SDL_VideoData *) display->device->driverdata;
-    SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata;
-    SDL_Renderer *renderer;
-    DDRAW_RenderData *data;
-    HRESULT result;
-    DDSURFACEDESC ddsd;
-
-    renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer));
-    if (!renderer) {
-        SDL_OutOfMemory();
-        return NULL;
-    }
-
-    data = (DDRAW_RenderData *) SDL_calloc(1, sizeof(*data));
-    if (!data) {
-        DDRAW_DestroyRenderer(renderer);
-        SDL_OutOfMemory();
-        return NULL;
-    }
-    data->ddraw = videodata->ddraw;
-
-    videodata->render = RENDER_DDRAW;
-
-    renderer->DisplayModeChanged = DDRAW_DisplayModeChanged;
-    renderer->CreateTexture = DDRAW_CreateTexture;
-    renderer->QueryTexturePixels = DDRAW_QueryTexturePixels;
-
-    renderer->SetTextureColorMod = DDRAW_SetTextureColorMod;
-    renderer->SetTextureAlphaMod = DDRAW_SetTextureAlphaMod;
-    renderer->SetTextureBlendMode = DDRAW_SetTextureBlendMode;
-    renderer->UpdateTexture = DDRAW_UpdateTexture;
-    renderer->LockTexture = DDRAW_LockTexture;
-    renderer->UnlockTexture = DDRAW_UnlockTexture;
-    renderer->DirtyTexture = DDRAW_DirtyTexture;
-    renderer->RenderPoint = DDRAW_RenderPoint;
-    renderer->RenderLine = DDRAW_RenderLine;
-    renderer->RenderFill = DDRAW_RenderFill;
-    renderer->RenderCopy = DDRAW_RenderCopy;
-    renderer->RenderPresent = DDRAW_RenderPresent;
-    renderer->DestroyTexture = DDRAW_DestroyTexture;
-    renderer->DestroyRenderer = DDRAW_DestroyRenderer;
-    renderer->info = DDRAW_RenderDriver.info;
-    renderer->window = window;
-    renderer->driverdata = data;
-
-    renderer->info.flags = SDL_RENDERER_ACCELERATED;
-
-    SDL_zero(ddsd);
-    ddsd.dwSize = sizeof(ddsd);
-    ddsd.dwFlags = DDSD_CAPS;
-
-    if (window->flags & SDL_WINDOW_FULLSCREEN) {
-        ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-    } else {
-        //TODO handle non fullscreen
-        SDL_SetError("DirectDraw renderer has only fullscreen implemented");
-        DDRAW_DestroyRenderer(renderer);
-        return NULL;
-    }
-
-    if (flags & SDL_RENDERER_PRESENTFLIP2) {
-        ddsd.dwFlags |= DDSD_BACKBUFFERCOUNT;
-        ddsd.dwBackBufferCount = 2;
-    } else if (flags & SDL_RENDERER_PRESENTFLIP3) {
-        ddsd.dwFlags |= DDSD_BACKBUFFERCOUNT;
-        ddsd.dwBackBufferCount = 3;
-    } else if (flags & SDL_RENDERER_PRESENTCOPY) {
-        //TODO what is the best approximation to this mode
-    } else {
-
-    }
-
-    if (flags & SDL_RENDERER_PRESENTVSYNC) {
-        SDL_SetError("DirectDraw renderer with v-sync is not implemented");
-        DDRAW_DestroyRenderer(renderer);
-        return NULL;
-    }
-
-    result =
-        data->ddraw->lpVtbl->SetCooperativeLevel(data->ddraw,
-                                                 windowdata->hwnd,
-                                                 DDSCL_NORMAL);
-    if (result != DD_OK) {
-        DDRAW_SetError("CreateDevice()", result);
-        DDRAW_DestroyRenderer(renderer);
-        return NULL;
-    }
-
-    result =
-        data->ddraw->lpVtbl->CreateSurface(data->ddraw, &ddsd, &data->primary,
-                                           NULL);
-    if (result != DD_OK) {
-        DDRAW_SetError("CreateDevice()", result);
-        DDRAW_DestroyRenderer(renderer);
-        return NULL;
-    }
-
-    return renderer;
-}
-
-static int
-DDRAW_Reset(SDL_Renderer * renderer)
-{
-    //TODO implement
-    /*D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
-       HRESULT result;
-
-       result = IDirect3DDevice9_Reset(data->device, &data->pparams);
-       if (FAILED(result)) {
-       if (result == D3DERR_DEVICELOST) {
-       /* Don't worry about it, we'll reset later... *
-       return 0;
-       } else {
-       D3D_SetError("Reset()", result);
-       return -1;
-       }
-       }
-       IDirect3DDevice9_SetVertexShader(data->device, NULL);
-       IDirect3DDevice9_SetFVF(data->device,
-       D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
-       IDirect3DDevice9_SetRenderState(data->device, D3DRS_CULLMODE,
-       D3DCULL_NONE);
-       IDirect3DDevice9_SetRenderState(data->device, D3DRS_LIGHTING, FALSE); */
-    return 0;
-}
-
-static int
-DDRAW_DisplayModeChanged(SDL_Renderer * renderer)
-{
-    //TODO implement
-    /*D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
-       SDL_Window *window = renderer->window;
-       SDL_VideoDisplay *display = window->display;
-
-       data->pparams.BackBufferWidth = window->w;
-       data->pparams.BackBufferHeight = window->h;
-       if (window->flags & SDL_WINDOW_FULLSCREEN) {
-       data->pparams.BackBufferFormat =
-       PixelFormatToD3DFMT(display->fullscreen_mode.format);
-       } else {
-       data->pparams.BackBufferFormat = D3DFMT_UNKNOWN;
-       }
-       return D3D_Reset(renderer); */
-    return 0;
-}
-
-static int
-DDRAW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
-{
-    DDRAW_RenderData *renderdata = (DDRAW_RenderData *) renderer->driverdata;
-    SDL_Window *window = renderer->window;
-    SDL_VideoDisplay *display = window->display;
-    Uint32 display_format = display->current_mode.format;
-    DDRAW_TextureData *data;
-    DDSURFACEDESC ddsd;
-    HRESULT result;
-
-    data = (DDRAW_TextureData *) SDL_calloc(1, sizeof(*data));
-    if (!data) {
-        SDL_OutOfMemory();
-        return -1;
-    }
-
-    SDL_zero(ddsd);
-    ddsd.dwSize = sizeof(ddsd);
-    ddsd.dwFlags = DDSD_PIXELFORMAT | DDSD_HEIGHT | DDSD_WIDTH;
-    ddsd.dwWidth = texture->w;
-    ddsd.dwHeight = texture->h;
-
-
-    if (!PixelFormatToDDPIXELFORMAT(texture->format, &ddsd.ddpfPixelFormat)) {
-        SDL_free(data);
-        return -1;
-    }
-
-    texture->driverdata = data;
-
-    result =
-        renderdata->ddraw->lpVtbl->CreateSurface(renderdata->ddraw, &ddsd,
-                                                 &data->surface, NULL);
-    if (result != DD_OK) {
-        SDL_free(data);
-        DDRAW_SetError("CreateTexture", result);
-        return -1;
-    }
-
-    return 0;
-}
-
-static int
-DDRAW_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
-                         void **pixels, int *pitch)
-{
-    //TODO implement
-    SDL_SetError("QueryTexturePixels is not implemented");
-    return -1;
-}
-
-static int
-DDRAW_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
-{
-    return 0;
-}
-
-static int
-DDRAW_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
-{
-    return 0;
-}
-
-static int
-DDRAW_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
-{
-    switch (texture->blendMode) {
-    case SDL_BLENDMODE_NONE:
-        return 0;
-    default:
-        SDL_Unsupported();
-        texture->blendMode = SDL_BLENDMODE_NONE;
-        return -1;
-    }
-}
-
-static int
-DDRAW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
-                    const SDL_Rect * rect, const void *pixels, int pitch)
-{
-    DDRAW_TextureData *data = (DDRAW_TextureData *) texture->driverdata;
-
-    //TODO implement
-    SDL_SetError("UpdateTexture is not implemented");
-    return 0;
-}
-
-static int
-DDRAW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
-                  const SDL_Rect * rect, int markDirty, void **pixels,
-                  int *pitch)
-{
-    DDRAW_TextureData *data = (DDRAW_TextureData *) texture->driverdata;
-    HRESULT result;
-    DDSURFACEDESC ddsd;
-
-    SDL_zero(ddsd);
-    ddsd.dwSize = sizeof(ddsd);
-
-    /**
-     * On a Axim x51v locking a subrect returns the startaddress of the whole surface,
-     * wheras on my ASUS MyPal 696 the startaddress of the locked area is returned,
-     * thats why I always lock the whole surface and calculate the pixels pointer by hand.
-     * This shouldn't be a speed problem, as multiple locks aren't available on DDraw Mobile
-     * see http://msdn.microsoft.com/en-us/library/ms858221.aspx
-     */
-
-    result = data->surface->lpVtbl->Lock(data->surface, NULL, &ddsd, 0, NULL);
-    if (result != DD_OK) {
-        DDRAW_SetError("LockRect()", result);
-        return -1;
-    }
-
-    *pixels = ddsd.lpSurface + rect->y * ddsd.lPitch + rect->x * ddsd.lXPitch;
-    *pitch = ddsd.lPitch;
-    return 0;
-}
-
-static void
-DDRAW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
-{
-    DDRAW_TextureData *data = (DDRAW_TextureData *) texture->driverdata;
-
-    data->surface->lpVtbl->Unlock(data->surface, NULL);
-}
-
-static void
-DDRAW_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
-                   int numrects, const SDL_Rect * rects)
-{
-}
-
-static void
-DDRAW_SetBlendMode(DDRAW_RenderData * data, int blendMode)
-{
-    switch (blendMode) {
-
-    }
-}
-
-static int
-DDRAW_RenderPoint(SDL_Renderer * renderer, int x, int y)
-{
-    return -1;
-}
-
-static int
-DDRAW_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
-{
-    return -1;
-}
-
-static int
-DDRAW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect)
-{
-    return -1;
-}
-
-static int
-DDRAW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
-                 const SDL_Rect * srcrect, const SDL_Rect * dstrect)
-{
-    DDRAW_RenderData *data = (DDRAW_RenderData *) renderer->driverdata;
-    DDRAW_TextureData *texturedata =
-        (DDRAW_TextureData *) texture->driverdata;
-    HRESULT result;
-    RECT srcr;
-    RECT dstr;
-    DDBLTFX bltfx;
-
-    srcr.left = srcrect->x;
-    srcr.top = srcrect->y;
-    srcr.right = srcrect->x + srcrect->w;
-    srcr.bottom = srcrect->y + srcrect->h;
-
-    dstr.left = dstrect->x;
-    dstr.top = dstrect->y;
-    dstr.right = dstrect->x + dstrect->w;
-    dstr.bottom = dstrect->y + dstrect->h;
-
-    SDL_zero(bltfx);
-    bltfx.dwSize = sizeof(bltfx);
-    bltfx.dwROP = SRCCOPY;
-
-    data->primary->lpVtbl->Blt(data->primary, &dstr, texturedata->surface,
-                               &srcr, DDBLT_ROP, &bltfx);
-
-    return 0;
-}
-
-static void
-DDRAW_RenderPresent(SDL_Renderer * renderer)
-{
-    DDRAW_RenderData *data = (DDRAW_RenderData *) renderer->driverdata;
-    HRESULT result;
-
-    return;
-
-    result =
-        data->primary->lpVtbl->Flip(data->primary, NULL, DDFLIP_INTERVAL1);
-    if (result != DD_OK) {
-        DDRAW_SetError("Present()", result);
-    }
-}
-
-static void
-DDRAW_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
-{
-    DDRAW_TextureData *data = (DDRAW_TextureData *) texture->driverdata;
-
-    if (!data) {
-        return;
-    }
-
-    data->surface->lpVtbl->Release(data->surface);
-    SDL_free(data);
-    texture->driverdata = NULL;
-}
-
-static void
-DDRAW_DestroyRenderer(SDL_Renderer * renderer)
-{
-    DDRAW_RenderData *data = (DDRAW_RenderData *) renderer->driverdata;
-
-    if (data) {
-        data->primary->lpVtbl->Release(data->primary);
-        SDL_free(data);
-    }
-    SDL_free(renderer);
-}
-
-#endif /* SDL_VIDEO_RENDER_DDRAW */
-
-/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/windows/SDL_ceddrawrender.h	Mon Jan 31 22:44:43 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +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
-    
-    Stefan Klug
-    klug.stefan@gmx.de
-*/
-#include "SDL_config.h"
-
-#if SDL_VIDEO_RENDER_DDRAW
-extern void DDRAW_AddRenderDriver(_THIS);
-#endif
-
-/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/windows/SDL_gapirender.c	Mon Jan 31 22:44:43 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1293 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2010 by Andrey Afletdinov <afletdinov@gmail.com>        *
- *                                                                         *
- *   WinCE RAW/GAPI video driver                                           *
- *                                                                         *
- *   Part of the SDL - (Simple DirectMedia Layer)                          *
- *   http://www.libsdl.org                                                 *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program 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 General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
- ***************************************************************************/
-
-#include "SDL_config.h"
-
-#if SDL_VIDEO_RENDER_GAPI
-
-#include "SDL_windowsvideo.h"
-#include "SDL_windowswindow.h"
-#include "../SDL_yuv_sw_c.h"
-
-// RawFrameBufferInfo
-typedef struct
-{
-   WORD wFormat;
-   WORD wBPP;
-   VOID *pFramePointer;
-   int  cxStride;
-   int  cyStride;
-   int  cxPixels;
-   int  cyPixels;
-} RawFrameBufferInfo;
-
-// GXDeviceInfo
-typedef struct
-{
-    long Version;
-    void* pvFrameBuffer;
-    unsigned long cbStride;
-    unsigned long cxWidth;
-    unsigned long cyHeight;
-    unsigned long cBPP;
-    unsigned long ffFormat;
-    char unknown[0x84 - 7 * 4];
-} GXDeviceInfo;
-
-// wince: GXDisplayProperties
-struct GXDisplayProperties
-{
-    DWORD cxWidth;
-    DWORD cyHeight;
-    long cbxPitch;
-    long cbyPitch;
-    long cBPP;
-    DWORD ffFormat;
-};
-
-// gx.dll
-typedef int   (*PFNGXOpenDisplay)(HWND hWnd, DWORD dwFlags);
-typedef int   (*PFNGXCloseDisplay)();
-typedef void* (*PFNGXBeginDraw)();
-typedef int   (*PFNGXEndDraw)();
-typedef struct GXDisplayProperties (*PFNGXGetDisplayProperties)();
-typedef int   (*PFNGXSuspend)();
-typedef int   (*PFNGXResume)();
-
-typedef struct
-{
-    // gx.dll
-    void*                     hGapiLib;
-    PFNGXOpenDisplay          GXOpenDisplay;
-    PFNGXCloseDisplay         GXCloseDisplay;
-    PFNGXBeginDraw            GXBeginDraw;
-    PFNGXEndDraw              GXEndDraw;
-    PFNGXGetDisplayProperties GXGetDisplayProperties;
-    PFNGXSuspend              GXSuspend;
-    PFNGXResume               GXResume;
-} GapiInfo;
-
-//#ifndef DM_DISPLAYORIENTATION
-//#define DM_DISPLAYORIENTATION 0x00800000L
-//#endif
-
-#define FORMAT_565                1
-#define FORMAT_555                2
-#define FORMAT_OTHER                3
-
-#define GETRAWFRAMEBUFFER        0x00020001
-#define GETGXINFO                0x00020000
-
-#define kfPalette                0x10
-#define kfDirect                0x20
-#define kfDirect555                0x40
-#define kfDirect565                0x80
-
-#define GX_FULLSCREEN                0x01
-
-enum ScreenOrientation { ORIENTATION_UNKNOWN = -1, ORIENTATION_UP = DMDO_0, ORIENTATION_DOWN = DMDO_180, ORIENTATION_LEFT = DMDO_270, ORIENTATION_RIGHT = DMDO_90 };
-enum ScreenGeometry { GEOMETRY_UNKNOWN, GEOMETRY_PORTRAIT, GEOMETRY_LANDSCAPE, GEOMETRY_SQUARE };
-enum FrameBufferFlags { FB_SKIP_OFFSET = 0x0001, FB_RAW_MODE = 0x0002, FB_SUSPENDED = 0x0004 };
-
-// private framebuffer info
-typedef struct
-{
-    int width;
-    int height;
-    int xpitch;
-    int ypitch;
-    int offset;
-} FrameBufferInfo;
-
-// private display data
-typedef struct
-{
-    unsigned char* pixels;        // video memory
-    int format;                        // video format
-    FrameBufferInfo fb;                // framebuffer geometry
-    GapiInfo* gapi;                // GAPI module
-    int userOrientation;
-    int systemOrientation;
-    int hardwareGeometry;
-    int flags;                        // fb flags
-    float scale;                // scale pointer position
-    int debug;
-
-} WINCE_RenderData;
-
-typedef struct
-{
-    SDL_SW_YUVTexture *yuv;
-    Uint32 format;
-    void *pixels;
-    int pitch;
-
-} WINCE_TextureData;
-
-
-// system func
-SDL_Renderer*        WINCE_CreateRenderer(SDL_Window* window, Uint32 flags);
-void                WINCE_DestroyRenderer(SDL_Renderer* renderer);
-
-int                WINCE_CreateTexture(SDL_Renderer* renderer, SDL_Texture* texture);
-void                WINCE_DestroyTexture(SDL_Renderer* renderer, SDL_Texture* texture);
-int                WINCE_QueryTexturePixels(SDL_Renderer* renderer, SDL_Texture* texture, void** pixels, int* pitch);
-int                WINCE_UpdateTexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, const void* pixels, int pitch);
-int                WINCE_LockTexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, int dirty, void** pixels, int* pitch);
-void                WINCE_UnlockTexture(SDL_Renderer* renderer, SDL_Texture* texture);
-
-int                WINCE_Available(void);
-void                WINCE_SetupOrientation(WINCE_RenderData* data, int width, int height);
-
-int                WINCE_RenderCopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srect, const SDL_Rect* drect);
-void                WINCE_ShowWindow(_THIS, SDL_Window* window, int visible);
-
-void                WINCE_RenderPresent(SDL_Renderer* renderer);
-int                WINCE_RenderDrawPoints(SDL_Renderer* renderer, const SDL_Point* points, int count);
-int                WINCE_RenderDrawLines(SDL_Renderer* renderer, const SDL_Point* points, int count);
-int                WINCE_RenderDrawRects(SDL_Renderer* renderer, const SDL_Rect ** rects, int count);
-int                WINCE_RenderFillRects(SDL_Renderer* renderer, const SDL_Rect** rects, int count);
-
-void                WINCE_PointerCoordinateTransform(SDL_Window* window, POINT* pt);
-void                WINCE_DumpVideoInfo(WINCE_RenderData* data);
-void                WINCE_PortraitTransform(WINCE_RenderData* data, int width, int height);
-void                WINCE_LandscapeTransform(WINCE_RenderData* data, int width, int height);
-void                WINCE_SquareTransform(WINCE_RenderData* data, int width, int height);
-int                WINCE_FixedGeometry(FrameBufferInfo* fb, int bpp, int debug);
-int                WINCE_GetDMOrientation(void);
-int                WINCE_SetDMOrientation(int orientation);
-void                WINCE_UpdateYUVTextureData(SDL_Texture* texture);
-
-// gapi engine specific
-int                GAPI_Init(WINCE_RenderData* data, HWND hwnd);
-void                GAPI_Quit(WINCE_RenderData* data);
-
-// raw engine specific
-int                RAW_Init(WINCE_RenderData* data);
-void                RAW_Quit(WINCE_RenderData* data);
-
-// tools
-void                FrameBufferRotate(FrameBufferInfo* src, int orientation);
-int                GetFrameBufferOrientation(const FrameBufferInfo* src);
-void                PointerRotate(POINT* pt, const FrameBufferInfo* fb, int orientation);
-void                FrameBufferInitialize(FrameBufferInfo* fb);
-void                FrameBufferDumpInfo(const FrameBufferInfo* fb, const char*);
-const                char* GetOrientationName(int orientation);
-void                UpdateLine16to16(const FrameBufferInfo* fb, const Uint16* src, Uint16* dst, Uint16 width);
-
-// stdlib
-static __inline__ int        __abs(int x){ return x < 0 ? -x : x; };
-static __inline__ void        __swap(int* a, int* b){ int t = *a; *a = *b; *b = t; };
-
-#define GAPI_RENDER_NAME        "gapi"
-#define RAW_RENDER_NAME                "raw"
-//
-SDL_RenderDriver GAPI_RenderDriver = {
-    WINCE_CreateRenderer,
-    {
-        GAPI_RENDER_NAME,
-        (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD),
-        (SDL_TEXTUREMODULATE_NONE),
-        (SDL_BLENDMODE_NONE),
-        7,
-        {
-            SDL_PIXELFORMAT_RGB555,
-            SDL_PIXELFORMAT_RGB565,
-            SDL_PIXELFORMAT_YV12,
-            SDL_PIXELFORMAT_IYUV,
-            SDL_PIXELFORMAT_YUY2,
-            SDL_PIXELFORMAT_UYVY,
-            SDL_PIXELFORMAT_YVYU
-        },
-        0,
-        0
-    }
-};
-
-SDL_RenderDriver RAW_RenderDriver = {
-    WINCE_CreateRenderer,
-    {
-        RAW_RENDER_NAME,
-        (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD),
-        (SDL_TEXTUREMODULATE_NONE),
-        (SDL_BLENDMODE_NONE),
-        7,
-        {
-            SDL_PIXELFORMAT_RGB555,
-            SDL_PIXELFORMAT_RGB565,
-            SDL_PIXELFORMAT_YV12,
-            SDL_PIXELFORMAT_IYUV,
-            SDL_PIXELFORMAT_YUY2,
-            SDL_PIXELFORMAT_UYVY,
-            SDL_PIXELFORMAT_YVYU
-        },
-        0,
-        0
-    }
-};
-
-int WINCE_Available(void)
-{
-    void* render_gapi;
-    const char* preferably = SDL_getenv("SDL_VIDEO_RENDERER");
-
-    // raw check
-    RawFrameBufferInfo rfbi = { 0 };
-    HDC hdc = GetDC(NULL);
-    int render_raw = ExtEscape(hdc, GETRAWFRAMEBUFFER, 0, NULL, sizeof(RawFrameBufferInfo), (char *) &rfbi);
-    ReleaseDC(NULL, hdc);
-
-    if(render_raw != 0 && rfbi.cxPixels != 0 && rfbi.cyPixels != 0 &&
-       rfbi.pFramePointer != 0 && rfbi.cxStride != 0 && rfbi.cyStride != 0)
-        render_raw = 1;
-
-    if(preferably && 0 == SDL_strcasecmp(preferably, RAW_RENDER_NAME)) return 0 != render_raw;
-
-    // gapi check
-    render_gapi = SDL_LoadObject("\\Windows\\gx.dll");
-    if(0 == render_gapi)
-        render_gapi = SDL_LoadObject("gx.dll");
-    SDL_UnloadObject(render_gapi);
-
-    if(preferably && 0 == SDL_strcasecmp(preferably, GAPI_RENDER_NAME)) return 0 != render_gapi;
-
-    return 0 != render_raw || 0 != render_gapi;
-}
-
-void WINCE_AddRenderDriver(_THIS)
-{
-    HDC hdc;
-    void* render_gapi;
-    int render_raw, ii;
-    const char* preferably = SDL_getenv("SDL_VIDEO_RENDERER");
-
-   // raw check
-    RawFrameBufferInfo rfbi = { 0 };
-    hdc = GetDC(NULL);
-    render_raw = ExtEscape(hdc, GETRAWFRAMEBUFFER, 0, NULL, sizeof(RawFrameBufferInfo), (char *) &rfbi);
-    ReleaseDC(NULL, hdc);
-
-    if(render_raw != 0 && rfbi.cxPixels != 0 && rfbi.cyPixels != 0 &&
-            rfbi.pFramePointer != 0 && rfbi.cxStride != 0 && rfbi.cyStride != 0)
-            render_raw = 1;
-
-    // gapi check
-    render_gapi = SDL_LoadObject("\\Windows\\gx.dll");
-    if(0 == render_gapi)
-        render_gapi = SDL_LoadObject("gx.dll");
-
-    if(render_gapi)
-        SDL_UnloadObject(render_gapi);
-
-    for(ii = 0; ii < _this->num_displays; ++ii)
-    {
-        if(preferably)
-        {
-            if(0 == SDL_strcasecmp(preferably, RAW_RENDER_NAME) && render_raw)
-                SDL_AddRenderDriver(&_this->displays[ii], &RAW_RenderDriver);
-            else
-            if(0 == SDL_strcasecmp(preferably, GAPI_RENDER_NAME) && render_gapi)
-                SDL_AddRenderDriver(&_this->displays[ii], &GAPI_RenderDriver);
-        }
-        else
-        {
-            if(render_raw)
-                SDL_AddRenderDriver(&_this->displays[ii], &RAW_RenderDriver);
-            if(render_gapi)
-                SDL_AddRenderDriver(&_this->displays[ii], &GAPI_RenderDriver);
-        }
-    }
-}
-
-SDL_Renderer* WINCE_CreateRenderer(SDL_Window* window, Uint32 flags)
-{
-    SDL_VideoDisplay* display = window->display;
-    SDL_DisplayMode* displayMode = &display->current_mode;
-    SDL_WindowData* windowdata = (SDL_WindowData *) window->driverdata;
-    SDL_Renderer* renderer;
-    WINCE_RenderData* data;
-    int bpp;
-    Uint32 Rmask, Gmask, Bmask, Amask;
-
-    if(!(window->flags & SDL_WINDOW_FULLSCREEN))
-        window->flags |= SDL_WINDOW_FULLSCREEN;
-
-    if(!SDL_PixelFormatEnumToMasks(displayMode->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask))
-    {
-        SDL_SetError("Unknown display format");
-        return NULL;
-    }
-
-    switch(window->fullscreen_mode.format)
-    {
-        case SDL_PIXELFORMAT_RGB555:
-        case SDL_PIXELFORMAT_RGB565:
-            break;
-
-        default:
-            SDL_SetError("Support only 16 or 15 bpp");
-            return NULL;
-    }
-
-    renderer = (SDL_Renderer*) SDL_calloc(1, sizeof(SDL_Renderer));
-    if(!renderer)
-    {
-        SDL_OutOfMemory();
-        return NULL;
-    }
-
-    data = (WINCE_RenderData*) SDL_calloc(1, sizeof(WINCE_RenderData));
-    if(!data)
-    {
-        WINCE_DestroyRenderer(renderer);
-        SDL_OutOfMemory();
-        return NULL;
-    }
-
-    // initialize internal engine
-    if(!RAW_Init(data) && !GAPI_Init(data, windowdata->hwnd))
-    {
-        WINCE_DestroyRenderer(renderer);
-        return NULL;
-    }
-
-
-    // set debug
-    data->debug        = SDL_getenv("DEBUG_VIDEO_GAPI") || SDL_getenv("GAPI_RENDERER_DEBUG") ? 1 : 0;
-#if defined(DEBUG_VIDEO_GAPI) || defined(GAPI_RENDERER_DEBUG)
-    data->debug        = 1;
-#endif
-
-    windowdata->videodata->render = data->gapi ? RENDER_GAPI : RENDER_RAW;
-    windowdata->videodata->CoordTransform = WINCE_PointerCoordinateTransform;
-
-    window->display->device->MaximizeWindow = NULL;
-    window->display->device->MinimizeWindow = NULL;
-
-    WINCE_SetupOrientation(data, window->w, window->h);
-
-    renderer->CreateTexture = WINCE_CreateTexture;
-    renderer->DestroyTexture = WINCE_DestroyTexture;
-    renderer->QueryTexturePixels = WINCE_QueryTexturePixels;
-    renderer->UpdateTexture = WINCE_UpdateTexture;
-    renderer->LockTexture = WINCE_LockTexture;
-    renderer->UnlockTexture = WINCE_UnlockTexture;
-
-    renderer->RenderCopy = WINCE_RenderCopy;
-    renderer->DestroyRenderer = WINCE_DestroyRenderer;
-
-    renderer->RenderPresent = WINCE_RenderPresent;
-    renderer->RenderDrawPoints = WINCE_RenderDrawPoints;
-    renderer->RenderDrawLines = WINCE_RenderDrawLines;
-    renderer->RenderDrawRects = WINCE_RenderDrawRects;
-    renderer->RenderFillRects = WINCE_RenderFillRects;
-
-    renderer->info = data->gapi ? GAPI_RenderDriver.info : RAW_RenderDriver.info;
-
-    renderer->window = window;
-    renderer->driverdata = data;
-
-    return renderer;
-}
-
-void WINCE_DestroyRenderer(SDL_Renderer* renderer)
-{
-    WINCE_RenderData *renderdata = (WINCE_RenderData*) renderer->driverdata;
-
-    if(renderdata)
-    {
-        if(renderdata->gapi)
-            GAPI_Quit(renderdata);
-        else
-            RAW_Quit(renderdata);
-
-        SDL_free(renderdata);
-    }
-
-    SDL_free(renderer);
-}
-
-int WINCE_CreateTexture(SDL_Renderer* renderer, SDL_Texture* texture)
-{
-    WINCE_TextureData* texturedata = (WINCE_TextureData*) SDL_calloc(1, sizeof(WINCE_TextureData));
-    if(NULL == texturedata)
-    {
-        SDL_OutOfMemory();
-        return -1;
-    }
-
-    texturedata->pitch = texture->w * SDL_BYTESPERPIXEL(texture->format);
-    texturedata->pixels = SDL_malloc(texture->h * texturedata->pitch);
-    if(NULL == texturedata->pixels)
-    {
-        SDL_OutOfMemory();
-        return -1;
-    }
-
-    if(SDL_ISPIXELFORMAT_FOURCC(texture->format))
-    {
-        SDL_Window* window = renderer->window;
-        SDL_VideoDisplay* display = window->display;
-
-        texturedata->yuv = SDL_SW_CreateYUVTexture(texture->format, texture->w, texture->h);
-        if(NULL == texturedata->yuv)
-        {
-            SDL_OutOfMemory();
-            return -1;
-        }
-        texturedata->format = display->current_mode.format;
-    }
-    else
-    {
-        texturedata->yuv = NULL;
-        texturedata->format = texture->format;
-    }
-
-    texture->driverdata = texturedata;
-
-    return 0;
-}
-
-void WINCE_DestroyTexture(SDL_Renderer* renderer, SDL_Texture* texture)
-{
-    WINCE_TextureData *texturedata = (WINCE_TextureData*) texture->driverdata;
-
-    if(texturedata)
-    {
-        if(texturedata->yuv) SDL_SW_DestroyYUVTexture(texturedata->yuv);
-        if(texturedata->pixels) SDL_free(texturedata->pixels);
-        SDL_free(texturedata);
-        texture->driverdata = NULL;
-    }
-}
-
-int WINCE_QueryTexturePixels(SDL_Renderer* renderer, SDL_Texture* texture, void** pixels, int* pitch)
-{
-    WINCE_TextureData* texturedata = (WINCE_TextureData*) texture->driverdata;
-
-    if(texturedata->yuv)
-        return SDL_SW_QueryYUVTexturePixels(texturedata->yuv, pixels, pitch);
-
-    *pixels = texturedata->pixels;
-    *pitch = texturedata->pitch;
-
-    return 0;
-}
-
-int WINCE_UpdateTexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, const void* pixels, int pitch)
-{
-    WINCE_TextureData* texturedata = (WINCE_TextureData*) texture->driverdata;
-
-    if(texturedata->yuv)
-    {
-        if(SDL_SW_UpdateYUVTexture(texturedata->yuv, rect, pixels, pitch) < 0)
-            return -1;
-        WINCE_UpdateYUVTextureData(texture);
-        return 0;
-    }
-
-    if(0 < rect->w && 0 < rect->h)
-    {
-        const unsigned char *src = ((const unsigned char*) pixels);
-        unsigned char *dst = ((unsigned char*) texturedata->pixels) +
-                                rect->y * texturedata->pitch +
-                                rect->x * SDL_BYTESPERPIXEL(texture->format);
-        int length = rect->w * SDL_BYTESPERPIXEL(texture->format);
-        int height = rect->h;
-
-        while(height--)
-        {
-            SDL_memcpy(dst, src, length);
-            dst += texturedata->pitch;
-            src += pitch;
-        }
-    }
-
-    return 0;
-}
-
-int WINCE_LockTexture(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* rect, int dirty, void** pixels, int* pitch)
-{
-    WINCE_TextureData *texturedata = (WINCE_TextureData*) texture->driverdata;
-
-    if(texturedata->yuv)
-        return SDL_SW_LockYUVTexture(texturedata->yuv, rect, dirty, pixels, pitch);
-
-    *pixels = (void *) ((unsigned char*) texturedata->pixels +
-                    rect->y * texturedata->pitch +
-                    rect->x * SDL_BYTESPERPIXEL(texture->format));
-    *pitch = texturedata->pitch;
-    return 0;
-}
-
-void WINCE_UnlockTexture(SDL_Renderer* renderer, SDL_Texture* texture)
-{
-    WINCE_TextureData *texturedata = (WINCE_TextureData*) texture->driverdata;
-
-    if(texturedata->yuv)
-    {
-        SDL_SW_UnlockYUVTexture(texturedata->yuv);
-        WINCE_UpdateYUVTextureData(texture);
-    }
-}
-
-int WINCE_RenderCopy(SDL_Renderer* renderer, SDL_Texture* texture, const SDL_Rect* srect, const SDL_Rect* drect)
-{
-    WINCE_RenderData* dstdata = (WINCE_RenderData*) renderer->driverdata;
-    WINCE_TextureData* srcdata = (WINCE_TextureData*) texture->driverdata;
-    const unsigned char *src;
-    unsigned char *dst;
-
-    if((dstdata->flags & FB_SUSPENDED) ||
-       0 >= srect->w || 0 >= srect->h) return 0;
-
-    // lock gapi
-    if(dstdata->gapi) dstdata->gapi->GXBeginDraw();
-
-    src = ((const unsigned char*) srcdata->pixels);
-    dst = dstdata->pixels + (dstdata->flags & FB_SKIP_OFFSET ? 0 : dstdata->fb.offset) +
-                                drect->y * dstdata->fb.ypitch +
-                                drect->x * dstdata->fb.xpitch;
-    if(srcdata->yuv)
-    {
-        return SDL_SW_CopyYUVToRGB(srcdata->yuv,
-                                   srect, srcdata->format,
-                                   drect->w, drect->h, dst,
-                                   dstdata->fb.ypitch);
-    }
-    else
-    {
-        int height = drect->h;
-        int length = drect->w * SDL_BYTESPERPIXEL(texture->format); // in bytes
-
-        while(height--)
-        {
-            switch(SDL_BYTESPERPIXEL(texture->format))
-            {
-                case 2: UpdateLine16to16(&dstdata->fb, (Uint16*) src, (Uint16*) dst, length >> 1); break;
-
-                default: break;
-            }
-
-            dst += dstdata->fb.ypitch;
-            src += srcdata->pitch;
-        }
-    }
-
-    // unlock gapi
-    if(dstdata->gapi) dstdata->gapi->GXEndDraw();
-
-    return 0;
-}
-
-void WINCE_RenderPresent(SDL_Renderer* renderer)
-{
-}
-
-int WINCE_RenderDrawPoints(SDL_Renderer* renderer, const SDL_Point* points, int count)
-{
-    SDL_Unsupported();
-    return -1;
-}
-
-int WINCE_RenderDrawLines(SDL_Renderer* renderer, const SDL_Point* points, int count)
-{
-    SDL_Unsupported();
-    return -1;
-}
-
-int WINCE_RenderDrawRects(SDL_Renderer* renderer, const SDL_Rect ** rects, int count)
-{
-    SDL_Unsupported();
-    return -1;
-}
-
-int WINCE_RenderFillRects(SDL_Renderer* renderer, const SDL_Rect** rects, int count)
-{
-    SDL_Unsupported();
-    return -1;
-}
-
-
-
-void WINCE_SetupOrientation(WINCE_RenderData* data, int width, int height)
-{
-    const float maxW1 = (float)(GetSystemMetrics(SM_CXSCREEN) > GetSystemMetrics(SM_CYSCREEN) ? GetSystemMetrics(SM_CXSCREEN) : GetSystemMetrics(SM_CYSCREEN));
-    const float maxW2 = (float)(data->fb.width > data->fb.height ? data->fb.width : data->fb.height);
-
-    // scale define
-    data->scale = maxW2 / maxW1;
-
-    // init fb values
-    FrameBufferInitialize(&data->fb);
-
-    // orientation values
-    data->userOrientation = ORIENTATION_UP;
-    data->systemOrientation = WINCE_GetDMOrientation();
-    data->hardwareGeometry = data->fb.width == data->fb.height ? GEOMETRY_SQUARE :
-                                (data->fb.width < data->fb.height ? GEOMETRY_PORTRAIT : GEOMETRY_LANDSCAPE);
-
-    if(data->debug)
-        WINCE_DumpVideoInfo(data);
-
-    if(data->systemOrientation == ORIENTATION_UNKNOWN)
-        data->systemOrientation = ORIENTATION_UP;
-
-    data->userOrientation = ORIENTATION_UP;
-
-    switch(data->hardwareGeometry)
-    {
-        case GEOMETRY_PORTRAIT:  WINCE_PortraitTransform(data, width, height); break;
-        case GEOMETRY_LANDSCAPE: WINCE_LandscapeTransform(data, width, height); break;
-        case GEOMETRY_SQUARE:    WINCE_SquareTransform(data, width, height); break;
-        default: break;
-    }
-
-    // debug
-    if(data->debug)
-    {
-        printf("\n");
-        printf("user video width:          %d\n", width);
-        printf("user video height:         %d\n", height);
-        FrameBufferDumpInfo(&data->fb, "user");
-    }
-}
-
-void WINCE_DumpVideoInfo(WINCE_RenderData* data)
-{
-    // get oem info
-    WCHAR oemInfo[48];
-    SDL_memset(oemInfo, 0, sizeof(oemInfo));
-    SystemParametersInfo(SPI_GETOEMINFO, sizeof(oemInfo) - sizeof(WCHAR), oemInfo, 0);
-
-    printf("hardware oem: ");
-    wprintf(oemInfo);
-    printf("\n");
-
-    printf("video driver mode:             %s\n", (data->flags & FB_RAW_MODE ? RAW_RENDER_NAME : GAPI_RENDER_NAME));
-    printf("GetSystemMetrics(SM_CXSCREEN): %d\n", GetSystemMetrics(SM_CXSCREEN));
-    printf("GetSystemMetrics(SM_CYSCREEN): %d\n", GetSystemMetrics(SM_CYSCREEN));
-    printf("scale coord:                   %f\n", data->scale);
-
-    FrameBufferDumpInfo(&data->fb, "hardware");
-
-    printf("display format:                %p\n", data->format);
-    printf("display bits per pixel:        %d\n", SDL_BITSPERPIXEL(data->format));
-    printf("display bytes per pixel:       %d\n", SDL_BYTESPERPIXEL(data->format));
-    printf("display memory:                %p\n", data->pixels);
-    printf("system orientation:            %d, %s\n", data->systemOrientation, GetOrientationName(data->systemOrientation));
-    printf("hardware geometry:             %d\n", data->hardwareGeometry);
-}
-
-void WINCE_ShowWindow(_THIS, SDL_Window* window, int visible)
-{
-    SDL_WindowData* windowdata = (SDL_WindowData*) window->driverdata;
-    SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
-    SDL_Renderer* renderer = (SDL_Renderer*) window->renderer;
-
-    if(visible)
-    {
-        if(window->flags & SDL_WINDOW_FULLSCREEN)
-        {
-            if(videodata->SHFullScreen)
-                videodata->SHFullScreen(windowdata->hwnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON);
-            ShowWindow(FindWindow(TEXT("HHTaskBar"), NULL), SW_HIDE);
-        }
-
-        ShowWindow(windowdata->hwnd, SW_SHOW);
-        SetForegroundWindow(windowdata->hwnd);
-
-        if(renderer &&
-            (videodata->render == RENDER_GAPI || videodata->render == RENDER_RAW))
-        {
-            WINCE_RenderData* renderdata = (WINCE_RenderData*) renderer->driverdata;
-            renderdata->flags &= ~FB_SUSPENDED;
-            if(renderdata->gapi) renderdata->gapi->GXResume();
-        }
-    }
-    else
-    {
-        if(renderer &&
-            (videodata->render == RENDER_GAPI || videodata->render == RENDER_RAW))
-        {
-            WINCE_RenderData* renderdata = (WINCE_RenderData*) renderer->driverdata;
-            if(renderdata->gapi) renderdata->gapi->GXSuspend();
-            renderdata->flags |= FB_SUSPENDED;
-        }
-
-        ShowWindow(windowdata->hwnd, SW_HIDE);
-
-        if(window->flags & SDL_WINDOW_FULLSCREEN)
-        {
-            if(videodata->SHFullScreen)
-                videodata->SHFullScreen(windowdata->hwnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON | SHFS_SHOWSIPBUTTON);
-            ShowWindow(FindWindow(TEXT("HHTaskBar"), NULL), SW_SHOW);
-        }
-    }
-}
-
-
-void WINCE_PointerCoordinateTransform(SDL_Window* window, POINT* pt)
-{
-    WINCE_RenderData* data = (WINCE_RenderData*) window->renderer->driverdata;
-
-    pt->x = (LONG)(pt->x * data->scale);
-    pt->y = (LONG)(pt->y * data->scale);
-
-    PointerRotate(pt, &data->fb, data->userOrientation);
-}
-
-void WINCE_PortraitTransform(WINCE_RenderData* data, int width, int height)
-{
-    if(data->systemOrientation != ORIENTATION_UP)
-        FrameBufferRotate(&data->fb, data->systemOrientation);
-
-    if(data->fb.width != width || data->fb.height != height) {
-        switch(data->systemOrientation)
-        {
-            case ORIENTATION_UP:
-            case ORIENTATION_LEFT: data->userOrientation = ORIENTATION_RIGHT; break;
-            case ORIENTATION_RIGHT:
-            case ORIENTATION_DOWN: data->userOrientation = ORIENTATION_LEFT; break;
-            default: break;
-        }
-    }
-
-    if(data->userOrientation != ORIENTATION_UP)
-        FrameBufferRotate(&data->fb, data->userOrientation);
-}
-
-void WINCE_LandscapeTransform(WINCE_RenderData* data, int width, int height)
-{
-    switch(data->systemOrientation)
-    {
-        case ORIENTATION_UP:  FrameBufferRotate(&data->fb, ORIENTATION_LEFT); break;
-        case ORIENTATION_LEFT:FrameBufferRotate(&data->fb, ORIENTATION_DOWN); break;
-        case ORIENTATION_DOWN:FrameBufferRotate(&data->fb, ORIENTATION_RIGHT); break;
-        default: break;
-    }
-
-    if(data->fb.width != width || data->fb.height != height)
-    switch(data->systemOrientation)
-    {
-        case ORIENTATION_UP:
-        case ORIENTATION_LEFT: data->userOrientation = ORIENTATION_RIGHT; break;
-        case ORIENTATION_RIGHT:
-        case ORIENTATION_DOWN: data->userOrientation = ORIENTATION_LEFT; break;
-        default: break;
-    }
-
-    if(data->userOrientation != ORIENTATION_UP)
-        FrameBufferRotate(&data->fb, data->userOrientation);
-}
-
-void WINCE_SquareTransform(WINCE_RenderData* data, int width, int height)
-{
-    WINCE_PortraitTransform(data, width, height);
-}
-
-int WINCE_FixedGeometry(FrameBufferInfo* fb, int bpp, int debug)
-{
-    // check square
-    if(GetSystemMetrics(SM_CXSCREEN) == GetSystemMetrics(SM_CYSCREEN) &&
-        fb->width != fb->height)
-    {
-        if(fb->width < fb->height)
-            fb->height = fb->width;
-        else
-        if(fb->height < fb->width)
-            fb->width = fb->height;
-    }
-
-    // check width
-    if(__abs(fb->xpitch) == bpp &&
-        fb->width  != __abs(fb->ypitch) / bpp)
-    {
-        if(fb->height == __abs(fb->ypitch) / bpp)
-            {
-            __swap(&fb->width, &fb->height);
-
-            if(debug)
-                printf("WINCE_FixedGeometry: width: %d, height: %d\n", fb->width, fb->height);
-        }
-        else
-            return -1;
-    }
-    else
-    // check height
-    if(__abs(fb->ypitch) == bpp &&
-        fb->height != __abs(fb->xpitch) / bpp)
-    {
-        if(fb->width  == __abs(fb->xpitch) / bpp)
-            {
-            __swap(&fb->width, &fb->height);
-
-            if(debug)
-                printf("WINCE_FixedGeometry: width: %d, height: %d\n", fb->width, fb->height);
-        }
-        else
-            return -1;
-    }
-
-    return 0;
-}
-
-void WINCE_UpdateYUVTextureData(SDL_Texture* texture)
-{
-    WINCE_TextureData* texturedata = (WINCE_TextureData*) texture->driverdata;
-    SDL_Rect rect;
-
-    rect.x = 0;
-    rect.y = 0;
-    rect.w = texture->w;
-    rect.h = texture->h;
-    SDL_SW_CopyYUVToRGB(texturedata->yuv, &rect, texturedata->format, texture->w, texture->h, texturedata->pixels, texturedata->pitch);
-}
-
-int GAPI_Init(WINCE_RenderData* data, HWND hwnd)
-{
-    if(NULL == data->gapi)
-    {
-        struct GXDisplayProperties gxProperties;
-        GXDeviceInfo gxInfo = { 0 };
-        HDC hdc;
-        int enable, result;
-        const char* preferably = SDL_getenv("SDL_VIDEO_RENDERER");
-        if(preferably && 0 != SDL_strcasecmp(preferably, GAPI_RENDER_NAME)) return 0;
-
-        data->gapi = (GapiInfo *) SDL_calloc(1, sizeof(GapiInfo));
-        if(NULL == data->gapi)
-        {
-            SDL_OutOfMemory();
-            return 0;
-        }
-
-        data->gapi->hGapiLib = SDL_LoadObject("\\Windows\\gx.dll");
-        if(0 == data->gapi->hGapiLib)
-        {
-            data->gapi->hGapiLib = SDL_LoadObject("gx.dll");
-            if(0 == data->gapi->hGapiLib) return 0;
-        }
-
-        // load gapi library
-#define LINK(type,name,import) name=(PFN##type)SDL_LoadFunction(data->gapi->hGapiLib,import)
-        LINK(GXOpenDisplay,         data->gapi->GXOpenDisplay,         "?GXOpenDisplay@@YAHPAUHWND__@@K@Z");
-        LINK(GXCloseDisplay,        data->gapi->GXCloseDisplay,        "?GXCloseDisplay@@YAHXZ");
-        LINK(GXBeginDraw,           data->gapi->GXBeginDraw,           "?GXBeginDraw@@YAPAXXZ");
-        LINK(GXEndDraw,             data->gapi->GXEndDraw,             "?GXEndDraw@@YAHXZ");
-        LINK(GXGetDisplayProperties,data->gapi->GXGetDisplayProperties,"?GXGetDisplayProperties@@YA?AUGXDisplayProperties@@XZ");
-        LINK(GXSuspend,             data->gapi->GXSuspend,             "?GXSuspend@@YAHXZ");
-        LINK(GXResume,              data->gapi->GXResume,              "?GXResume@@YAHXZ");
-#undef LINK
-
-        enable = data->gapi->GXGetDisplayProperties && data->gapi->GXCloseDisplay && data->gapi->GXOpenDisplay &&
-            data->gapi->GXBeginDraw && data->gapi->GXEndDraw && data->gapi->GXSuspend && data->gapi->GXResume;
-
-        if(!enable)
-        {
-            SDL_SetError("GAPI_Init: error gx.dll: internal error");
-            GAPI_Quit(data);
-            return 0;
-        }
-
-        if(0 == data->gapi->GXOpenDisplay(hwnd, GX_FULLSCREEN))
-        {
-            SDL_SetError("GAPI_Init: couldn't initialize GAPI");
-            GAPI_Quit(data);
-            return 0;
-        }
-
-        gxProperties = data->gapi->GXGetDisplayProperties();
-
-        // fill FrameBufferInfo
-        data->fb.xpitch = gxProperties.cbxPitch;
-        data->fb.ypitch = gxProperties.cbyPitch;
-        data->fb.width  = gxProperties.cxWidth;
-        data->fb.height = gxProperties.cyHeight;
-        data->fb.offset = 0;
-
-        if((gxProperties.ffFormat & kfDirect565) || 16 == gxProperties.cBPP)
-            data->format = SDL_PIXELFORMAT_RGB565;
-        else
-        if((gxProperties.ffFormat & kfDirect555) || 15 == gxProperties.cBPP)
-            data->format = SDL_PIXELFORMAT_RGB555;
-        else
-            data->format = 0;
-
-        // get pixels
-        hdc = GetDC(NULL);
-
-        gxInfo.Version = 100;
-        result = ExtEscape(hdc, GETGXINFO, 0, NULL, sizeof(gxInfo), (char *) &gxInfo);
-        ReleaseDC(NULL, hdc);
-
-        if(result > 0)
-        {
-            // more debug
-            if(data->debug)
-            {
-                int i;
-
-                printf("GXDeviceInfo.pvFrameBuffer:    %p\n", gxInfo.pvFrameBuffer);
-                printf("GXDeviceInfo.cxWidth:          %d\n", gxInfo.cxWidth);
-                printf("GXDeviceInfo.cyHeight:         %d\n", gxInfo.cyHeight);
-                printf("GXDeviceInfo.cbStride:         %d\n", gxInfo.cbStride);
-                printf("GXDeviceInfo.cBPP:             %d\n", gxInfo.cBPP);
-                printf("GXDeviceInfo.ffFormat:        0x%x\n", gxInfo.ffFormat);
-
-                printf("GXDeviceInfo.unk:\n");
-                for(i = 0; i <  sizeof(gxInfo.unknown); ++i)
-                    printf("0x%02hhX,", gxInfo.unknown[i]);
-                printf("\n");
-            }
-
-                if(gxInfo.ffFormat && gxInfo.ffFormat != gxProperties.ffFormat) {
-                    if((gxInfo.ffFormat & kfDirect565) || 16 == gxInfo.cBPP)
-                        data->format = SDL_PIXELFORMAT_RGB565;
-                    else
-                    if((gxInfo.ffFormat & kfDirect555) || 15 == gxInfo.cBPP)
-                        data->format = SDL_PIXELFORMAT_RGB555;
-                }
-
-                data->pixels = gxInfo.pvFrameBuffer;
-        }
-        else
-        {
-            data->flags |= FB_SKIP_OFFSET;
-            data->pixels = data->gapi->GXBeginDraw();
-            data->gapi->GXEndDraw();
-
-            if(data->debug)
-            {
-                printf("GAPI_Init\n");
-                printf("use GXBeginDraw:               %p\n", data->pixels);
-                printf("use skip offset\n");
-            }
-        }
-
-        if(0 == data->format ||
-            0 > WINCE_FixedGeometry(&data->fb, SDL_BYTESPERPIXEL(data->format), data->debug))
-        {
-            SDL_SetError("GAPI_Init: unknown hardware");
-            GAPI_Quit(data);
-            return 0;
-        }
-    }
-
-    return data->gapi && data->pixels ? 1 : 0;
-}
-
-void GAPI_Quit(WINCE_RenderData* data)
-{
-    if(data->gapi)
-    {
-        if(data->gapi->GXCloseDisplay) data->gapi->GXCloseDisplay(); 
-        if(data->gapi->hGapiLib)  SDL_UnloadObject(data->gapi->hGapiLib);
-
-        SDL_free(data->gapi);
-        data->gapi = NULL;
-    }
-}
-
-int RAW_Init(WINCE_RenderData* data)
-{
-    RawFrameBufferInfo rfbi = { 0 };
-    HDC hdc;
-    int result;
-    const char* preferably = SDL_getenv("SDL_VIDEO_RENDERER");
-    if(preferably && 0 != SDL_strcasecmp(preferably, RAW_RENDER_NAME)) return 0;
-
-    hdc = GetDC(NULL);
-    result = ExtEscape(hdc, GETRAWFRAMEBUFFER, 0, NULL, sizeof(RawFrameBufferInfo), (char *) &rfbi);
-    ReleaseDC(NULL, hdc);
-
-    //disable
-    if(result == 0 || rfbi.pFramePointer == 0 ||
-            rfbi.cxPixels == 0 || rfbi.cyPixels == 0 ||
-        rfbi.cxStride == 0 || rfbi.cyStride == 0) return 0;
-
-    data->flags     = FB_RAW_MODE;
-
-    // fill FrameBufferInfo
-    SDL_memset(&data->fb, 0, sizeof(FrameBufferInfo));
-
-    data->fb.xpitch = rfbi.cxStride;
-    data->fb.ypitch = rfbi.cyStride;
-    data->fb.width  = rfbi.cxPixels;
-    data->fb.height = rfbi.cyPixels;
-    data->fb.offset = 0;
-
-    if((FORMAT_565 & rfbi.wFormat) || 16 == rfbi.wBPP)
-        data->format = SDL_PIXELFORMAT_RGB565;
-    else
-    if((FORMAT_555 & rfbi.wFormat) || 15 == rfbi.wBPP)
-        data->format = SDL_PIXELFORMAT_RGB555;
-    else
-        data->format = 0;
-
-    if(0 == data->format ||
-        0 > WINCE_FixedGeometry(&data->fb, SDL_BYTESPERPIXEL(data->format), data->debug))
-    {
-        SDL_SetError("RAW_Init: unknown hardware");
-        RAW_Quit(data);
-        return 0;
-    }
-
-    data->pixels = rfbi.pFramePointer;
-
-    return data->pixels ? 1 : 0;
-}
-
-void RAW_Quit(WINCE_RenderData* data)
-{
-}
-
-void FrameBufferInitialize(FrameBufferInfo* fb)
-{
-    int orientation = GetFrameBufferOrientation(fb);
-
-    // set correct start offset
-    switch(orientation)
-    {
-        case ORIENTATION_UP:
-            fb->offset = 0;
-            break;
-
-        case ORIENTATION_LEFT:
-            fb->offset = __abs(fb->ypitch * (fb->height - 1));
-            break;
-
-        case ORIENTATION_RIGHT:
-            fb->offset = __abs(fb->xpitch * (fb->width - 1));
-            break;
-
-        case ORIENTATION_DOWN:
-            fb->offset = __abs(fb->xpitch * (fb->width - 1) +
-                                fb->ypitch * (fb->height - 1));
-            break;
-
-        default: break;
-    }
-
-    //if(orientation != ORIENTATION_UP)
-    switch(orientation)
-    {
-        case ORIENTATION_LEFT: FrameBufferRotate(fb, ORIENTATION_RIGHT); break;
-        case ORIENTATION_RIGHT:FrameBufferRotate(fb, ORIENTATION_LEFT); break;
-        case ORIENTATION_DOWN: FrameBufferRotate(fb, ORIENTATION_DOWN); break;
-
-        default: break;
-    }
-}
-
-int GetFrameBufferOrientation(const FrameBufferInfo* src)
-{
-    if(src->xpitch > 0 && src->ypitch > 0)
-        return ORIENTATION_UP;
-    else
-    if(src->xpitch > 0 && src->ypitch < 0)
-        return ORIENTATION_LEFT;
-    else
-    if(src->xpitch < 0 && src->ypitch > 0)
-        return ORIENTATION_RIGHT;
-    else
-    if(src->xpitch < 0 && src->ypitch < 0)
-        return ORIENTATION_DOWN;
-
-    return ORIENTATION_UNKNOWN;
-}
-
-void FrameBufferRotate(FrameBufferInfo* dst, int orientation)
-{
-    FrameBufferInfo src;
-    // copy dst -> src
-    SDL_memcpy(&src, dst, sizeof(FrameBufferInfo));
-
-    switch(orientation)
-    {
-        case ORIENTATION_LEFT:
-            dst->width  = src.height;
-            dst->height = src.width;
-            dst->xpitch = src.ypitch;
-            dst->ypitch = -src.xpitch;
-            dst->offset = src.offset + src.xpitch * (src.width - 1);
-            break;
-
-        case ORIENTATION_RIGHT:
-            dst->width  = src.height;
-            dst->height = src.width;
-            dst->xpitch = -src.ypitch;
-            dst->ypitch = src.xpitch;
-            dst->offset = src.offset + src.ypitch * (src.height - 1);
-            break;
-
-        case ORIENTATION_DOWN:
-            FrameBufferRotate(dst, ORIENTATION_LEFT);
-            FrameBufferRotate(dst, ORIENTATION_LEFT);
-            break;
-
-        default:
-            break;
-    }
-}
-
-void PointerRotate(POINT* pt, const FrameBufferInfo* fb, int orientation)
-{
-    switch(orientation)
-    {
-        case ORIENTATION_UP:
-            break;
-
-        case ORIENTATION_LEFT:
-        {
-            int temp = pt->y;
-            pt->y = fb->height - pt->x;
-            pt->x = temp;
-        }
-            break;
-
-        case ORIENTATION_RIGHT:
-        {
-            int temp = pt->x;
-            pt->x = fb->width - pt->y;
-            pt->y = temp;
-        }
-            break;
-
-        case ORIENTATION_DOWN:
-            pt->x = fb->width  - pt->x;
-            pt->y = fb->height - pt->y;
-            break;
-
-        default: break;
-    }
-}
-
-const char* GetOrientationName(int orientation)
-{
-    switch(orientation)
-    {
-        case ORIENTATION_UP:        return "UP";
-        case ORIENTATION_DOWN:      return "DOWN";
-        case ORIENTATION_LEFT:      return "LEFT";
-        case ORIENTATION_RIGHT:     return "RIGHT";
-        default: break;
-    }
-
-    return "UNKNOWN";
-}
-
-int WINCE_GetDMOrientation(void)
-{
-    DEVMODE sDevMode = {0};
-    sDevMode.dmSize = sizeof(DEVMODE);
-    sDevMode.dmFields = DM_DISPLAYORIENTATION;
-
-    // DMDO_0, DMDO_90, DMDO_180, DMDO_270
-    if(DISP_CHANGE_BADMODE != ChangeDisplaySettingsEx(NULL, &sDevMode, 0, CDS_TEST, NULL))
-        switch(sDevMode.dmDisplayOrientation)
-        {
-            case DMDO_0:        return DMDO_0;
-            case DMDO_90:        return DMDO_90;
-            case DMDO_180:        return DMDO_180;
-            case DMDO_270:        return DMDO_270;
-            default: break;
-        }
-
-    SDL_SetError("WINCE_GetDMOrientation: ChangeDisplaySettingsEx return BADMODE");
-    return -1;
-}
-
-int WINCE_SetDMOrientation(int orientation)
-{
-    DEVMODE sDevMode = {0};
-    sDevMode.dmSize = sizeof(DEVMODE);
-    sDevMode.dmFields = DM_DISPLAYORIENTATION;
-
-    switch(orientation)
-    {
-        case DMDO_0:        sDevMode.dmDisplayOrientation = DMDO_0;   break;
-        case DMDO_90:        sDevMode.dmDisplayOrientation = DMDO_90;  break;
-        case DMDO_180:        sDevMode.dmDisplayOrientation = DMDO_180; break;
-        case DMDO_270:        sDevMode.dmDisplayOrientation = DMDO_270; break;
-        default: return 0;
-    }
-
-    if(DISP_CHANGE_BADMODE != ChangeDisplaySettingsEx(NULL, &sDevMode, 0, CDS_RESET, NULL))
-        return 1;
-
-    SDL_SetError("WINCE_SetDMOrientation: ChangeDisplaySettingsEx return BADMODE");
-    return -1;
-}
-
-void FrameBufferDumpInfo(const FrameBufferInfo* fb, const char* name)
-{
-    int orientation;
-
-    printf("%s fb.width:       %d\n", name, fb->width);
-    printf("%s fb.height:      %d\n", name, fb->height);
-    printf("%s fb.xpitch:      %d\n", name, fb->xpitch);
-    printf("%s fb.ypitch:      %d\n", name, fb->ypitch);
-    printf("%s fb.offset:      %d\n", name, fb->offset);
-
-    orientation = GetFrameBufferOrientation(fb);
-    printf("%s fb.orientation: %d, %s\n", name, orientation, GetOrientationName(orientation));
-}
-
-void UpdateLine16to16(const FrameBufferInfo* fb, const Uint16* src, Uint16* dst, Uint16 width)
-{
-    if(2 == fb->xpitch)
-    {
-        switch(width)
-        {
-            case 1:
-                *dst = *src;
-                break;
-
-            case 2:
-                *((Uint32*) dst) = *((Uint32*) src);
-                break;
-
-            default:
-                SDL_memcpy(dst, src, width * 2);
-                break;
-        }
-    }
-    else
-    if(-2 == fb->xpitch)
-    {
-        while(width--)
-            *dst-- = *src++;
-    }
-    else
-    {
-        while(width--)
-        {
-            *dst = *src++;
-            dst += fb->xpitch / 2;
-        }
-    }
-}
-
-#endif // SDL_VIDEO_RENDER_GAPI
--- a/src/video/windows/SDL_gapirender.h	Mon Jan 31 22:44:43 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +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
-    
-    Stefan Klug
-    klug.stefan@gmx.de
-*/
-#include "SDL_config.h"
-
-/* SDL surface based renderer implementation */
-
-#if SDL_VIDEO_RENDER_GAPI
-extern void WINCE_AddRenderDriver(_THIS);
-extern int  WINCE_Available(void);
-extern void WINCE_ShowWindow(_THIS, SDL_Window* window, int visible);
-extern int  WINCE_GetDMOrientation(void);
-extern int  WINCE_SetDMOrientation(int orientation);
-#endif
-
-/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/windows/SDL_gapirender_c.h	Mon Jan 31 22:44:43 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +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
-    
-    Stefan Klug
-    klug.stefan@gmx.de
-*/
--- a/src/video/windows/SDL_windowsevents.c	Mon Jan 31 22:44:43 2011 -0800
+++ b/src/video/windows/SDL_windowsevents.c	Mon Jan 31 22:53:45 2011 -0800
@@ -195,14 +195,12 @@
         /* transform coords for VGA, WVGA... */
         {
             SDL_VideoData *videodata = data->videodata;
-            if(videodata->CoordTransform &&
-                (videodata->render == RENDER_GAPI || videodata->render == RENDER_RAW))
-            {
+            if(videodata->CoordTransform) {
                 POINT pt;
                 pt.x = LOWORD(lParam);
                 pt.y = HIWORD(lParam);
                 videodata->CoordTransform(data->window, &pt);
-                    SDL_SendMouseMotion(data->window, 0, pt.x, pt.y);
+                SDL_SendMouseMotion(data->window, 0, pt.x, pt.y);
                 break;
             }
         }
--- a/src/video/windows/SDL_windowsvideo.c	Mon Jan 31 22:44:43 2011 -0800
+++ b/src/video/windows/SDL_windowsvideo.c	Mon Jan 31 22:53:45 2011 -0800
@@ -30,7 +30,6 @@
 #include "SDL_windowsvideo.h"
 #include "SDL_windowsshape.h"
 #include "SDL_d3drender.h"
-#include "SDL_gapirender.h"
 
 /* Initialization/Query functions */
 static int WIN_VideoInit(_THIS);
@@ -57,12 +56,6 @@
         SDL_UnloadObject(data->d3dDLL);
     }
 #endif
-#if SDL_VIDEO_RENDER_DDRAW
-    if (data->ddraw) {
-        data->ddraw->lpVtbl->Release(data->ddraw);
-        SDL_UnloadObject(data->ddrawDLL);
-    }
-#endif
 #ifdef _WIN32_WCE
     if(data->hAygShell) {
        SDL_UnloadObject(data->hAygShell);
@@ -100,42 +93,6 @@
     }
     device->driverdata = data;
 
-#if SDL_VIDEO_RENDER_D3D
-    data->d3dDLL = SDL_LoadObject("D3D9.DLL");
-    if (data->d3dDLL) {
-        IDirect3D9 *(WINAPI * D3DCreate) (UINT SDKVersion);
-
-        D3DCreate =
-            (IDirect3D9 * (WINAPI *) (UINT)) SDL_LoadFunction(data->d3dDLL,
-                                                            "Direct3DCreate9");
-        if (D3DCreate) {
-            data->d3d = D3DCreate(D3D_SDK_VERSION);
-        }
-        if (!data->d3d) {
-            SDL_UnloadObject(data->d3dDLL);
-            data->d3dDLL = NULL;
-        }
-    }
-#endif /* SDL_VIDEO_RENDER_D3D */
-#if SDL_VIDEO_RENDER_DDRAW
-    data->ddrawDLL = SDL_LoadObject("ddraw.dll");
-    if (data->ddrawDLL) {
-        IDirectDraw *(WINAPI * DDCreate) (GUID FAR * lpGUID,
-                                          LPDIRECTDRAW FAR * lplpDD,
-                                          IUnknown FAR * pUnkOuter);
-
-        DDCreate =
-            (IDirectDraw *
-             (WINAPI *) (GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *))
-            SDL_LoadFunction(data->ddrawDLL, "DirectDrawCreate");
-        if (!DDCreate || DDCreate(NULL, &data->ddraw, NULL) != DD_OK) {
-            SDL_UnloadObject(data->ddrawDLL);
-            data->ddrawDLL = NULL;
-            data->ddraw = NULL;
-        }
-    }
-#endif /* SDL_VIDEO_RENDER_DDRAW */
-
 #ifdef _WIN32_WCE
     data->hAygShell = SDL_LoadObject("\\windows\\aygshell.dll");
     if(0 == data->hAygShell)
@@ -221,12 +178,6 @@
 #if SDL_VIDEO_RENDER_D3D
     D3D_AddRenderDriver(_this);
 #endif
-#if SDL_VIDEO_RENDER_DDRAW
-    DDRAW_AddRenderDriver(_this);
-#endif
-#if SDL_VIDEO_RENDER_GAPI
-    WINCE_AddRenderDriver(_this);
-#endif
 
     WIN_InitKeyboard(_this);
     WIN_InitMouse(_this);
--- a/src/video/windows/SDL_windowsvideo.h	Mon Jan 31 22:44:43 2011 -0800
+++ b/src/video/windows/SDL_windowsvideo.h	Mon Jan 31 22:53:45 2011 -0800
@@ -45,12 +45,6 @@
 #include "d3d9.h"
 #endif
 
-#if SDL_VIDEO_RENDER_DDRAW
-/* WIN32_LEAN_AND_MEAN was defined, so we have to include this by hand */
-#include <objbase.h>
-#include "ddraw.h"
-#endif
-
 #include "SDL_windowsclipboard.h"
 #include "SDL_windowsevents.h"
 #include "SDL_windowsgamma.h"
@@ -63,7 +57,7 @@
 #include "SDL_loadso.h"
 
 
-enum { RENDER_NONE, RENDER_D3D, RENDER_DDRAW, RENDER_GDI, RENDER_GAPI, RENDER_RAW };
+enum { RENDER_NONE, RENDER_D3D };
 
 #if WINVER < 0x0601
 /* Touch input definitions */
@@ -135,10 +129,6 @@
     void* d3dDLL;
     IDirect3D9 *d3d;
 #endif
-#if SDL_VIDEO_RENDER_DDRAW
-    void* ddrawDLL;
-    IDirectDraw *ddraw;
-#endif
 #ifdef _WIN32_WCE
     void* hAygShell;
     PFNSHFullScreen SHFullScreen;
--- a/src/video/windows/SDL_windowswindow.c	Mon Jan 31 22:44:43 2011 -0800
+++ b/src/video/windows/SDL_windowswindow.c	Mon Jan 31 22:53:45 2011 -0800
@@ -30,7 +30,6 @@
 
 /* This is included after SDL_windowsvideo.h, which includes windows.h */
 #include "SDL_syswm.h"
-#include "SDL_gapirender.h"
 
 /* Windows CE compatibility */
 #ifndef SWP_NOCOPYBITS