Removed the obsolete SDL 1.2 GAPI driver
authorSam Lantinga <slouken@libsdl.org>
Wed, 06 Jan 2010 07:39:09 +0000
changeset 3613dcc88e97091d
parent 3612 ce7d4942d18b
child 3614 701f54683b24
Removed the obsolete SDL 1.2 GAPI driver
configure.in
src/video/gapi/SDL_gapivideo.c
src/video/gapi/SDL_gapivideo.h
     1.1 --- a/configure.in	Wed Jan 06 07:37:15 2010 +0000
     1.2 +++ b/configure.in	Wed Jan 06 07:39:09 2010 +0000
     1.3 @@ -2356,8 +2356,6 @@
     1.4          CheckDiskAudio
     1.5          CheckDummyAudio
     1.6          CheckWIN32
     1.7 -        #SOURCES="$SOURCES $srcdir/src/video/gapi/*.c"
     1.8 -        #AC_DEFINE(SDL_VIDEO_DRIVER_GAPI)
     1.9          if test x$enable_video = xyes; then
    1.10              AC_DEFINE(SDL_VIDEO_DRIVER_WIN32)
    1.11              SOURCES="$SOURCES $srcdir/src/video/win32/*.c"
     2.1 --- a/src/video/gapi/SDL_gapivideo.c	Wed Jan 06 07:37:15 2010 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,1265 +0,0 @@
     2.4 -/*
     2.5 -    SDL - Simple DirectMedia Layer
     2.6 -    Copyright (C) 1997-2009 Sam Lantinga
     2.7 -
     2.8 -    This library is free software; you can redistribute it and/or
     2.9 -    modify it under the terms of the GNU Lesser General Public
    2.10 -    License as published by the Free Software Foundation; either
    2.11 -    version 2.1 of the License, or (at your option) any later version.
    2.12 -
    2.13 -    This library is distributed in the hope that it will be useful,
    2.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    2.16 -    Lesser General Public License for more details.
    2.17 -
    2.18 -    You should have received a copy of the GNU Lesser General Public
    2.19 -    License along with this library; if not, write to the Free Software
    2.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    2.21 -
    2.22 -    Sam Lantinga
    2.23 -    slouken@libsdl.org
    2.24 -*/
    2.25 -#include "SDL_config.h"
    2.26 -
    2.27 -/* Pocket PC GAPI SDL video driver implementation;
    2.28 -Implemented by Dmitry Yakimov - support@activekitten.com
    2.29 -Inspired by http://arisme.free.fr/ports/SDL.php
    2.30 -*/
    2.31 -
    2.32 -// TODO: copy surface on window when lost focus
    2.33 -// TODO: test buttons rotation
    2.34 -// TODO: test on be300 and HPC ( check WinDib fullscreen keys catching )
    2.35 -// TODO: test on smartphones
    2.36 -// TODO: windib on SH3 PPC2000 landscape test
    2.37 -// TODO: optimize 8bpp landscape mode
    2.38 -
    2.39 -// there is some problems in runnings apps from a device landscape mode
    2.40 -// due to WinCE bugs. Some works and some - does not.
    2.41 -// TODO: finish Axim Dell X30 and user landscape mode, device landscape mode
    2.42 -// TODO: finish Axim Dell X30 user portrait, device landscape stylus conversion
    2.43 -// TODO: fix running GAPI apps from landscape mode - 
    2.44 -//       wince goes to portrait mode, but does not update video memory
    2.45 -
    2.46 -
    2.47 -#include "SDL_error.h"
    2.48 -#include "SDL_video.h"
    2.49 -#include "SDL_mouse.h"
    2.50 -#include "../SDL_sysvideo.h"
    2.51 -#include "../SDL_pixels_c.h"
    2.52 -#include "../../events/SDL_events_c.h"
    2.53 -#include "../wincommon/SDL_syswm_c.h"
    2.54 -#include "../wincommon/SDL_sysmouse_c.h"
    2.55 -#include "../windib/SDL_dibevents_c.h"
    2.56 -
    2.57 -#include "SDL_gapivideo.h"
    2.58 -
    2.59 -#define GAPIVID_DRIVER_NAME "gapi"
    2.60 -
    2.61 -#if defined(DEBUG) || defined (_DEBUG) || defined(NDEBUG)
    2.62 -#define REPORT_VIDEO_INFO 1
    2.63 -#else
    2.64 -#define REPORT_VIDEO_INFO 0
    2.65 -#endif
    2.66 -
    2.67 -// for testing with GapiEmu
    2.68 -#define USE_GAPI_EMU 0
    2.69 -#define EMULATE_AXIM_X30 0
    2.70 -#define WITHOUT_GAPI 0
    2.71 -
    2.72 -#if USE_GAPI_EMU && !REPORT_VIDEO_INFO
    2.73 -#pragma message("Warning: Using GapiEmu in release build. I assume you'd like to set USE_GAPI_EMU to zero.")
    2.74 -#endif
    2.75 -
    2.76 -// defined and used in SDL_sysevents.c
    2.77 -extern HINSTANCE aygshell;
    2.78 -extern void SDL_UnregisterApp();
    2.79 -extern int DIB_AddMode(_THIS, int bpp, int w, int h);
    2.80 -
    2.81 -/* Initialization/Query functions */
    2.82 -static int GAPI_VideoInit(_THIS, SDL_PixelFormat * vformat);
    2.83 -static SDL_Rect **GAPI_ListModes(_THIS, SDL_PixelFormat * format,
    2.84 -                                 Uint32 flags);
    2.85 -static SDL_Surface *GAPI_SetVideoMode(_THIS, SDL_Surface * current,
    2.86 -                                      int width, int height, int bpp,
    2.87 -                                      Uint32 flags);
    2.88 -static int GAPI_SetColors(_THIS, int firstcolor, int ncolors,
    2.89 -                          SDL_Color * colors);
    2.90 -static void GAPI_VideoQuit(_THIS);
    2.91 -
    2.92 -/* Hardware surface functions */
    2.93 -static int GAPI_AllocHWSurface(_THIS, SDL_Surface * surface);
    2.94 -static int GAPI_LockHWSurface(_THIS, SDL_Surface * surface);
    2.95 -static void GAPI_UnlockHWSurface(_THIS, SDL_Surface * surface);
    2.96 -static void GAPI_FreeHWSurface(_THIS, SDL_Surface * surface);
    2.97 -
    2.98 -/* Windows message handling functions, will not be processed */
    2.99 -static void GAPI_RealizePalette(_THIS);
   2.100 -static void GAPI_PaletteChanged(_THIS, HWND window);
   2.101 -static void GAPI_WinPAINT(_THIS, HDC hdc);
   2.102 -
   2.103 -/* etc. */
   2.104 -static void GAPI_UpdateRects(_THIS, int numrects, SDL_Rect * rects);
   2.105 -
   2.106 -static HMODULE g_hGapiLib = 0;
   2.107 -#define LINK(type,name,import) \
   2.108 -	if( g_hGapiLib ) \
   2.109 -		name = (PFN##type)GetProcAddress( g_hGapiLib, _T(import) );
   2.110 -
   2.111 -static char g_bRawBufferAvailable = 0;
   2.112 -
   2.113 -/* GAPI driver bootstrap functions */
   2.114 -
   2.115 -/* hi res definitions */
   2.116 -typedef struct _RawFrameBufferInfo
   2.117 -{
   2.118 -    WORD wFormat;
   2.119 -    WORD wBPP;
   2.120 -    VOID *pFramePointer;
   2.121 -    int cxStride;
   2.122 -    int cyStride;
   2.123 -    int cxPixels;
   2.124 -    int cyPixels;
   2.125 -} RawFrameBufferInfo;
   2.126 -
   2.127 -static struct _RawFrameBufferInfo g_RawFrameBufferInfo = { 0 };
   2.128 -
   2.129 -#define GETRAWFRAMEBUFFER   0x00020001
   2.130 -
   2.131 -#define FORMAT_565 1
   2.132 -#define FORMAT_555 2
   2.133 -#define FORMAT_OTHER 3
   2.134 -
   2.135 -/* Dell Axim x30 hangs when we use GAPI from landscape,
   2.136 -   so lets avoid using GxOpenDisplay there via GETGXINFO trick 
   2.137 -   It seems that GAPI subsystem use the same ExtEscape code.
   2.138 -*/
   2.139 -#define GETGXINFO 0x00020000
   2.140 -
   2.141 -typedef struct GXDeviceInfo
   2.142 -{
   2.143 -    long Version;               //00 (should filled with 100 before calling ExtEscape)
   2.144 -    void *pvFrameBuffer;        //04
   2.145 -    unsigned long cbStride;     //08
   2.146 -    unsigned long cxWidth;      //0c
   2.147 -    unsigned long cyHeight;     //10
   2.148 -    unsigned long cBPP;         //14
   2.149 -    unsigned long ffFormat;     //18
   2.150 -    char Unused[0x84 - 7 * 4];
   2.151 -} GXDeviceInfo;
   2.152 -
   2.153 -static int
   2.154 -GAPI_Available(void)
   2.155 -{
   2.156 -    // try to use VGA display, even on emulator
   2.157 -    HDC hdc = GetDC(NULL);
   2.158 -    int result = ExtEscape(hdc, GETRAWFRAMEBUFFER, 0, NULL,
   2.159 -                           sizeof(RawFrameBufferInfo),
   2.160 -                           (char *) &g_RawFrameBufferInfo);
   2.161 -    ReleaseDC(NULL, hdc);
   2.162 -    g_bRawBufferAvailable = result > 0;
   2.163 -
   2.164 -#if WITHOUT_GAPI
   2.165 -    return g_bRawBufferAvailable;
   2.166 -#endif
   2.167 -
   2.168 -#if USE_GAPI_EMU
   2.169 -    g_hGapiLib = LoadLibrary(_T("GAPI_Emu.dll"));
   2.170 -    if (!g_hGapiLib) {
   2.171 -        SDL_SetError("Gapi Emu not found!");
   2.172 -    }
   2.173 -    return g_hGapiLib != 0;
   2.174 -#endif
   2.175 -
   2.176 -    // try to find gx.dll
   2.177 -    g_hGapiLib = LoadLibrary(_T("\\Windows\\gx.dll"));
   2.178 -    if (!g_hGapiLib) {
   2.179 -        g_hGapiLib = LoadLibrary(_T("gx.dll"));
   2.180 -        if (!g_hGapiLib)
   2.181 -            return g_bRawBufferAvailable;
   2.182 -    }
   2.183 -
   2.184 -    return (1);
   2.185 -}
   2.186 -
   2.187 -static int
   2.188 -cmpmodes(const void *va, const void *vb)
   2.189 -{
   2.190 -    SDL_Rect *a = *(SDL_Rect **) va;
   2.191 -    SDL_Rect *b = *(SDL_Rect **) vb;
   2.192 -    if (a->w == b->w)
   2.193 -        return b->h - a->h;
   2.194 -    else
   2.195 -        return b->w - a->w;
   2.196 -}
   2.197 -
   2.198 -static int
   2.199 -GAPI_AddMode(_THIS, int bpp, int w, int h)
   2.200 -{
   2.201 -    SDL_Rect *mode;
   2.202 -    int i, index;
   2.203 -    int next_mode;
   2.204 -
   2.205 -    /* Check to see if we already have this mode */
   2.206 -    if (bpp < 8) {              /* Not supported */
   2.207 -        return (0);
   2.208 -    }
   2.209 -    index = ((bpp + 7) / 8) - 1;
   2.210 -    for (i = 0; i < gapi->SDL_nummodes[index]; ++i) {
   2.211 -        mode = gapi->SDL_modelist[index][i];
   2.212 -        if ((mode->w == w) && (mode->h == h)) {
   2.213 -            return (0);
   2.214 -        }
   2.215 -    }
   2.216 -
   2.217 -    /* Set up the new video mode rectangle */
   2.218 -    mode = (SDL_Rect *) SDL_malloc(sizeof *mode);
   2.219 -    if (mode == NULL) {
   2.220 -        SDL_OutOfMemory();
   2.221 -        return (-1);
   2.222 -    }
   2.223 -    mode->x = 0;
   2.224 -    mode->y = 0;
   2.225 -    mode->w = w;
   2.226 -    mode->h = h;
   2.227 -
   2.228 -    /* Allocate the new list of modes, and fill in the new mode */
   2.229 -    next_mode = gapi->SDL_nummodes[index];
   2.230 -    gapi->SDL_modelist[index] = (SDL_Rect **)
   2.231 -        SDL_realloc(gapi->SDL_modelist[index],
   2.232 -                    (1 + next_mode + 1) * sizeof(SDL_Rect *));
   2.233 -    if (gapi->SDL_modelist[index] == NULL) {
   2.234 -        SDL_OutOfMemory();
   2.235 -        gapi->SDL_nummodes[index] = 0;
   2.236 -        SDL_free(mode);
   2.237 -        return (-1);
   2.238 -    }
   2.239 -    gapi->SDL_modelist[index][next_mode] = mode;
   2.240 -    gapi->SDL_modelist[index][next_mode + 1] = NULL;
   2.241 -    gapi->SDL_nummodes[index]++;
   2.242 -
   2.243 -    return (0);
   2.244 -}
   2.245 -
   2.246 -static void
   2.247 -GAPI_DeleteDevice(SDL_VideoDevice * device)
   2.248 -{
   2.249 -    if (g_hGapiLib) {
   2.250 -        FreeLibrary(g_hGapiLib);
   2.251 -        g_hGapiLib = 0;
   2.252 -    }
   2.253 -    SDL_free(device->hidden);
   2.254 -    SDL_free(device);
   2.255 -}
   2.256 -
   2.257 -static SDL_VideoDevice *
   2.258 -GAPI_CreateDevice(int devindex)
   2.259 -{
   2.260 -    SDL_VideoDevice *device;
   2.261 -
   2.262 -    if (!g_hGapiLib && !g_bRawBufferAvailable) {
   2.263 -        if (!GAPI_Available()) {
   2.264 -            SDL_SetError
   2.265 -                ("GAPI dll is not found and VGA mode is not available!");
   2.266 -            return 0;
   2.267 -        }
   2.268 -    }
   2.269 -
   2.270 -    /* Initialize all variables that we clean on shutdown */
   2.271 -    device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
   2.272 -    if (device) {
   2.273 -        SDL_memset(device, 0, (sizeof *device));
   2.274 -        device->hidden = (struct SDL_PrivateVideoData *)
   2.275 -            SDL_malloc((sizeof *device->hidden));
   2.276 -    }
   2.277 -    if ((device == NULL) || (device->hidden == NULL)) {
   2.278 -        SDL_OutOfMemory();
   2.279 -        if (device) {
   2.280 -            SDL_free(device);
   2.281 -        }
   2.282 -        return (0);
   2.283 -    }
   2.284 -    SDL_memset(device->hidden, 0, (sizeof *device->hidden));
   2.285 -
   2.286 -    /* Set the function pointers */
   2.287 -    device->VideoInit = GAPI_VideoInit;
   2.288 -    device->ListModes = GAPI_ListModes;
   2.289 -    device->SetVideoMode = GAPI_SetVideoMode;
   2.290 -    device->UpdateMouse = WIN_UpdateMouse;
   2.291 -    device->CreateYUVOverlay = NULL;
   2.292 -    device->SetColors = GAPI_SetColors;
   2.293 -    device->UpdateRects = GAPI_UpdateRects;
   2.294 -    device->VideoQuit = GAPI_VideoQuit;
   2.295 -    device->AllocHWSurface = GAPI_AllocHWSurface;
   2.296 -    device->CheckHWBlit = NULL;
   2.297 -    device->FillHWRect = NULL;
   2.298 -    device->SetHWColorKey = NULL;
   2.299 -    device->SetHWAlpha = NULL;
   2.300 -    device->LockHWSurface = GAPI_LockHWSurface;
   2.301 -    device->UnlockHWSurface = GAPI_UnlockHWSurface;
   2.302 -    device->FlipHWSurface = NULL;
   2.303 -    device->FreeHWSurface = GAPI_FreeHWSurface;
   2.304 -    device->SetCaption = WIN_SetWMCaption;
   2.305 -    device->SetIcon = WIN_SetWMIcon;
   2.306 -    device->IconifyWindow = WIN_IconifyWindow;
   2.307 -    device->GrabInput = WIN_GrabInput;
   2.308 -    device->GetWMInfo = WIN_GetWMInfo;
   2.309 -    device->FreeWMCursor = WIN_FreeWMCursor;
   2.310 -    device->CreateWMCursor = WIN_CreateWMCursor;
   2.311 -    device->ShowWMCursor = WIN_ShowWMCursor;
   2.312 -    device->WarpWMCursor = WIN_WarpWMCursor;
   2.313 -    device->CheckMouseMode = WIN_CheckMouseMode;
   2.314 -    device->InitOSKeymap = DIB_InitOSKeymap;
   2.315 -    device->PumpEvents = DIB_PumpEvents;
   2.316 -
   2.317 -    /* Set up the windows message handling functions */
   2.318 -    WIN_RealizePalette = GAPI_RealizePalette;
   2.319 -    WIN_PaletteChanged = GAPI_PaletteChanged;
   2.320 -    WIN_WinPAINT = GAPI_WinPAINT;
   2.321 -    HandleMessage = DIB_HandleMessage;
   2.322 -
   2.323 -    device->free = GAPI_DeleteDevice;
   2.324 -
   2.325 -    /* Load gapi library */
   2.326 -#define gx device->hidden->gxFunc
   2.327 -
   2.328 -    LINK(GXOpenDisplay, gx.GXOpenDisplay,
   2.329 -         "?GXOpenDisplay@@YAHPAUHWND__@@K@Z") LINK(GXCloseDisplay,
   2.330 -                                                   gx.GXCloseDisplay,
   2.331 -                                                   "?GXCloseDisplay@@YAHXZ")
   2.332 -        LINK(GXBeginDraw, gx.GXBeginDraw,
   2.333 -             "?GXBeginDraw@@YAPAXXZ") LINK(GXEndDraw, gx.GXEndDraw,
   2.334 -                                           "?GXEndDraw@@YAHXZ")
   2.335 -        LINK(GXOpenInput, gx.GXOpenInput,
   2.336 -             "?GXOpenInput@@YAHXZ") LINK(GXCloseInput, gx.GXCloseInput,
   2.337 -                                         "?GXCloseInput@@YAHXZ")
   2.338 -        LINK(GXGetDisplayProperties, gx.GXGetDisplayProperties,
   2.339 -             "?GXGetDisplayProperties@@YA?AUGXDisplayProperties@@XZ")
   2.340 -        LINK(GXGetDefaultKeys, gx.GXGetDefaultKeys,
   2.341 -             "?GXGetDefaultKeys@@YA?AUGXKeyList@@H@Z") LINK(GXSuspend,
   2.342 -                                                            gx.GXSuspend,
   2.343 -                                                            "?GXSuspend@@YAHXZ")
   2.344 -        LINK(GXResume, gx.GXResume, "?GXResume@@YAHXZ") LINK(GXSetViewport,
   2.345 -                                                             gx.GXSetViewport,
   2.346 -                                                             "?GXSetViewport@@YAHKKKK@Z")
   2.347 -        LINK(GXIsDisplayDRAMBuffer, gx.GXIsDisplayDRAMBuffer,
   2.348 -             "?GXIsDisplayDRAMBuffer@@YAHXZ")
   2.349 -        /* wrong gapi.dll */
   2.350 -        if (!gx.GXOpenDisplay) {
   2.351 -        if (g_hGapiLib) {
   2.352 -            FreeLibrary(g_hGapiLib);
   2.353 -            g_hGapiLib = 0;
   2.354 -        }
   2.355 -    }
   2.356 -
   2.357 -    if (!gx.GXOpenDisplay && !g_bRawBufferAvailable) {
   2.358 -        SDL_SetError("Error: damaged or unknown gapi.dll!\n");
   2.359 -        GAPI_DeleteDevice(device);
   2.360 -        return 0;
   2.361 -    }
   2.362 -
   2.363 -    return device;
   2.364 -}
   2.365 -
   2.366 -VideoBootStrap GAPI_bootstrap = {
   2.367 -    GAPIVID_DRIVER_NAME, "WinCE GAPI video driver",
   2.368 -    GAPI_Available, GAPI_CreateDevice
   2.369 -};
   2.370 -
   2.371 -static void
   2.372 -FillStructs(_THIS, BOOL useVga)
   2.373 -{
   2.374 -#ifdef _ARM_
   2.375 -    WCHAR oemstr[100];
   2.376 -#endif
   2.377 -    /* fill a device properties */
   2.378 -
   2.379 -    if (!useVga) {
   2.380 -        this->hidden->gxProperties =
   2.381 -            this->hidden->gxFunc.GXGetDisplayProperties();
   2.382 -        this->hidden->needUpdate = 1;
   2.383 -        this->hidden->hiresFix = 0;
   2.384 -        this->hidden->useVga = 0;
   2.385 -        this->hidden->useGXOpenDisplay = 1;
   2.386 -
   2.387 -#ifdef _ARM_
   2.388 -        /* check some devices and extract addition info */
   2.389 -        SystemParametersInfo(SPI_GETOEMINFO, sizeof(oemstr), oemstr, 0);
   2.390 -
   2.391 -        // buggy iPaq38xx
   2.392 -        if ((oemstr[12] == 'H') && (oemstr[13] == '3')
   2.393 -            && (oemstr[14] == '8')
   2.394 -            && (this->hidden->gxProperties.cbxPitch > 0)) {
   2.395 -            this->hidden->videoMem = (PIXEL *) 0xac0755a0;
   2.396 -            this->hidden->gxProperties.cbxPitch = -640;
   2.397 -            this->hidden->gxProperties.cbyPitch = 2;
   2.398 -            this->hidden->needUpdate = 0;
   2.399 -        }
   2.400 -#if (EMULATE_AXIM_X30 == 0)
   2.401 -        // buggy Dell Axim X30
   2.402 -        if (_tcsncmp(oemstr, L"Dell Axim X30", 13) == 0)
   2.403 -#endif
   2.404 -        {
   2.405 -            GXDeviceInfo gxInfo = { 0 };
   2.406 -            HDC hdc = GetDC(NULL);
   2.407 -            int result;
   2.408 -
   2.409 -            gxInfo.Version = 100;
   2.410 -            result =
   2.411 -                ExtEscape(hdc, GETGXINFO, 0, NULL, sizeof(gxInfo),
   2.412 -                          (char *) &gxInfo);
   2.413 -            if (result > 0) {
   2.414 -                this->hidden->useGXOpenDisplay = 0;
   2.415 -                this->hidden->videoMem = gxInfo.pvFrameBuffer;
   2.416 -                this->hidden->needUpdate = 0;
   2.417 -                this->hidden->gxProperties.cbxPitch = 2;
   2.418 -                this->hidden->gxProperties.cbyPitch = 480;
   2.419 -                this->hidden->gxProperties.cxWidth = gxInfo.cxWidth;
   2.420 -                this->hidden->gxProperties.cyHeight = gxInfo.cyHeight;
   2.421 -                this->hidden->gxProperties.ffFormat = gxInfo.ffFormat;
   2.422 -            }
   2.423 -        }
   2.424 -#endif
   2.425 -    } else {
   2.426 -        this->hidden->needUpdate = 0;
   2.427 -        this->hidden->hiresFix = 0;
   2.428 -        this->hidden->gxProperties.cBPP = g_RawFrameBufferInfo.wBPP;
   2.429 -        this->hidden->gxProperties.cbxPitch = g_RawFrameBufferInfo.cxStride;
   2.430 -        this->hidden->gxProperties.cbyPitch = g_RawFrameBufferInfo.cyStride;
   2.431 -        this->hidden->gxProperties.cxWidth = g_RawFrameBufferInfo.cxPixels;
   2.432 -        this->hidden->gxProperties.cyHeight = g_RawFrameBufferInfo.cyPixels;
   2.433 -        this->hidden->videoMem = g_RawFrameBufferInfo.pFramePointer;
   2.434 -        this->hidden->useVga = 1;
   2.435 -
   2.436 -        switch (g_RawFrameBufferInfo.wFormat) {
   2.437 -        case FORMAT_565:
   2.438 -            this->hidden->gxProperties.ffFormat = kfDirect565;
   2.439 -            break;
   2.440 -        case FORMAT_555:
   2.441 -            this->hidden->gxProperties.ffFormat = kfDirect555;
   2.442 -            break;
   2.443 -        default:
   2.444 -            /* unknown pixel format, try define by BPP! */
   2.445 -            switch (g_RawFrameBufferInfo.wBPP) {
   2.446 -            case 4:
   2.447 -            case 8:
   2.448 -                this->hidden->gxProperties.ffFormat = kfDirect;
   2.449 -            case 16:
   2.450 -                this->hidden->gxProperties.ffFormat = kfDirect565;
   2.451 -            default:
   2.452 -                this->hidden->gxProperties.ffFormat = kfDirect;
   2.453 -                break;
   2.454 -            }
   2.455 -        }
   2.456 -    }
   2.457 -
   2.458 -    if (this->hidden->gxProperties.cBPP != 16) {
   2.459 -        this->hidden->gapiOrientation = SDL_ORIENTATION_UP;
   2.460 -    } else if ((this->hidden->gxProperties.cbxPitch > 0)
   2.461 -               && (this->hidden->gxProperties.cbyPitch > 0)) {
   2.462 -        this->hidden->gapiOrientation = SDL_ORIENTATION_UP;
   2.463 -    } else if ((this->hidden->gxProperties.cbxPitch > 0)
   2.464 -               && (this->hidden->gxProperties.cbyPitch < 0)) {
   2.465 -        this->hidden->gapiOrientation = SDL_ORIENTATION_RIGHT;  // ipaq 3660
   2.466 -    } else if ((this->hidden->gxProperties.cbxPitch < 0)
   2.467 -               && (this->hidden->gxProperties.cbyPitch > 0)) {
   2.468 -        this->hidden->gapiOrientation = SDL_ORIENTATION_LEFT;   // ipaq 3800
   2.469 -    }
   2.470 -}
   2.471 -
   2.472 -static void
   2.473 -GAPI_CreatePalette(int ncolors, SDL_Color * colors)
   2.474 -{
   2.475 -    // Setup a custom color palette
   2.476 -    BYTE buffer[sizeof(LOGPALETTE) + 255 * sizeof(PALETTEENTRY)];
   2.477 -    int i;
   2.478 -    LOGPALETTE *pLogical = (LOGPALETTE *) buffer;
   2.479 -    PALETTEENTRY *entries = pLogical->palPalEntry;
   2.480 -    HPALETTE hPalette;
   2.481 -    HDC hdc;
   2.482 -
   2.483 -    for (i = 0; i < ncolors; ++i) {
   2.484 -        // Find intensity by replicating the bit patterns over a byte
   2.485 -        entries[i].peRed = colors[i].r;
   2.486 -        entries[i].peGreen = colors[i].g;
   2.487 -        entries[i].peBlue = colors[i].b;
   2.488 -        entries[i].peFlags = 0;
   2.489 -    }
   2.490 -
   2.491 -    // Create the GDI palette object
   2.492 -    pLogical->palVersion = 0x0300;
   2.493 -    pLogical->palNumEntries = ncolors;
   2.494 -
   2.495 -    hPalette = CreatePalette(pLogical);
   2.496 -    ASSERT(hPalette);
   2.497 -
   2.498 -
   2.499 -    // Realize the palette
   2.500 -    hdc = GetDC(0);
   2.501 -
   2.502 -    SelectPalette(hdc, hPalette, FALSE);
   2.503 -    RealizePalette(hdc);
   2.504 -
   2.505 -    ReleaseDC(0, hdc);
   2.506 -    DeleteObject(hPalette);
   2.507 -}
   2.508 -
   2.509 -int
   2.510 -GAPI_VideoInit(_THIS, SDL_PixelFormat * vformat)
   2.511 -{
   2.512 -    int i, bpp;
   2.513 -
   2.514 -    /* Create the window */
   2.515 -    if (DIB_CreateWindow(this) < 0) {
   2.516 -        return (-1);
   2.517 -    }
   2.518 -
   2.519 -    if (g_hGapiLib) {
   2.520 -        FillStructs(this, 0);
   2.521 -
   2.522 -        // SDL does not supports 2/4bpp mode, so use 16 bpp
   2.523 -        bpp = gapi->gxProperties.cBPP < 8 ? 16 : gapi->gxProperties.cBPP;
   2.524 -
   2.525 -        /* set up normal and landscape mode */
   2.526 -        GAPI_AddMode(this, bpp, gapi->gxProperties.cyHeight,
   2.527 -                     gapi->gxProperties.cxWidth);
   2.528 -        GAPI_AddMode(this, bpp, gapi->gxProperties.cxWidth,
   2.529 -                     gapi->gxProperties.cyHeight);
   2.530 -    }
   2.531 -
   2.532 -    /* add hi-res mode */
   2.533 -    if (g_bRawBufferAvailable &&
   2.534 -        !((gapi->gxProperties.cxWidth ==
   2.535 -           (unsigned) g_RawFrameBufferInfo.cxPixels)
   2.536 -          && (gapi->gxProperties.cyHeight ==
   2.537 -              (unsigned) g_RawFrameBufferInfo.cyPixels))) {
   2.538 -        FillStructs(this, 1);
   2.539 -
   2.540 -        // SDL does not supports 2/4bpp mode, so use 16 bpp
   2.541 -        bpp = gapi->gxProperties.cBPP < 8 ? 16 : gapi->gxProperties.cBPP;
   2.542 -
   2.543 -        /* set up normal and landscape mode */
   2.544 -        GAPI_AddMode(this, bpp, gapi->gxProperties.cyHeight,
   2.545 -                     gapi->gxProperties.cxWidth);
   2.546 -        GAPI_AddMode(this, bpp, gapi->gxProperties.cxWidth,
   2.547 -                     gapi->gxProperties.cyHeight);
   2.548 -    }
   2.549 -
   2.550 -    /* Determine the current screen size */
   2.551 -    this->info.current_w = gapi->gxProperties.cxWidth;
   2.552 -    this->info.current_h = gapi->gxProperties.cyHeight;
   2.553 -
   2.554 -    /* Sort the mode lists */
   2.555 -    for (i = 0; i < NUM_MODELISTS; ++i) {
   2.556 -        if (gapi->SDL_nummodes[i] > 0) {
   2.557 -            SDL_qsort(gapi->SDL_modelist[i], gapi->SDL_nummodes[i],
   2.558 -                      sizeof *gapi->SDL_modelist[i], cmpmodes);
   2.559 -        }
   2.560 -    }
   2.561 -
   2.562 -    vformat->BitsPerPixel =
   2.563 -        this->hidden->gxProperties.cBPP <
   2.564 -        8 ? 16 : (unsigned char) this->hidden->gxProperties.cBPP;
   2.565 -
   2.566 -    // Get color mask
   2.567 -    if (this->hidden->gxProperties.ffFormat & kfDirect565) {
   2.568 -        vformat->BitsPerPixel = 16;
   2.569 -        vformat->Rmask = 0x0000f800;
   2.570 -        vformat->Gmask = 0x000007e0;
   2.571 -        vformat->Bmask = 0x0000001f;
   2.572 -        this->hidden->videoMode = GAPI_DIRECT_565;
   2.573 -    } else if (this->hidden->gxProperties.ffFormat & kfDirect555) {
   2.574 -        vformat->BitsPerPixel = 16;
   2.575 -        vformat->Rmask = 0x00007c00;
   2.576 -        vformat->Gmask = 0x000003e0;
   2.577 -        vformat->Bmask = 0x0000001f;
   2.578 -        this->hidden->videoMode = GAPI_DIRECT_555;
   2.579 -    } else if ((this->hidden->gxProperties.ffFormat & kfDirect)
   2.580 -               && (this->hidden->gxProperties.cBPP < 8)) {
   2.581 -        // We'll perform the conversion
   2.582 -        vformat->BitsPerPixel = 16;
   2.583 -        vformat->Rmask = 0x0000f800;    // 16 bit 565
   2.584 -        vformat->Gmask = 0x000007e0;
   2.585 -        vformat->Bmask = 0x0000001f;
   2.586 -        if (this->hidden->gxProperties.ffFormat & kfDirectInverted)
   2.587 -            this->hidden->invert = (1 << this->hidden->gxProperties.cBPP) - 1;
   2.588 -        this->hidden->colorscale =
   2.589 -            this->hidden->gxProperties.cBPP <
   2.590 -            8 ? 8 - this->hidden->gxProperties.cBPP : 0;
   2.591 -        this->hidden->videoMode = GAPI_MONO;
   2.592 -    } else if (this->hidden->gxProperties.ffFormat & kfPalette) {
   2.593 -        this->hidden->videoMode = GAPI_PALETTE;
   2.594 -    }
   2.595 -
   2.596 -    /* We're done! */
   2.597 -    return (0);
   2.598 -}
   2.599 -
   2.600 -SDL_Rect **
   2.601 -GAPI_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags)
   2.602 -{
   2.603 -    return (this->hidden->SDL_modelist[((format->BitsPerPixel + 7) / 8) - 1]);
   2.604 -//       return (SDL_Rect **) -1;
   2.605 -}
   2.606 -
   2.607 -SDL_Surface *
   2.608 -GAPI_SetVideoMode(_THIS, SDL_Surface * current,
   2.609 -                  int width, int height, int bpp, Uint32 flags)
   2.610 -{
   2.611 -    SDL_Surface *video;
   2.612 -    Uint32 Rmask, Gmask, Bmask;
   2.613 -    DWORD style;
   2.614 -    SDL_Rect allScreen;
   2.615 -
   2.616 -    if (bpp < 4) {
   2.617 -        SDL_SetError("1 bpp and 2 bpp modes is not implemented yet!");
   2.618 -        return 0;
   2.619 -    }
   2.620 -
   2.621 -    /* Recalculate bitmasks if necessary */
   2.622 -    if (bpp == current->format->BitsPerPixel) {
   2.623 -        video = current;
   2.624 -    } else {
   2.625 -        switch (bpp) {
   2.626 -        case 8:
   2.627 -            Rmask = 0;
   2.628 -            Gmask = 0;
   2.629 -            Bmask = 0;
   2.630 -            break;
   2.631 -        case 15:
   2.632 -        case 16:
   2.633 -            /* Default is 565 unless the display is specifically 555 */
   2.634 -            if (this->hidden->gxProperties.ffFormat & kfDirect555) {
   2.635 -                Rmask = 0x00007c00;
   2.636 -                Gmask = 0x000003e0;
   2.637 -                Bmask = 0x0000001f;
   2.638 -            } else {
   2.639 -                Rmask = 0x0000f800;
   2.640 -                Gmask = 0x000007e0;
   2.641 -                Bmask = 0x0000001f;
   2.642 -            }
   2.643 -            break;
   2.644 -        case 24:
   2.645 -        case 32:
   2.646 -            Rmask = 0x00ff0000;
   2.647 -            Gmask = 0x0000ff00;
   2.648 -            Bmask = 0x000000ff;
   2.649 -            break;
   2.650 -        default:
   2.651 -            SDL_SetError("Unsupported Bits Per Pixel format requested");
   2.652 -            return NULL;
   2.653 -        }
   2.654 -        video = SDL_CreateRGBSurface(SDL_SWSURFACE,
   2.655 -                                     0, 0, bpp, Rmask, Gmask, Bmask, 0);
   2.656 -        if (video == NULL) {
   2.657 -            SDL_OutOfMemory();
   2.658 -            return (NULL);
   2.659 -        }
   2.660 -    }
   2.661 -
   2.662 -    gapi->userOrientation = SDL_ORIENTATION_UP;
   2.663 -    video->flags = SDL_FULLSCREEN;      /* Clear flags, GAPI supports fullscreen only */
   2.664 -
   2.665 -    /* GAPI or VGA? */
   2.666 -    if (g_hGapiLib) {
   2.667 -        FillStructs(this, 0);
   2.668 -        if ((((unsigned) width != gapi->gxProperties.cxWidth)
   2.669 -             || ((unsigned) height != gapi->gxProperties.cyHeight))
   2.670 -            && (((unsigned) width != gapi->gxProperties.cyHeight)
   2.671 -                || ((unsigned) height != gapi->gxProperties.cxWidth)))
   2.672 -            FillStructs(this, 1);       // gapi is found but we use VGA resolution                        
   2.673 -    } else
   2.674 -        FillStructs(this, 1);
   2.675 -
   2.676 -    if (!this->hidden->needUpdate && !this->hidden->videoMem) {
   2.677 -        SDL_SetError
   2.678 -            ("Couldn't get address of video memory, may be unsupported device or bug");
   2.679 -        return (NULL);
   2.680 -    }
   2.681 -
   2.682 -    /* detect user landscape mode */
   2.683 -    if ((width > height)
   2.684 -        && (GetSystemMetrics(SM_CXSCREEN) < GetSystemMetrics(SM_CYSCREEN)))
   2.685 -        gapi->userOrientation = SDL_ORIENTATION_RIGHT;
   2.686 -
   2.687 -    /* shall we apply hires fix? for example when we do not use hires resource */
   2.688 -    gapi->hiresFix = 0;
   2.689 -    if (gapi->userOrientation == SDL_ORIENTATION_RIGHT) {
   2.690 -        if ((width > GetSystemMetrics(SM_CYSCREEN))
   2.691 -            || (height > GetSystemMetrics(SM_CXSCREEN)))
   2.692 -            gapi->hiresFix = 1;
   2.693 -    } else if ((width > GetSystemMetrics(SM_CXSCREEN))
   2.694 -               || (height > GetSystemMetrics(SM_CYSCREEN)))
   2.695 -        if (!((width == GetSystemMetrics(SM_CYSCREEN)) && (height == GetSystemMetrics(SM_CXSCREEN))))   // user portrait, device landscape
   2.696 -            gapi->hiresFix = 1;
   2.697 -
   2.698 -    switch (gapi->userOrientation) {
   2.699 -    case SDL_ORIENTATION_UP:
   2.700 -        gapi->startOffset = 0;
   2.701 -        gapi->dstLineStep = gapi->gxProperties.cbyPitch;
   2.702 -        gapi->dstPixelStep = gapi->gxProperties.cbxPitch;
   2.703 -        break;
   2.704 -    case SDL_ORIENTATION_RIGHT:
   2.705 -        switch (gapi->gapiOrientation) {
   2.706 -        case SDL_ORIENTATION_UP:
   2.707 -        case SDL_ORIENTATION_RIGHT:
   2.708 -        case SDL_ORIENTATION_LEFT:
   2.709 -            if ((this->hidden->videoMode == GAPI_MONO))
   2.710 -                gapi->startOffset = -gapi->gxProperties.cbxPitch + 1;   // monochrome mode
   2.711 -            else
   2.712 -                gapi->startOffset =
   2.713 -                    gapi->gxProperties.cbyPitch *
   2.714 -                    (gapi->gxProperties.cyHeight - 1);
   2.715 -
   2.716 -            gapi->dstLineStep = gapi->gxProperties.cbxPitch;
   2.717 -            gapi->dstPixelStep = -gapi->gxProperties.cbyPitch;
   2.718 -            break;
   2.719 -        }
   2.720 -    }
   2.721 -
   2.722 -    video->w = this->hidden->w = width;
   2.723 -    video->h = this->hidden->h = height;
   2.724 -    video->pitch = SDL_CalculatePitch(video);
   2.725 -
   2.726 -    /* Small fix for WinCE/Win32 - when activating window
   2.727 -       SDL_VideoSurface is equal to zero, so activating code
   2.728 -       is not called properly for fullscreen windows because
   2.729 -       macros WINDIB_FULLSCREEN uses SDL_VideoSurface
   2.730 -     */
   2.731 -    SDL_VideoSurface = video;
   2.732 -
   2.733 -    /* GAPI is always fullscreen, title bar is useless */
   2.734 -    style = 0;
   2.735 -
   2.736 -    if (!SDL_windowid)
   2.737 -        SetWindowLong(SDL_Window, GWL_STYLE, style);
   2.738 -
   2.739 -    /* Allocate bitmap */
   2.740 -    if (gapiBuffer) {
   2.741 -        SDL_free(gapiBuffer);
   2.742 -        gapiBuffer = NULL;
   2.743 -    }
   2.744 -    gapiBuffer = SDL_malloc(video->h * video->pitch);
   2.745 -    video->pixels = gapiBuffer;
   2.746 -
   2.747 -    if (!this->hidden->buffer) {
   2.748 -        SDL_SetError("Couldn't allocate buffer for requested mode");
   2.749 -        return (NULL);
   2.750 -    }
   2.751 -
   2.752 -    SDL_memset(gapiBuffer, 255, video->h * video->pitch);
   2.753 -    MoveWindow(SDL_Window, 0, 0, GetSystemMetrics(SM_CXSCREEN),
   2.754 -               GetSystemMetrics(SM_CYSCREEN), FALSE);
   2.755 -    ShowWindow(SDL_Window, SW_SHOW);
   2.756 -    SetForegroundWindow(SDL_Window);
   2.757 -
   2.758 -    /* JC 14 Mar 2006
   2.759 -       Flush the message loop or this can cause big problems later
   2.760 -       Especially if the user decides to use dialog boxes or assert()!
   2.761 -     */
   2.762 -    WIN_FlushMessageQueue();
   2.763 -
   2.764 -    /* Open GAPI display */
   2.765 -    if (!gapi->useVga && this->hidden->useGXOpenDisplay)
   2.766 -        if (!gapi->gxFunc.GXOpenDisplay(SDL_Window, GX_FULLSCREEN)) {
   2.767 -            SDL_SetError("Couldn't initialize GAPI");
   2.768 -            return (NULL);
   2.769 -        }
   2.770 -#if REPORT_VIDEO_INFO
   2.771 -    printf("Video properties:\n");
   2.772 -    printf("display bpp: %d\n", gapi->gxProperties.cBPP);
   2.773 -    printf("display width: %d\n", gapi->gxProperties.cxWidth);
   2.774 -    printf("display height: %d\n", gapi->gxProperties.cyHeight);
   2.775 -    printf("x pitch: %d\n", gapi->gxProperties.cbxPitch);
   2.776 -    printf("y pitch: %d\n", gapi->gxProperties.cbyPitch);
   2.777 -    printf("gapi flags: 0x%x\n", gapi->gxProperties.ffFormat);
   2.778 -
   2.779 -    if (!gapi->useVga && this->hidden->useGXOpenDisplay && gapi->needUpdate) {
   2.780 -        gapi->videoMem = gapi->gxFunc.GXBeginDraw();
   2.781 -        gapi->gxFunc.GXEndDraw();
   2.782 -    }
   2.783 -
   2.784 -    printf("video memory: 0x%x\n", gapi->videoMem);
   2.785 -    printf("need update: %d\n", gapi->needUpdate);
   2.786 -    printf("hi-res fix: %d\n", gapi->hiresFix);
   2.787 -    printf("VGA is available on the device: %d\n", g_bRawBufferAvailable);
   2.788 -    printf("use raw framebuffer: %d\n", gapi->useVga);
   2.789 -    printf("video surface bpp: %d\n", video->format->BitsPerPixel);
   2.790 -    printf("video surface width: %d\n", video->w);
   2.791 -    printf("video surface height: %d\n", video->h);
   2.792 -#endif
   2.793 -
   2.794 -
   2.795 -    /* Blank screen */
   2.796 -    allScreen.x = allScreen.y = 0;
   2.797 -    allScreen.w = video->w - 1;
   2.798 -    allScreen.h = video->h - 1;
   2.799 -    GAPI_UpdateRects(this, 1, &allScreen);
   2.800 -
   2.801 -    /* We're done */
   2.802 -    return (video);
   2.803 -}
   2.804 -
   2.805 -/* We don't actually allow hardware surfaces other than the main one */
   2.806 -static int
   2.807 -GAPI_AllocHWSurface(_THIS, SDL_Surface * surface)
   2.808 -{
   2.809 -    return (-1);
   2.810 -}
   2.811 -
   2.812 -static void
   2.813 -GAPI_FreeHWSurface(_THIS, SDL_Surface * surface)
   2.814 -{
   2.815 -    return;
   2.816 -}
   2.817 -
   2.818 -/* We need to wait for vertical retrace on page flipped displays */
   2.819 -static int
   2.820 -GAPI_LockHWSurface(_THIS, SDL_Surface * surface)
   2.821 -{
   2.822 -    return (0);
   2.823 -}
   2.824 -
   2.825 -static void
   2.826 -GAPI_UnlockHWSurface(_THIS, SDL_Surface * surface)
   2.827 -{
   2.828 -    return;
   2.829 -}
   2.830 -
   2.831 -static int
   2.832 -updateLine8to8(_THIS, unsigned char *srcPointer, unsigned char *destPointer,
   2.833 -               int width, int height, int lines)
   2.834 -{
   2.835 -    if (gapi->dstPixelStep == 1) {      /* optimized blitting on most devices */
   2.836 -        SDL_memcpy(destPointer, srcPointer, width);
   2.837 -        return 1;
   2.838 -    } else {
   2.839 -        // TODO: read 4 pixels, write DWORD
   2.840 -        int step = gapi->dstPixelStep;
   2.841 -        while (width--) {
   2.842 -            *destPointer = *srcPointer++;
   2.843 -            destPointer += step;
   2.844 -        }
   2.845 -    }
   2.846 -    return 1;
   2.847 -}
   2.848 -
   2.849 -/* Video memory is very slow so lets optimize as much as possible */
   2.850 -static int
   2.851 -updateLine16to16(_THIS, PIXEL * srcPointer, PIXEL * destPointer, int width,
   2.852 -                 int height, int lines)
   2.853 -{
   2.854 -    PIXEL *line1, *line2;
   2.855 -    int step = gapi->dstPixelStep / 2;
   2.856 -
   2.857 -    if (step == 1) {            /* optimized blitting on most devices */
   2.858 -        SDL_memcpy(destPointer, srcPointer, width * sizeof(PIXEL));
   2.859 -        return 1;
   2.860 -    } else {
   2.861 -        if ((gapi->gapiOrientation != SDL_ORIENTATION_UP) && (gapi->userOrientation == SDL_ORIENTATION_UP))     // iPaq 3660/3800 and user orientation up
   2.862 -        {
   2.863 -            // to prevent data misalignment copy only one line
   2.864 -            if (((((unsigned) destPointer & 3) != 0)
   2.865 -                 && (gapi->gapiOrientation == SDL_ORIENTATION_LEFT))
   2.866 -                || ((((unsigned) destPointer & 3) == 0)
   2.867 -                    && (gapi->gapiOrientation != SDL_ORIENTATION_LEFT))
   2.868 -                || (lines == 1)) {
   2.869 -                while (width--) {
   2.870 -                    *destPointer = *srcPointer++;
   2.871 -                    destPointer += step;
   2.872 -                }
   2.873 -                return 1;
   2.874 -            }
   2.875 -
   2.876 -            /* read two lines at the same time, write DWORD */
   2.877 -            line1 = srcPointer;
   2.878 -            line2 = srcPointer + SDL_VideoSurface->pitch / 2;
   2.879 -
   2.880 -            if (gapi->gapiOrientation == SDL_ORIENTATION_LEFT)
   2.881 -                while (width--) // iPaq 3800
   2.882 -                {
   2.883 -                    *(DWORD *) destPointer = (*line2++ << 16) | *line1++;
   2.884 -                    destPointer += step;
   2.885 -            } else {
   2.886 -                destPointer += gapi->gxProperties.cbyPitch / 2;
   2.887 -
   2.888 -                while (width--) // iPaq 3660
   2.889 -                {
   2.890 -                    *(DWORD *) destPointer = (*line1++ << 16) | *line2++;
   2.891 -                    destPointer += step;
   2.892 -                }
   2.893 -            }
   2.894 -            return 2;
   2.895 -        } else {
   2.896 -            // iPaq 3800 and user orientation landscape
   2.897 -            if (gapi->gapiOrientation == SDL_ORIENTATION_LEFT) {
   2.898 -                int w1;
   2.899 -
   2.900 -                // to prevent data misalignment copy only one pixel
   2.901 -                if ((((unsigned) destPointer & 3) == 0) && (width > 0)) {
   2.902 -                    *destPointer-- = *srcPointer++;
   2.903 -                    width--;
   2.904 -                }
   2.905 -
   2.906 -                destPointer--;
   2.907 -
   2.908 -                w1 = width / 2;
   2.909 -
   2.910 -                while (w1--) {
   2.911 -                    DWORD p = *(DWORD *) srcPointer;
   2.912 -                    *((DWORD *) destPointer) = (p << 16) | (p >> 16);
   2.913 -                    destPointer -= 2;
   2.914 -                    srcPointer += 2;
   2.915 -                }
   2.916 -
   2.917 -                if (width & 1)  // copy the last pixel
   2.918 -                {
   2.919 -                    destPointer++;
   2.920 -                    *destPointer = *srcPointer;
   2.921 -                }
   2.922 -
   2.923 -                return 1;
   2.924 -            }
   2.925 -            // modern iPaqs and user orientation landscape
   2.926 -            // read two pixels, write DWORD
   2.927 -
   2.928 -            line1 = srcPointer;
   2.929 -            line2 = srcPointer + SDL_VideoSurface->pitch / 2;
   2.930 -
   2.931 -            if ((((unsigned) destPointer & 3) != 0) || (lines == 1)) {
   2.932 -                while (width--) {
   2.933 -                    *destPointer = *srcPointer++;
   2.934 -                    destPointer += step;
   2.935 -                }
   2.936 -                return 1;
   2.937 -            }
   2.938 -
   2.939 -            while (width--) {
   2.940 -                *(DWORD *) destPointer = (*line2++ << 16) | *line1++;
   2.941 -                destPointer -= gapi->gxProperties.cbyPitch / 2;
   2.942 -            }
   2.943 -            return 2;
   2.944 -        }
   2.945 -    }
   2.946 -}
   2.947 -
   2.948 -// Color component masks for 565
   2.949 -#define REDMASK (31<<11)
   2.950 -#define GREENMASK (63<<5)
   2.951 -#define BLUEMASK (31)
   2.952 -
   2.953 -
   2.954 -static int
   2.955 -updateLine16to4(_THIS, PIXEL * srcPointer, unsigned char *destPointer,
   2.956 -                int width, int height, int lines, int yNibble, int xNibble)
   2.957 -{
   2.958 -    PIXEL *line1, *line2;
   2.959 -    int step = gapi->dstPixelStep;
   2.960 -
   2.961 -    if (gapi->userOrientation == SDL_ORIENTATION_UP) {
   2.962 -        if (yNibble)            // copy bottom half of a line
   2.963 -        {
   2.964 -            while (width--) {
   2.965 -                PIXEL c1 = *srcPointer++;
   2.966 -                c1 = ((c1 & REDMASK) >> 11) + ((c1 & GREENMASK) >> 5) +
   2.967 -                    (c1 & BLUEMASK);
   2.968 -                *destPointer = (*destPointer & 0x0F) | ((~(c1 >> 3) << 4));
   2.969 -                destPointer += step;
   2.970 -            }
   2.971 -            return 1;
   2.972 -        }
   2.973 -        // either 1 pixel picture or tail, anyway this is the last line
   2.974 -        if (lines == 1) {
   2.975 -            while (width--) {
   2.976 -                PIXEL c1 = *srcPointer++;
   2.977 -                c1 = ((c1 & REDMASK) >> 11) + ((c1 & GREENMASK) >> 5) +
   2.978 -                    (c1 & BLUEMASK);
   2.979 -                *destPointer = (*destPointer & 0xF0) | ((~(c1 >> 3) & 0xF));
   2.980 -                destPointer += step;
   2.981 -            }
   2.982 -            return 1;
   2.983 -        }
   2.984 -
   2.985 -        line1 = srcPointer;
   2.986 -        line2 = srcPointer + SDL_VideoSurface->pitch / 2;
   2.987 -
   2.988 -        while (width--) {
   2.989 -            PIXEL c1 = *line1++;
   2.990 -            PIXEL c2 = *line2++;
   2.991 -            c1 = ((c1 & REDMASK) >> 11) + ((c1 & GREENMASK) >> 5) +
   2.992 -                (c1 & BLUEMASK);
   2.993 -            c2 = ((c2 & REDMASK) >> 11) + ((c2 & GREENMASK) >> 5) +
   2.994 -                (c2 & BLUEMASK);
   2.995 -            *destPointer = ~((c1 >> 3) + ((c2 >> 3) << 4));
   2.996 -            destPointer += step;
   2.997 -        }
   2.998 -        return 2;
   2.999 -    } else {
  2.1000 -        int w1;
  2.1001 -        w1 = width / 2;
  2.1002 -
  2.1003 -        if (xNibble) {
  2.1004 -            // copy one pixel
  2.1005 -            PIXEL c1 = *srcPointer++;
  2.1006 -            c1 = ((c1 & REDMASK) >> 11) + ((c1 & GREENMASK) >> 5) +
  2.1007 -                (c1 & BLUEMASK);
  2.1008 -            *destPointer = (*destPointer & 0xF0) | ((~(c1 >> 3) & 0xF));
  2.1009 -            destPointer++;
  2.1010 -        }
  2.1011 -
  2.1012 -        while (w1--) {
  2.1013 -            PIXEL c1 = *srcPointer;
  2.1014 -            PIXEL c2 = *(srcPointer + 1);
  2.1015 -            c1 = ((c1 & REDMASK) >> 11) + ((c1 & GREENMASK) >> 5) +
  2.1016 -                (c1 & BLUEMASK);
  2.1017 -            c2 = ((c2 & REDMASK) >> 11) + ((c2 & GREENMASK) >> 5) +
  2.1018 -                (c2 & BLUEMASK);
  2.1019 -            *destPointer++ = ~((c2 >> 3) + ((c1 >> 3) << 4));
  2.1020 -            srcPointer += 2;
  2.1021 -        }
  2.1022 -
  2.1023 -        // copy tail
  2.1024 -        if ((width & 1) && !xNibble) {
  2.1025 -            PIXEL c1 = *srcPointer;
  2.1026 -            c1 = ((c1 & REDMASK) >> 11) + ((c1 & GREENMASK) >> 5) +
  2.1027 -                (c1 & BLUEMASK);
  2.1028 -            *destPointer = (*destPointer & 0x0F) | ((~(c1 >> 3) << 4));
  2.1029 -        }
  2.1030 -
  2.1031 -        return 1;
  2.1032 -    }
  2.1033 -}
  2.1034 -
  2.1035 -static void
  2.1036 -GAPI_UpdateRectsMono(_THIS, int numrects, SDL_Rect * rects)
  2.1037 -{
  2.1038 -    int i, height;
  2.1039 -    int linesProcessed;
  2.1040 -    int xNibble, yNibble;
  2.1041 -
  2.1042 -    for (i = 0; i < numrects; i++) {
  2.1043 -        unsigned char *destPointer;
  2.1044 -        unsigned char *srcPointer;
  2.1045 -
  2.1046 -        if (gapi->userOrientation == SDL_ORIENTATION_UP)
  2.1047 -            destPointer =
  2.1048 -                (unsigned char *) gapi->videoMem + gapi->startOffset -
  2.1049 -                rects[i].y * gapi->gxProperties.cBPP / 8 +
  2.1050 -                rects[i].x * gapi->dstPixelStep;
  2.1051 -        else
  2.1052 -            destPointer =
  2.1053 -                (unsigned char *) gapi->videoMem + gapi->startOffset +
  2.1054 -                rects[i].x * gapi->gxProperties.cBPP / 8 +
  2.1055 -                rects[i].y * gapi->dstLineStep;
  2.1056 -
  2.1057 -        srcPointer =
  2.1058 -            ((unsigned char *) SDL_VideoSurface->pixels) +
  2.1059 -            rects[i].y * SDL_VideoSurface->pitch + rects[i].x * 2;
  2.1060 -        yNibble = rects[i].y & 1;       // TODO: only for 4 bpp
  2.1061 -        xNibble = rects[i].x & 1;
  2.1062 -        height = rects[i].h;
  2.1063 -        while (height > 0) {
  2.1064 -            switch (gapi->gxProperties.cBPP) {
  2.1065 -            case 2:            // TODO
  2.1066 -            case 4:
  2.1067 -                linesProcessed =
  2.1068 -                    updateLine16to4(this, (PIXEL *) srcPointer,
  2.1069 -                                    destPointer, rects[i].w,
  2.1070 -                                    rects[i].h, height, yNibble, xNibble);
  2.1071 -                yNibble = 0;
  2.1072 -            }
  2.1073 -            height -= linesProcessed;
  2.1074 -            if (gapi->userOrientation == SDL_ORIENTATION_UP)
  2.1075 -                destPointer--;  // always fill 1 byte
  2.1076 -            else
  2.1077 -                destPointer += gapi->dstLineStep;
  2.1078 -            srcPointer += SDL_VideoSurface->pitch * linesProcessed;     // pitch in bytes
  2.1079 -        }
  2.1080 -    }
  2.1081 -}
  2.1082 -
  2.1083 -static void
  2.1084 -GAPI_UpdateRectsColor(_THIS, int numrects, SDL_Rect * rects)
  2.1085 -{
  2.1086 -    int i, height;
  2.1087 -    int bytesPerPixel = (gapi->gxProperties.cBPP + 1) / 8;
  2.1088 -    int linesProcessed;
  2.1089 -    for (i = 0; i < numrects; i++) {
  2.1090 -        unsigned char *destPointer =
  2.1091 -            (unsigned char *) gapi->videoMem + gapi->startOffset +
  2.1092 -            rects[i].y * gapi->dstLineStep + rects[i].x * gapi->dstPixelStep;
  2.1093 -        unsigned char *srcPointer =
  2.1094 -            ((unsigned char *) SDL_VideoSurface->pixels) +
  2.1095 -            rects[i].y * SDL_VideoSurface->pitch + rects[i].x * bytesPerPixel;
  2.1096 -        height = rects[i].h;
  2.1097 -
  2.1098 -//              fprintf(stderr, "Starting rect %dx%d, dst=0x%x, w = %d, h = %d\n", rects[i].w, rects[i].h,destPointer,rects[i].w,rects[i].h);
  2.1099 -//              fflush(stderr);
  2.1100 -        linesProcessed = height;
  2.1101 -
  2.1102 -        while (height > 0) {
  2.1103 -            switch (bytesPerPixel) {
  2.1104 -            case 1:
  2.1105 -                linesProcessed =
  2.1106 -                    updateLine8to8(this, srcPointer,
  2.1107 -                                   (unsigned char *) destPointer,
  2.1108 -                                   rects[i].w, rects[i].h, height);
  2.1109 -                break;
  2.1110 -            case 2:
  2.1111 -#pragma warning(disable: 4133)
  2.1112 -                linesProcessed =
  2.1113 -                    updateLine16to16(this, (PIXEL *) srcPointer,
  2.1114 -                                     destPointer, rects[i].w,
  2.1115 -                                     rects[i].h, height);
  2.1116 -                break;
  2.1117 -            }
  2.1118 -            height -= linesProcessed;
  2.1119 -            destPointer += gapi->dstLineStep * linesProcessed;
  2.1120 -            srcPointer += SDL_VideoSurface->pitch * linesProcessed;     // pitch in bytes
  2.1121 -        }
  2.1122 -//              fprintf(stderr, "End of rect\n");
  2.1123 -//              fflush(stderr);
  2.1124 -    }
  2.1125 -}
  2.1126 -
  2.1127 -
  2.1128 -static void
  2.1129 -GAPI_UpdateRects(_THIS, int numrects, SDL_Rect * rects)
  2.1130 -{
  2.1131 -    // we do not want to corrupt video memory
  2.1132 -    if (gapi->suspended)
  2.1133 -        return;
  2.1134 -
  2.1135 -    if (gapi->needUpdate)
  2.1136 -        gapi->videoMem = gapi->gxFunc.GXBeginDraw();
  2.1137 -
  2.1138 -    if (gapi->gxProperties.cBPP < 8)
  2.1139 -        GAPI_UpdateRectsMono(this, numrects, rects);
  2.1140 -    else
  2.1141 -        GAPI_UpdateRectsColor(this, numrects, rects);
  2.1142 -
  2.1143 -    if (gapi->needUpdate)
  2.1144 -        gapi->gxFunc.GXEndDraw();
  2.1145 -}
  2.1146 -
  2.1147 -/* Note:  If we are terminated, this could be called in the middle of
  2.1148 -   another SDL video routine -- notably UpdateRects.
  2.1149 -*/
  2.1150 -void
  2.1151 -GAPI_VideoQuit(_THIS)
  2.1152 -{
  2.1153 -    int i, j;
  2.1154 -    /* Destroy the window and everything associated with it */
  2.1155 -    if (SDL_Window) {
  2.1156 -        if ((g_hGapiLib != 0) && this && this->hidden
  2.1157 -            && this->hidden->gxFunc.GXCloseDisplay && !this->hidden->useVga)
  2.1158 -            this->hidden->gxFunc.GXCloseDisplay();
  2.1159 -
  2.1160 -        if (this->screen->pixels != NULL) {
  2.1161 -            SDL_free(this->screen->pixels);
  2.1162 -            this->screen->pixels = NULL;
  2.1163 -        }
  2.1164 -        if (screen_icn) {
  2.1165 -            DestroyIcon(screen_icn);
  2.1166 -            screen_icn = NULL;
  2.1167 -        }
  2.1168 -
  2.1169 -        DIB_DestroyWindow(this);
  2.1170 -        SDL_UnregisterApp();
  2.1171 -
  2.1172 -        SDL_Window = NULL;
  2.1173 -#if defined(_WIN32_WCE)
  2.1174 -
  2.1175 -// Unload wince aygshell library to prevent leak
  2.1176 -        if (aygshell) {
  2.1177 -            FreeLibrary(aygshell);
  2.1178 -            aygshell = NULL;
  2.1179 -        }
  2.1180 -#endif
  2.1181 -
  2.1182 -        /* Free video mode lists */
  2.1183 -        for (i = 0; i < NUM_MODELISTS; ++i) {
  2.1184 -            if (gapi->SDL_modelist[i] != NULL) {
  2.1185 -                for (j = 0; gapi->SDL_modelist[i][j]; ++j)
  2.1186 -                    SDL_free(gapi->SDL_modelist[i][j]);
  2.1187 -                SDL_free(gapi->SDL_modelist[i]);
  2.1188 -                gapi->SDL_modelist[i] = NULL;
  2.1189 -            }
  2.1190 -        }
  2.1191 -
  2.1192 -    }
  2.1193 -
  2.1194 -}
  2.1195 -
  2.1196 -static void
  2.1197 -GAPI_RealizePalette(_THIS)
  2.1198 -{
  2.1199 -    OutputDebugString(TEXT("GAPI_RealizePalette NOT IMPLEMENTED !\r\n"));
  2.1200 -}
  2.1201 -
  2.1202 -static void
  2.1203 -GAPI_PaletteChanged(_THIS, HWND window)
  2.1204 -{
  2.1205 -    OutputDebugString(TEXT("GAPI_PaletteChanged NOT IMPLEMENTED !\r\n"));
  2.1206 -}
  2.1207 -
  2.1208 -static void
  2.1209 -GAPI_WinPAINT(_THIS, HDC hdc)
  2.1210 -{
  2.1211 -    // draw current offscreen buffer on hdc
  2.1212 -
  2.1213 -    int bpp = 16;               // we always use either 8 or 16 bpp internally
  2.1214 -
  2.1215 -    unsigned short *bitmapData;
  2.1216 -    HBITMAP hb;
  2.1217 -    HDC srcDC;
  2.1218 -
  2.1219 -    // Create a DIB
  2.1220 -    BYTE buffer[sizeof(BITMAPINFOHEADER) + 3 * sizeof(RGBQUAD)] = { 0 };
  2.1221 -    BITMAPINFO *pBMI = (BITMAPINFO *) buffer;
  2.1222 -    BITMAPINFOHEADER *pHeader = &pBMI->bmiHeader;
  2.1223 -    DWORD *pColors = (DWORD *) & pBMI->bmiColors;
  2.1224 -
  2.1225 -    // CreateDIBSection does not support 332 pixel format on wce
  2.1226 -    if (gapi->gxProperties.cBPP == 8)
  2.1227 -        return;
  2.1228 -
  2.1229 -    // DIB Header
  2.1230 -    pHeader->biSize = sizeof(BITMAPINFOHEADER);
  2.1231 -    pHeader->biWidth = this->hidden->w;
  2.1232 -    pHeader->biHeight = -this->hidden->h;
  2.1233 -    pHeader->biPlanes = 1;
  2.1234 -    pHeader->biBitCount = bpp;
  2.1235 -    pHeader->biCompression = BI_RGB;
  2.1236 -    pHeader->biSizeImage = (this->hidden->w * this->hidden->h * bpp) / 8;
  2.1237 -
  2.1238 -    // Color masks
  2.1239 -    if (bpp == 16) {
  2.1240 -        pColors[0] = REDMASK;
  2.1241 -        pColors[1] = GREENMASK;
  2.1242 -        pColors[2] = BLUEMASK;
  2.1243 -        pHeader->biCompression = BI_BITFIELDS;
  2.1244 -    }
  2.1245 -    // Create the DIB
  2.1246 -    hb = CreateDIBSection(0, pBMI, DIB_RGB_COLORS, (void **) &bitmapData, 0,
  2.1247 -                          0);
  2.1248 -
  2.1249 -    // copy data
  2.1250 -    // FIXME: prevent misalignment, but I've never seen non aligned width of screen
  2.1251 -    memcpy(bitmapData, this->hidden->buffer, pHeader->biSizeImage);
  2.1252 -    srcDC = CreateCompatibleDC(hdc);
  2.1253 -    SelectObject(srcDC, hb);
  2.1254 -
  2.1255 -    BitBlt(hdc, 0, 0, this->hidden->w, this->hidden->h, srcDC, 0, 0, SRCCOPY);
  2.1256 -
  2.1257 -    DeleteObject(hb);
  2.1258 -    DeleteDC(srcDC);
  2.1259 -}
  2.1260 -
  2.1261 -int
  2.1262 -GAPI_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors)
  2.1263 -{
  2.1264 -    GAPI_CreatePalette(ncolors, colors);
  2.1265 -    return 1;
  2.1266 -}
  2.1267 -
  2.1268 -/* vi: set ts=4 sw=4 expandtab: */
     3.1 --- a/src/video/gapi/SDL_gapivideo.h	Wed Jan 06 07:37:15 2010 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,168 +0,0 @@
     3.4 -/*
     3.5 -    SDL - Simple DirectMedia Layer
     3.6 -    Copyright (C) 1997-2009 Sam Lantinga
     3.7 -
     3.8 -    This library is free software; you can redistribute it and/or
     3.9 -    modify it under the terms of the GNU Lesser General Public
    3.10 -    License as published by the Free Software Foundation; either
    3.11 -    version 2.1 of the License, or (at your option) any later version.
    3.12 -
    3.13 -    This library is distributed in the hope that it will be useful,
    3.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    3.16 -    Lesser General Public License for more details.
    3.17 -
    3.18 -    You should have received a copy of the GNU Lesser General Public
    3.19 -    License along with this library; if not, write to the Free Software
    3.20 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    3.21 -
    3.22 -    Sam Lantinga
    3.23 -    slouken@libsdl.org
    3.24 -*/
    3.25 -#include "SDL_config.h"
    3.26 -
    3.27 -#ifndef _SDL_gapivideo_h
    3.28 -#define _SDL_gapivideo_h
    3.29 -
    3.30 -#include "SDL_mouse.h"
    3.31 -#include "SDL_mutex.h"
    3.32 -#include "../SDL_sysvideo.h"
    3.33 -
    3.34 -/* From gx.h, since it's not really C compliant */
    3.35 -
    3.36 -struct GXDisplayProperties
    3.37 -{
    3.38 -    DWORD cxWidth;
    3.39 -    DWORD cyHeight;             // notice lack of 'th' in the word height.
    3.40 -    long cbxPitch;              // number of bytes to move right one x pixel - can be negative.
    3.41 -    long cbyPitch;              // number of bytes to move down one y pixel - can be negative.
    3.42 -    long cBPP;                  // # of bits in each pixel
    3.43 -    DWORD ffFormat;             // format flags.
    3.44 -};
    3.45 -
    3.46 -struct GXKeyList
    3.47 -{
    3.48 -    short vkUp;                 // key for up
    3.49 -    POINT ptUp;                 // x,y position of key/button.  Not on screen but in screen coordinates.
    3.50 -    short vkDown;
    3.51 -    POINT ptDown;
    3.52 -    short vkLeft;
    3.53 -    POINT ptLeft;
    3.54 -    short vkRight;
    3.55 -    POINT ptRight;
    3.56 -    short vkA;
    3.57 -    POINT ptA;
    3.58 -    short vkB;
    3.59 -    POINT ptB;
    3.60 -    short vkC;
    3.61 -    POINT ptC;
    3.62 -    short vkStart;
    3.63 -    POINT ptStart;
    3.64 -};
    3.65 -
    3.66 -typedef int (*PFNGXOpenDisplay) (HWND hWnd, DWORD dwFlags);
    3.67 -typedef int (*PFNGXCloseDisplay) ();
    3.68 -typedef void *(*PFNGXBeginDraw) ();
    3.69 -typedef int (*PFNGXEndDraw) ();
    3.70 -typedef int (*PFNGXOpenInput) ();
    3.71 -typedef int (*PFNGXCloseInput) ();
    3.72 -typedef struct GXDisplayProperties (*PFNGXGetDisplayProperties) ();
    3.73 -typedef struct GXKeyList (*PFNGXGetDefaultKeys) (int iOptions);
    3.74 -typedef int (*PFNGXSuspend) ();
    3.75 -typedef int (*PFNGXResume) ();
    3.76 -typedef int (*PFNGXSetViewport) (DWORD dwTop, DWORD dwHeight,
    3.77 -                                 DWORD dwReserved1, DWORD dwReserved2);
    3.78 -typedef BOOL(*PFNGXIsDisplayDRAMBuffer) ();
    3.79 -
    3.80 -struct GapiFunc
    3.81 -{
    3.82 -    PFNGXOpenDisplay GXOpenDisplay;
    3.83 -    PFNGXCloseDisplay GXCloseDisplay;
    3.84 -    PFNGXBeginDraw GXBeginDraw;
    3.85 -    PFNGXEndDraw GXEndDraw;
    3.86 -    PFNGXOpenInput GXOpenInput;
    3.87 -    PFNGXCloseInput GXCloseInput;
    3.88 -    PFNGXGetDisplayProperties GXGetDisplayProperties;
    3.89 -    PFNGXGetDefaultKeys GXGetDefaultKeys;
    3.90 -    PFNGXSuspend GXSuspend;
    3.91 -    PFNGXResume GXResume;
    3.92 -    PFNGXSetViewport GXSetViewport;
    3.93 -    PFNGXIsDisplayDRAMBuffer GXIsDisplayDRAMBuffer;
    3.94 -};
    3.95 -
    3.96 -#define kfLandscape	0x8     // Screen is rotated 270 degrees
    3.97 -#define kfPalette	0x10    // Pixel values are indexes into a palette
    3.98 -#define kfDirect	0x20    // Pixel values contain actual level information
    3.99 -#define kfDirect555	0x40    // 5 bits each for red, green and blue values in a pixel.
   3.100 -#define kfDirect565	0x80    // 5 red bits, 6 green bits and 5 blue bits per pixel
   3.101 -#define kfDirect888	0x100   // 8 bits each for red, green and blue values in a pixel.
   3.102 -#define kfDirect444	0x200   // 4 red, 4 green, 4 blue
   3.103 -#define kfDirectInverted 0x400
   3.104 -
   3.105 -#define GX_FULLSCREEN	0x01    // for OpenDisplay()
   3.106 -#define GX_NORMALKEYS   0x02
   3.107 -#define GX_LANDSCAPEKEYS        0x03
   3.108 -
   3.109 -typedef enum
   3.110 -{
   3.111 -    SDL_ORIENTATION_UP,
   3.112 -    SDL_ORIENTATION_DOWN,
   3.113 -    SDL_ORIENTATION_LEFT,
   3.114 -    SDL_ORIENTATION_RIGHT
   3.115 -} SDL_ScreenOrientation;
   3.116 -
   3.117 -/* GAPI video mode */
   3.118 -typedef enum
   3.119 -{
   3.120 -    GAPI_NONE = 0,
   3.121 -    GAPI_DIRECT_565,
   3.122 -    GAPI_DIRECT_555,
   3.123 -    GAPI_MONO,
   3.124 -    GAPI_PALETTE
   3.125 -} GAPIVideoMode;
   3.126 -
   3.127 -/* Hidden "this" pointer for the video functions */
   3.128 -#define _THIS	SDL_VideoDevice *this
   3.129 -
   3.130 -typedef unsigned short PIXEL;
   3.131 -
   3.132 -/* Private display data 
   3.133 -   begin with DIB private structure to allow DIB events code sharing
   3.134 -*/
   3.135 -struct SDL_PrivateVideoData
   3.136 -{
   3.137 -    HBITMAP screen_bmp;
   3.138 -    HPALETTE screen_pal;
   3.139 -
   3.140 -#define NUM_MODELISTS	4       /* 8, 16, 24, and 32 bits-per-pixel */
   3.141 -    int SDL_nummodes[NUM_MODELISTS];
   3.142 -    SDL_Rect **SDL_modelist[NUM_MODELISTS];
   3.143 -    enum SDL_ScreenOrientation userOrientation;
   3.144 -    int invert;
   3.145 -    char hiresFix;              // using hires mode without defining hires resource
   3.146 -// --------------
   3.147 -    int useGXOpenDisplay;       /* use GXOpenDispplay */
   3.148 -    int w, h;
   3.149 -    enum SDL_ScreenOrientation gapiOrientation;
   3.150 -
   3.151 -    void *buffer;               // may be 8, 16, 24, 32 bpp
   3.152 -    PIXEL *videoMem;
   3.153 -    BOOL needUpdate;
   3.154 -    struct GXKeyList keyList;
   3.155 -    struct GapiFunc gxFunc;
   3.156 -    struct GXDisplayProperties gxProperties;
   3.157 -    enum GAPIVideoMode videoMode;
   3.158 -    int colorscale;
   3.159 -    int dstLineStep;            // in bytes
   3.160 -    int dstPixelStep;           // in bytes
   3.161 -    int startOffset;            // in bytes
   3.162 -    int useVga;
   3.163 -    int suspended;              // do not pu anything into video memory
   3.164 -};
   3.165 -
   3.166 -
   3.167 -#define gapiBuffer this->hidden->buffer
   3.168 -#define gapi this->hidden
   3.169 -
   3.170 -#endif /* _SDL_gapivideo_h */
   3.171 -/* vi: set ts=4 sw=4 expandtab: */