Changeset 9560 for trunk/src


Ignore:
Timestamp:
Dec 29, 2002, 3:11:03 PM (23 years ago)
Author:
sandervl
Message:

Cleanup

Location:
trunk/src/ddraw
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ddraw/clipper.h

    r9459 r9560  
    1 /* $Id: clipper.h,v 1.1 2002-12-04 10:34:57 sandervl Exp $ */
     1/* $Id: clipper.h,v 1.2 2002-12-29 14:11:00 sandervl Exp $ */
    22
    33/*
     
    6666};
    6767
    68 HRESULT __stdcall ClipQueryInterface(THIS, REFIID riid, LPVOID FAR * ppvObj);
    69 ULONG   __stdcall ClipAddRef(THIS);
    70 ULONG   __stdcall ClipRelease(THIS);
    71 HRESULT __stdcall ClipGetClipList(THIS, LPRECT, LPRGNDATA, LPDWORD);
    72 HRESULT __stdcall ClipGetHWnd(THIS, HWND FAR *);
    73 HRESULT __stdcall ClipInitialize(THIS, LPDIRECTDRAW, DWORD);
    74 HRESULT __stdcall ClipIsClipListChanged(THIS, BOOL FAR *);
    75 HRESULT __stdcall ClipSetClipList(THIS, LPRGNDATA,DWORD);
    76 HRESULT __stdcall ClipSetHWnd(THIS, DWORD, HWND );
     68HRESULT WIN32API ClipQueryInterface(THIS, REFIID riid, LPVOID FAR * ppvObj);
     69ULONG   WIN32API ClipAddRef(THIS);
     70ULONG   WIN32API ClipRelease(THIS);
     71HRESULT WIN32API ClipGetClipList(THIS, LPRECT, LPRGNDATA, LPDWORD);
     72HRESULT WIN32API ClipGetHWnd(THIS, HWND FAR *);
     73HRESULT WIN32API ClipInitialize(THIS, LPDIRECTDRAW, DWORD);
     74HRESULT WIN32API ClipIsClipListChanged(THIS, BOOL FAR *);
     75HRESULT WIN32API ClipSetClipList(THIS, LPRGNDATA,DWORD);
     76HRESULT WIN32API ClipSetHWnd(THIS, DWORD, HWND );
    7777
    7878#endif
  • trunk/src/ddraw/ddraw2d.cpp

    r9532 r9560  
    1 /* $Id: ddraw2d.cpp,v 1.4 2002-12-20 10:38:25 sandervl Exp $ */
     1/* $Id: ddraw2d.cpp,v 1.5 2002-12-29 14:11:01 sandervl Exp $ */
    22
    33/*
     
    5656FOURCC DiveFOURCCs[MAX_DIVE_FOURCC] = {0};
    5757
     58extern IDirectDrawVtbl  DDrawV1Table;
     59extern IDirectDraw2Vtbl DDrawV2Table;
     60extern IDirectDraw4Vtbl DDrawV4Table;
     61extern IDirect3DVtbl    DDraw3DTable;
     62
    5863//******************************************************************************
    5964//Force DirectDraw to report only one fullscreen mode (useful for custom builds)
     
    9297
    9398  // Setup table for 3d devices
    94   Vtbl3D.AddRef         = D3DAddRef;
    95   Vtbl3D.Release        = D3DRelease;
    96   Vtbl3D.QueryInterface = D3DQueryInterface;
    97   Vtbl3D.Initialize     = D3DInitialize;
    98   Vtbl3D.EnumDevices    = D3DEnumDevices;
    99   Vtbl3D.CreateLight    = D3DCreateLight;
    100   Vtbl3D.CreateMaterial = D3DCreateMaterial;
    101   Vtbl3D.CreateViewport = D3DCreateViewport;
    102   Vtbl3D.FindDevice     = D3DFindDevice;
    103 
    104   // Org Interface
    105   Vtbl.AddRef                 = DrawAddRef;
    106   Vtbl.Release                = DrawRelease;
    107   Vtbl.QueryInterface         = DrawQueryInterface;
    108   Vtbl.Compact                = DrawCompact;
    109   Vtbl.CreateClipper          = DrawCreateClipper;
    110   Vtbl.CreatePalette          = DrawCreatePalette;
    111   Vtbl.CreateSurface          = DrawCreateSurface;
    112   Vtbl.DuplicateSurface       = DrawDuplicateSurface;
    113   Vtbl.EnumDisplayModes       = DrawEnumDisplayModes;
    114   Vtbl.EnumSurfaces           = DrawEnumSurfaces;
    115   Vtbl.FlipToGDISurface       = DrawFlipToGDISurface;
    116   Vtbl.GetCaps                = DrawGetCaps;
    117   Vtbl.GetDisplayMode         = DrawGetDisplayMode;
    118   Vtbl.GetFourCCCodes         = DrawGetFourCCCodes;
    119   Vtbl.GetGDISurface          = DrawGetGDISurface;
    120   Vtbl.GetMonitorFrequency    = DrawGetMonitorFrequency;
    121   Vtbl.GetScanLine            = DrawGetScanLine;
    122   Vtbl.GetVerticalBlankStatus = DrawGetVerticalBlankStatus;
    123   Vtbl.Initialize             = DrawInitialize;
    124   Vtbl.RestoreDisplayMode     = DrawRestoreDisplayMode;
    125   Vtbl.SetCooperativeLevel    = DrawSetCooperativeLevel;
    126   Vtbl.SetDisplayMode         = DrawSetDisplayMode;
    127   Vtbl.WaitForVerticalBlank   = DrawWaitForVerticalBlank;
    128 
    129   // V2 Interface
    130 
    131   Vtbl2.AddRef                 = DrawAddRef;
    132   Vtbl2.Release                = DrawRelease;
    133   Vtbl2.QueryInterface         = DrawQueryInterface;
    134   Vtbl2.Compact                = DrawCompact;
    135   Vtbl2.CreateClipper          = DrawCreateClipper;
    136   Vtbl2.CreatePalette          = DrawCreatePalette;
    137   Vtbl2.CreateSurface          = DrawCreateSurface;
    138   Vtbl2.DuplicateSurface       = DrawDuplicateSurface;
    139   Vtbl2.EnumDisplayModes       = DrawEnumDisplayModes;
    140   Vtbl2.EnumSurfaces           = DrawEnumSurfaces;
    141   Vtbl2.FlipToGDISurface       = DrawFlipToGDISurface;
    142   Vtbl2.GetCaps                = DrawGetCaps;
    143   Vtbl2.GetDisplayMode         = DrawGetDisplayMode;
    144   Vtbl2.GetFourCCCodes         = DrawGetFourCCCodes;
    145   Vtbl2.GetGDISurface          = DrawGetGDISurface;
    146   Vtbl2.GetMonitorFrequency    = DrawGetMonitorFrequency;
    147   Vtbl2.GetScanLine            = DrawGetScanLine;
    148   Vtbl2.GetVerticalBlankStatus = DrawGetVerticalBlankStatus;
    149   Vtbl2.Initialize             = DrawInitialize;
    150   Vtbl2.RestoreDisplayMode     = DrawRestoreDisplayMode;
    151   Vtbl2.SetCooperativeLevel    = DrawSetCooperativeLevel;
    152   Vtbl2.SetDisplayMode         = DrawSetDisplayMode2;
    153   Vtbl2.WaitForVerticalBlank   = DrawWaitForVerticalBlank;
    154   Vtbl2.GetAvailableVidMem     = DrawGetAvailableVidMem;
    155 
    156   // New V4 interface
    157   Vtbl4.AddRef                 = DrawAddRef;   // todo change to a DrawAddRef4 as handling this has changed
    158   Vtbl4.Release                = DrawRelease;  // see above
    159   Vtbl4.QueryInterface         = DrawQueryInterface;
    160   Vtbl4.Compact                = DrawCompact;
    161   Vtbl4.CreateClipper          = DrawCreateClipper;
    162   Vtbl4.CreatePalette          = DrawCreatePalette;
    163   Vtbl4.CreateSurface          = DrawCreateSurface4;//
    164   Vtbl4.DuplicateSurface       = DrawDuplicateSurface4;//
    165   Vtbl4.EnumDisplayModes       = DrawEnumDisplayModes4;//
    166   Vtbl4.EnumSurfaces           = DrawEnumSurfaces4; //
    167   Vtbl4.FlipToGDISurface       = DrawFlipToGDISurface;
    168   Vtbl4.GetCaps                = DrawGetCaps;
    169   Vtbl4.GetDisplayMode         = DrawGetDisplayMode4;//
    170   Vtbl4.GetFourCCCodes         = DrawGetFourCCCodes;
    171   Vtbl4.GetGDISurface          = DrawGetGDISurface4;//
    172   Vtbl4.GetMonitorFrequency    = DrawGetMonitorFrequency;
    173   Vtbl4.GetScanLine            = DrawGetScanLine;
    174   Vtbl4.GetVerticalBlankStatus = DrawGetVerticalBlankStatus;
    175   Vtbl4.Initialize             = DrawInitialize;
    176   Vtbl4.RestoreDisplayMode     = DrawRestoreDisplayMode;
    177   Vtbl4.SetCooperativeLevel    = DrawSetCooperativeLevel;
    178   Vtbl4.SetDisplayMode         = DrawSetDisplayMode2;
    179   Vtbl4.WaitForVerticalBlank   = DrawWaitForVerticalBlank;
    180   Vtbl4.GetAvailableVidMem     = DrawGetAvailableVidMem4;
    181   Vtbl4.GetSurfaceFromDC       = DrawGetSurfaceFromDC;
    182   Vtbl4.RestoreAllSurfaces     = DrawRestoreAllSurfaces;
    183   Vtbl4.TestCooperativeLevel   = DrawTestCooperativeLevel;
    184   Vtbl4.GetDeviceIdentifier    = DrawGetDeviceIdentifier;
     99  Vtbl3D = DDraw3DTable;
     100
     101  // Copy Interface tables
     102  Vtbl  = DDrawV1Table;
     103  Vtbl2 = DDrawV2Table;
     104  Vtbl4 = DDrawV4Table;
     105
    185106
    186107  if(lpGUID && *lpGUID == IID_IDirect3D)
     
    21662087}
    21672088//******************************************************************************
    2168 //******************************************************************************
    2169 
     2089// Setup table for 3d devices
     2090//******************************************************************************
     2091IDirect3DVtbl DDraw3DTable =
     2092{
     2093 D3DQueryInterface,
     2094 D3DAddRef,
     2095 D3DRelease,
     2096 D3DInitialize,
     2097 D3DEnumDevices,
     2098 D3DCreateLight,
     2099 D3DCreateMaterial,
     2100 D3DCreateViewport,
     2101 D3DFindDevice
     2102};
     2103//******************************************************************************
     2104// Org Interface
     2105//******************************************************************************
     2106IDirectDrawVtbl DDrawV1Table =
     2107{
     2108 DrawQueryInterface,
     2109 DrawAddRef,
     2110 DrawRelease,
     2111 DrawCompact,
     2112 DrawCreateClipper,
     2113 DrawCreatePalette,
     2114 DrawCreateSurface,
     2115 DrawDuplicateSurface,
     2116 DrawEnumDisplayModes,
     2117 DrawEnumSurfaces,
     2118 DrawFlipToGDISurface,
     2119 DrawGetCaps,
     2120 DrawGetDisplayMode,
     2121 DrawGetFourCCCodes,
     2122 DrawGetGDISurface,
     2123 DrawGetMonitorFrequency,
     2124 DrawGetScanLine,
     2125 DrawGetVerticalBlankStatus,
     2126 DrawInitialize,
     2127 DrawRestoreDisplayMode,
     2128 DrawSetCooperativeLevel,
     2129 DrawSetDisplayMode,
     2130 DrawWaitForVerticalBlank
     2131};
     2132//******************************************************************************
     2133// V2 Interface
     2134//******************************************************************************
     2135IDirectDraw2Vtbl DDrawV2Table =
     2136{
     2137 DrawQueryInterface,
     2138 DrawAddRef,
     2139 DrawRelease,
     2140 DrawCompact,
     2141 DrawCreateClipper,
     2142 DrawCreatePalette,
     2143 DrawCreateSurface,
     2144 DrawDuplicateSurface,
     2145 DrawEnumDisplayModes,
     2146 DrawEnumSurfaces,
     2147 DrawFlipToGDISurface,
     2148 DrawGetCaps,
     2149 DrawGetDisplayMode,
     2150 DrawGetFourCCCodes,
     2151 DrawGetGDISurface,
     2152 DrawGetMonitorFrequency,
     2153 DrawGetScanLine,
     2154 DrawGetVerticalBlankStatus,
     2155 DrawInitialize,
     2156 DrawRestoreDisplayMode,
     2157 DrawSetCooperativeLevel,
     2158 DrawSetDisplayMode2,
     2159 DrawWaitForVerticalBlank,
     2160 DrawGetAvailableVidMem
     2161};
     2162//******************************************************************************
     2163// New V4 interface
     2164//******************************************************************************
     2165IDirectDraw4Vtbl DDrawV4Table =
     2166{
     2167 DrawQueryInterface,
     2168 DrawAddRef,   // todo change to a DrawAddRef4 as handling this has change,
     2169 DrawRelease,  // see abov,
     2170 DrawCompact,
     2171 DrawCreateClipper,
     2172 DrawCreatePalette,
     2173 DrawCreateSurface4,
     2174 DrawDuplicateSurface4,
     2175 DrawEnumDisplayModes4,
     2176 DrawEnumSurfaces4,
     2177 DrawFlipToGDISurface,
     2178 DrawGetCaps,
     2179 DrawGetDisplayMode4,
     2180 DrawGetFourCCCodes,
     2181 DrawGetGDISurface4,
     2182 DrawGetMonitorFrequency,
     2183 DrawGetScanLine,
     2184 DrawGetVerticalBlankStatus,
     2185 DrawInitialize,
     2186 DrawRestoreDisplayMode,
     2187 DrawSetCooperativeLevel,
     2188 DrawSetDisplayMode2,
     2189 DrawWaitForVerticalBlank,
     2190 DrawGetAvailableVidMem4,
     2191 DrawGetSurfaceFromDC,
     2192 DrawRestoreAllSurfaces,
     2193 DrawTestCooperativeLevel,
     2194 DrawGetDeviceIdentifier,
     2195};
     2196//******************************************************************************
     2197//******************************************************************************
  • trunk/src/ddraw/ddraw2d.h

    r9459 r9560  
    1 /* $Id: ddraw2d.h,v 1.1 2002-12-04 10:34:59 sandervl Exp $ */
     1/* $Id: ddraw2d.h,v 1.2 2002-12-29 14:11:01 sandervl Exp $ */
    22
    33/*
     
    113113    static    OS2IDirectDraw* ddraw;                  // List of OS2IDirectDraw
    114114
    115     friend    HRESULT __stdcall DrawQueryInterface(THIS, REFIID riid, LPVOID  * ppvObj);
    116     friend    ULONG   __stdcall DrawAddRef(THIS);
    117     friend    ULONG   __stdcall DrawRelease(THIS);
    118     friend    HRESULT __stdcall DrawCompact(THIS);
    119     friend    HRESULT __stdcall DrawCreateClipper(THIS, DWORD, LPDIRECTDRAWCLIPPER *, IUnknown  * );
    120     friend    HRESULT __stdcall DrawCreatePalette(THIS, DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE *, IUnknown  * );
    121     friend    HRESULT __stdcall DrawCreateSurface(THIS, LPDDSURFACEDESC, LPDIRECTDRAWSURFACE  *, IUnknown  *);
    122     friend    HRESULT __stdcall DrawCreateSurface4(THIS, LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE4  *, IUnknown  *);
    123     friend    HRESULT __stdcall DrawDuplicateSurface(THIS, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE  * );
    124     friend    HRESULT __stdcall DrawDuplicateSurface4(THIS, LPDIRECTDRAWSURFACE4, LPDIRECTDRAWSURFACE4  * );
    125     friend    HRESULT __stdcall DrawEnumDisplayModes(THIS, DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK );
    126     friend    HRESULT __stdcall DrawEnumDisplayModes4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2 );
    127     friend    HRESULT __stdcall DrawEnumSurfaces(THIS, DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK );
    128     friend    HRESULT __stdcall DrawEnumSurfaces4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID,LPDDENUMSURFACESCALLBACK2 );
    129     friend    HRESULT __stdcall DrawFlipToGDISurface(THIS);
    130     friend    HRESULT __stdcall DrawGetCaps(THIS, LPDDCAPS, LPDDCAPS);
    131     friend    HRESULT __stdcall DrawGetDisplayMode(THIS, LPDDSURFACEDESC);
    132     friend    HRESULT __stdcall DrawGetFourCCCodes(THIS, LPDWORD, LPDWORD);
    133     friend    HRESULT __stdcall DrawGetGDISurface(THIS, LPDIRECTDRAWSURFACE  *);
    134     friend    HRESULT __stdcall DrawGetGDISurface4(THIS, LPDIRECTDRAWSURFACE4  *);
    135     friend    HRESULT __stdcall DrawGetMonitorFrequency(THIS, LPDWORD);
    136     friend    HRESULT __stdcall DrawGetScanLine(THIS, LPDWORD);
    137     friend    HRESULT __stdcall DrawGetVerticalBlankStatus(THIS, LPBOOL);
    138     friend    HRESULT __stdcall DrawInitialize(THIS, GUID  *);
    139     friend    HRESULT __stdcall DrawRestoreDisplayMode(THIS);
    140     friend    HRESULT __stdcall DrawSetCooperativeLevel(THIS, HWND, DWORD);
    141     friend    HRESULT __stdcall DrawSetDisplayMode(THIS, DWORD, DWORD,DWORD);
    142     friend    HRESULT __stdcall DrawSetDisplayMode2(THIS, DWORD, DWORD,DWORD, DWORD, DWORD);
    143     friend    HRESULT __stdcall DrawWaitForVerticalBlank(THIS, DWORD, HANDLE);
     115    friend    HRESULT WIN32API DrawQueryInterface(THIS, REFIID riid, LPVOID  * ppvObj);
     116    friend    ULONG   WIN32API DrawAddRef(THIS);
     117    friend    ULONG   WIN32API DrawRelease(THIS);
     118    friend    HRESULT WIN32API DrawCompact(THIS);
     119    friend    HRESULT WIN32API DrawCreateClipper(THIS, DWORD, LPDIRECTDRAWCLIPPER *, IUnknown  * );
     120    friend    HRESULT WIN32API DrawCreatePalette(THIS, DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE *, IUnknown  * );
     121    friend    HRESULT WIN32API DrawCreateSurface(THIS, LPDDSURFACEDESC, LPDIRECTDRAWSURFACE  *, IUnknown  *);
     122    friend    HRESULT WIN32API DrawCreateSurface4(THIS, LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE4  *, IUnknown  *);
     123    friend    HRESULT WIN32API DrawDuplicateSurface(THIS, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE  * );
     124    friend    HRESULT WIN32API DrawDuplicateSurface4(THIS, LPDIRECTDRAWSURFACE4, LPDIRECTDRAWSURFACE4  * );
     125    friend    HRESULT WIN32API DrawEnumDisplayModes(THIS, DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK );
     126    friend    HRESULT WIN32API DrawEnumDisplayModes4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2 );
     127    friend    HRESULT WIN32API DrawEnumSurfaces(THIS, DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK );
     128    friend    HRESULT WIN32API DrawEnumSurfaces4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID,LPDDENUMSURFACESCALLBACK2 );
     129    friend    HRESULT WIN32API DrawFlipToGDISurface(THIS);
     130    friend    HRESULT WIN32API DrawGetCaps(THIS, LPDDCAPS, LPDDCAPS);
     131    friend    HRESULT WIN32API DrawGetDisplayMode(THIS, LPDDSURFACEDESC);
     132    friend    HRESULT WIN32API DrawGetFourCCCodes(THIS, LPDWORD, LPDWORD);
     133    friend    HRESULT WIN32API DrawGetGDISurface(THIS, LPDIRECTDRAWSURFACE  *);
     134    friend    HRESULT WIN32API DrawGetGDISurface4(THIS, LPDIRECTDRAWSURFACE4  *);
     135    friend    HRESULT WIN32API DrawGetMonitorFrequency(THIS, LPDWORD);
     136    friend    HRESULT WIN32API DrawGetScanLine(THIS, LPDWORD);
     137    friend    HRESULT WIN32API DrawGetVerticalBlankStatus(THIS, LPBOOL);
     138    friend    HRESULT WIN32API DrawInitialize(THIS, GUID  *);
     139    friend    HRESULT WIN32API DrawRestoreDisplayMode(THIS);
     140    friend    HRESULT WIN32API DrawSetCooperativeLevel(THIS, HWND, DWORD);
     141    friend    HRESULT WIN32API DrawSetDisplayMode(THIS, DWORD, DWORD,DWORD);
     142    friend    HRESULT WIN32API DrawSetDisplayMode2(THIS, DWORD, DWORD,DWORD, DWORD, DWORD);
     143    friend    HRESULT WIN32API DrawWaitForVerticalBlank(THIS, DWORD, HANDLE);
    144144    // V2 Interface
    145     friend    HRESULT __stdcall DrawGetAvailableVidMem(THIS, LPDDSCAPS, LPDWORD, LPDWORD);
    146     friend    HRESULT __stdcall DrawGetAvailableVidMem4(THIS, LPDDSCAPS2, LPDWORD, LPDWORD);
     145    friend    HRESULT WIN32API DrawGetAvailableVidMem(THIS, LPDDSCAPS, LPDWORD, LPDWORD);
     146    friend    HRESULT WIN32API DrawGetAvailableVidMem4(THIS, LPDDSCAPS2, LPDWORD, LPDWORD);
    147147    // V4 Interface
    148     friend    HRESULT __stdcall GetSurfaceFromDC(THIS, HDC, LPDIRECTDRAWSURFACE4 *);
    149     friend    HRESULT __stdcall RestoreAllSurfaces(THIS) ;
    150     friend    HRESULT __stdcall TestCooperativeLevel(THIS) ;
    151     friend    HRESULT __stdcall GetDeviceIdentifier(THIS, LPDDDEVICEIDENTIFIER, DWORD );
     148    friend    HRESULT WIN32API GetSurfaceFromDC(THIS, HDC, LPDIRECTDRAWSURFACE4 *);
     149    friend    HRESULT WIN32API RestoreAllSurfaces(THIS) ;
     150    friend    HRESULT WIN32API TestCooperativeLevel(THIS) ;
     151    friend    HRESULT WIN32API GetDeviceIdentifier(THIS, LPDDDEVICEIDENTIFIER, DWORD );
    152152    /*** IDirect3D methods ***/
    153     friend    HRESULT __stdcall D3DQueryInterface(THIS, REFIID riid, LPVOID  * ppvObj);
    154     friend    ULONG   __stdcall D3DAddRef(THIS);
    155     friend    ULONG   __stdcall D3DRelease(THIS);
    156     friend    HRESULT __stdcall D3DInitialize(THIS, REFIID);
    157     friend    HRESULT __stdcall D3DEnumDevices(THIS, LPD3DENUMDEVICESCALLBACK, LPVOID);
    158     friend    HRESULT __stdcall D3DCreateLight(THIS, LPDIRECT3DLIGHT*, IUnknown*);
    159     friend    HRESULT __stdcall D3DCreateMaterial(THIS, LPDIRECT3DMATERIAL*, IUnknown*);
    160     friend    HRESULT __stdcall D3DCreateViewport(THIS, LPDIRECT3DVIEWPORT*, IUnknown*);
    161     friend    HRESULT __stdcall D3DFindDevice(THIS, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT);
     153    friend    HRESULT WIN32API D3DQueryInterface(THIS, REFIID riid, LPVOID  * ppvObj);
     154    friend    ULONG   WIN32API D3DAddRef(THIS);
     155    friend    ULONG   WIN32API D3DRelease(THIS);
     156    friend    HRESULT WIN32API D3DInitialize(THIS, REFIID);
     157    friend    HRESULT WIN32API D3DEnumDevices(THIS, LPD3DENUMDEVICESCALLBACK, LPVOID);
     158    friend    HRESULT WIN32API D3DCreateLight(THIS, LPDIRECT3DLIGHT*, IUnknown*);
     159    friend    HRESULT WIN32API D3DCreateMaterial(THIS, LPDIRECT3DMATERIAL*, IUnknown*);
     160    friend    HRESULT WIN32API D3DCreateViewport(THIS, LPDIRECT3DVIEWPORT*, IUnknown*);
     161    friend    HRESULT WIN32API D3DFindDevice(THIS, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT);
    162162
    163163};
     
    167167
    168168//******************************************************************************
    169 HRESULT __stdcall DrawQueryInterface(THIS, REFIID riid, LPVOID  * ppvObj);
    170 ULONG   __stdcall DrawAddRef(THIS);
    171 ULONG   __stdcall DrawRelease(THIS);
    172 HRESULT __stdcall DrawCompact(THIS);
    173 HRESULT __stdcall DrawCreateClipper(THIS, DWORD, LPDIRECTDRAWCLIPPER *, IUnknown  * );
    174 HRESULT __stdcall DrawCreatePalette(THIS, DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE *, IUnknown  * );
    175 HRESULT __stdcall DrawCreateSurface(THIS, LPDDSURFACEDESC, LPDIRECTDRAWSURFACE  *, IUnknown  *);
    176 HRESULT __stdcall DrawDuplicateSurface(THIS, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE  * );
    177 HRESULT __stdcall DrawEnumDisplayModes(THIS, DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK );
    178 HRESULT __stdcall DrawEnumSurfaces(THIS, DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK );
    179 HRESULT __stdcall DrawFlipToGDISurface(THIS);
    180 HRESULT __stdcall DrawGetCaps(THIS, LPDDCAPS, LPDDCAPS);
    181 HRESULT __stdcall DrawGetDisplayMode(THIS, LPDDSURFACEDESC);
    182 HRESULT __stdcall DrawGetFourCCCodes(THIS, LPDWORD, LPDWORD);
    183 HRESULT __stdcall DrawGetGDISurface(THIS, LPDIRECTDRAWSURFACE  *);
    184 HRESULT __stdcall DrawGetMonitorFrequency(THIS, LPDWORD);
    185 HRESULT __stdcall DrawGetScanLine(THIS, LPDWORD);
    186 HRESULT __stdcall DrawGetVerticalBlankStatus(THIS, LPBOOL);
    187 HRESULT __stdcall DrawInitialize(THIS, GUID  *);
    188 HRESULT __stdcall DrawRestoreDisplayMode(THIS);
    189 HRESULT __stdcall DrawSetCooperativeLevel(THIS, HWND, DWORD);
    190 HRESULT __stdcall DrawSetDisplayMode(THIS, DWORD, DWORD,DWORD);
    191 HRESULT __stdcall DrawSetDisplayMode2(THIS, DWORD, DWORD,DWORD, DWORD, DWORD);
    192 HRESULT __stdcall DrawWaitForVerticalBlank(THIS, DWORD, HANDLE);
     169HRESULT WIN32API DrawQueryInterface(THIS, REFIID riid, LPVOID  * ppvObj);
     170ULONG   WIN32API DrawAddRef(THIS);
     171ULONG   WIN32API DrawRelease(THIS);
     172HRESULT WIN32API DrawCompact(THIS);
     173HRESULT WIN32API DrawCreateClipper(THIS, DWORD, LPDIRECTDRAWCLIPPER *, IUnknown  * );
     174HRESULT WIN32API DrawCreatePalette(THIS, DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE *, IUnknown  * );
     175HRESULT WIN32API DrawCreateSurface(THIS, LPDDSURFACEDESC, LPDIRECTDRAWSURFACE  *, IUnknown  *);
     176HRESULT WIN32API DrawDuplicateSurface(THIS, LPDIRECTDRAWSURFACE, LPDIRECTDRAWSURFACE  * );
     177HRESULT WIN32API DrawEnumDisplayModes(THIS, DWORD, LPDDSURFACEDESC, LPVOID, LPDDENUMMODESCALLBACK );
     178HRESULT WIN32API DrawEnumSurfaces(THIS, DWORD, LPDDSURFACEDESC, LPVOID,LPDDENUMSURFACESCALLBACK );
     179HRESULT WIN32API DrawFlipToGDISurface(THIS);
     180HRESULT WIN32API DrawGetCaps(THIS, LPDDCAPS, LPDDCAPS);
     181HRESULT WIN32API DrawGetDisplayMode(THIS, LPDDSURFACEDESC);
     182HRESULT WIN32API DrawGetFourCCCodes(THIS, LPDWORD, LPDWORD);
     183HRESULT WIN32API DrawGetGDISurface(THIS, LPDIRECTDRAWSURFACE  *);
     184HRESULT WIN32API DrawGetMonitorFrequency(THIS, LPDWORD);
     185HRESULT WIN32API DrawGetScanLine(THIS, LPDWORD);
     186HRESULT WIN32API DrawGetVerticalBlankStatus(THIS, LPBOOL);
     187HRESULT WIN32API DrawInitialize(THIS, GUID  *);
     188HRESULT WIN32API DrawRestoreDisplayMode(THIS);
     189HRESULT WIN32API DrawSetCooperativeLevel(THIS, HWND, DWORD);
     190HRESULT WIN32API DrawSetDisplayMode(THIS, DWORD, DWORD,DWORD);
     191HRESULT WIN32API DrawSetDisplayMode2(THIS, DWORD, DWORD,DWORD, DWORD, DWORD);
     192HRESULT WIN32API DrawWaitForVerticalBlank(THIS, DWORD, HANDLE);
    193193// V2
    194 HRESULT __stdcall DrawGetAvailableVidMem(THIS, LPDDSCAPS, LPDWORD, LPDWORD);
     194HRESULT WIN32API DrawGetAvailableVidMem(THIS, LPDDSCAPS, LPDWORD, LPDWORD);
    195195// V4
    196 HRESULT __stdcall DrawGetSurfaceFromDC(THIS, HDC, LPDIRECTDRAWSURFACE4 *);
    197 HRESULT __stdcall DrawRestoreAllSurfaces(THIS) ;
    198 HRESULT __stdcall DrawTestCooperativeLevel(THIS) ;
    199 HRESULT __stdcall DrawGetDeviceIdentifier(THIS, LPDDDEVICEIDENTIFIER, DWORD );
     196HRESULT WIN32API DrawGetSurfaceFromDC(THIS, HDC, LPDIRECTDRAWSURFACE4 *);
     197HRESULT WIN32API DrawRestoreAllSurfaces(THIS) ;
     198HRESULT WIN32API DrawTestCooperativeLevel(THIS) ;
     199HRESULT WIN32API DrawGetDeviceIdentifier(THIS, LPDDDEVICEIDENTIFIER, DWORD );
    200200// functions which ifaces are changed in DirectX6 after all MS uses COM where an programmer
    201201// isn't allowd to change a function iface after he published the iface (See MS COM docs!)
    202 HRESULT __stdcall DrawCreateSurface4(THIS, LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE4  *, IUnknown  *);
    203 HRESULT __stdcall DrawDuplicateSurface4(THIS, LPDIRECTDRAWSURFACE4, LPDIRECTDRAWSURFACE4  * );
    204 HRESULT __stdcall DrawEnumDisplayModes4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2 );
    205 HRESULT __stdcall DrawEnumSurfaces4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID,LPDDENUMSURFACESCALLBACK2 );
    206 HRESULT __stdcall DrawGetDisplayMode4(THIS, LPDDSURFACEDESC2);
    207 HRESULT __stdcall DrawGetGDISurface4(THIS, LPDIRECTDRAWSURFACE4  *);
    208 HRESULT __stdcall DrawGetAvailableVidMem4(THIS, LPDDSCAPS2, LPDWORD, LPDWORD);
     202HRESULT WIN32API DrawCreateSurface4(THIS, LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE4  *, IUnknown  *);
     203HRESULT WIN32API DrawDuplicateSurface4(THIS, LPDIRECTDRAWSURFACE4, LPDIRECTDRAWSURFACE4  * );
     204HRESULT WIN32API DrawEnumDisplayModes4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2 );
     205HRESULT WIN32API DrawEnumSurfaces4(THIS, DWORD, LPDDSURFACEDESC2, LPVOID,LPDDENUMSURFACESCALLBACK2 );
     206HRESULT WIN32API DrawGetDisplayMode4(THIS, LPDDSURFACEDESC2);
     207HRESULT WIN32API DrawGetGDISurface4(THIS, LPDIRECTDRAWSURFACE4  *);
     208HRESULT WIN32API DrawGetAvailableVidMem4(THIS, LPDDSCAPS2, LPDWORD, LPDWORD);
    209209
    210210/*** IDirect3D methods ***/
    211 HRESULT __stdcall D3DQueryInterface(THIS, REFIID riid, LPVOID  * ppvObj);
    212 ULONG   __stdcall D3DAddRef(THIS);
    213 ULONG   __stdcall D3DRelease(THIS);
    214 HRESULT __stdcall D3DInitialize(THIS, REFIID);
    215 HRESULT __stdcall D3DEnumDevices(THIS, LPD3DENUMDEVICESCALLBACK, LPVOID);
    216 HRESULT __stdcall D3DCreateLight(THIS, LPDIRECT3DLIGHT*, IUnknown*);
    217 HRESULT __stdcall D3DCreateMaterial(THIS, LPDIRECT3DMATERIAL*, IUnknown*);
    218 HRESULT __stdcall D3DCreateViewport(THIS, LPDIRECT3DVIEWPORT*, IUnknown*);
    219 HRESULT __stdcall D3DFindDevice(THIS, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT);
     211HRESULT WIN32API D3DQueryInterface(THIS, REFIID riid, LPVOID  * ppvObj);
     212ULONG   WIN32API D3DAddRef(THIS);
     213ULONG   WIN32API D3DRelease(THIS);
     214HRESULT WIN32API D3DInitialize(THIS, REFIID);
     215HRESULT WIN32API D3DEnumDevices(THIS, LPD3DENUMDEVICESCALLBACK, LPVOID);
     216HRESULT WIN32API D3DCreateLight(THIS, LPDIRECT3DLIGHT*, IUnknown*);
     217HRESULT WIN32API D3DCreateMaterial(THIS, LPDIRECT3DMATERIAL*, IUnknown*);
     218HRESULT WIN32API D3DCreateViewport(THIS, LPDIRECT3DVIEWPORT*, IUnknown*);
     219HRESULT WIN32API D3DFindDevice(THIS, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT);
    220220
    221221#define FOURCC_YUY2  mmioFOURCC( 'Y', 'U', 'Y', '2' )
  • trunk/src/ddraw/ddraw3d.cpp

    r9459 r9560  
    1 /* $Id: ddraw3d.cpp,v 1.1 2002-12-04 10:35:00 sandervl Exp $ */
     1/* $Id: ddraw3d.cpp,v 1.2 2002-12-29 14:11:01 sandervl Exp $ */
    22
    33/*
     
    3131//******************************************************************************
    3232//******************************************************************************
    33 HRESULT __stdcall D3DQueryInterface(THIS This, REFIID riid, LPVOID FAR * ppvObj)
     33HRESULT WIN32API D3DQueryInterface(THIS This, REFIID riid, LPVOID FAR * ppvObj)
    3434{
    3535  dprintf(("DDRAW: D3DQueryInterface\n"));
     
    4646//******************************************************************************
    4747//******************************************************************************
    48 ULONG __stdcall D3DAddRef(THIS This)
     48ULONG WIN32API D3DAddRef(THIS This)
    4949{
    5050 OS2IDirectDraw *me = DDraw3D_GetThisPtr(This);
     
    5555//******************************************************************************
    5656//******************************************************************************
    57 ULONG __stdcall D3DRelease(THIS This)
     57ULONG WIN32API D3DRelease(THIS This)
    5858{
    5959 OS2IDirectDraw *me = DDraw3D_GetThisPtr(This);
     
    7777//******************************************************************************
    7878//******************************************************************************
    79 HRESULT __stdcall D3DInitialize(THIS This, REFIID)
     79HRESULT WIN32API D3DInitialize(THIS This, REFIID)
    8080{
    8181 OS2IDirectDraw *me = DDraw3D_GetThisPtr(This);
     
    8686//******************************************************************************
    8787//******************************************************************************
    88 HRESULT __stdcall D3DEnumDevices(THIS This, LPD3DENUMDEVICESCALLBACK, LPVOID)
     88HRESULT WIN32API D3DEnumDevices(THIS This, LPD3DENUMDEVICESCALLBACK, LPVOID)
    8989{
    9090 OS2IDirectDraw *me = DDraw3D_GetThisPtr(This);
     
    9595//******************************************************************************
    9696//******************************************************************************
    97 HRESULT __stdcall D3DCreateLight(THIS This, LPDIRECT3DLIGHT*, IUnknown*)
     97HRESULT WIN32API D3DCreateLight(THIS This, LPDIRECT3DLIGHT*, IUnknown*)
    9898{
    9999 OS2IDirectDraw *me = DDraw3D_GetThisPtr(This);
     
    104104//******************************************************************************
    105105//******************************************************************************
    106 HRESULT __stdcall D3DCreateMaterial(THIS This, LPDIRECT3DMATERIAL*, IUnknown*)
     106HRESULT WIN32API D3DCreateMaterial(THIS This, LPDIRECT3DMATERIAL*, IUnknown*)
    107107{
    108108 OS2IDirectDraw *me = DDraw3D_GetThisPtr(This);
     
    113113//******************************************************************************
    114114//******************************************************************************
    115 HRESULT __stdcall D3DCreateViewport(THIS This, LPDIRECT3DVIEWPORT*, IUnknown*)
     115HRESULT WIN32API D3DCreateViewport(THIS This, LPDIRECT3DVIEWPORT*, IUnknown*)
    116116{
    117117 OS2IDirectDraw *me = DDraw3D_GetThisPtr(This);
     
    122122//******************************************************************************
    123123//******************************************************************************
    124 HRESULT __stdcall D3DFindDevice(THIS This, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT)
     124HRESULT WIN32API D3DFindDevice(THIS This, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT)
    125125{
    126126 OS2IDirectDraw *me = DDraw3D_GetThisPtr(This);
  • trunk/src/ddraw/makefile

    r9532 r9560  
    1 # $Id: makefile,v 1.31 2002-12-20 10:38:25 sandervl Exp $
     1# $Id: makefile,v 1.32 2002-12-29 14:11:01 sandervl Exp $
    22
    33#
     
    2727$(OBJDIR)\asmutil.obj \
    2828$(OBJDIR)\surface.obj \
     29$(OBJDIR)\surfblit.obj \
     30$(OBJDIR)\surfoverlay.obj \
    2931$(OBJDIR)\surfacehlp.obj \
    3032$(OBJDIR)\wndproc.obj \
  • trunk/src/ddraw/palette.cpp

    r9459 r9560  
    1 /* $Id: palette.cpp,v 1.1 2002-12-04 10:35:01 sandervl Exp $ */
     1/* $Id: palette.cpp,v 1.2 2002-12-29 14:11:02 sandervl Exp $ */
    22
    33/*
     
    3333#define THIS IDirectDrawPalette*
    3434
     35extern IDirectDrawPaletteVtbl DDrawPaletteTable;
     36
    3537//******************************************************************************
    3638//******************************************************************************
     
    4345
    4446{
    45   lpVtbl              = &Vtbl;
    46   Vtbl.AddRef         = PalAddRef;
    47   Vtbl.Release        = PalRelease;
    48   Vtbl.QueryInterface = PalQueryInterface;
    49   Vtbl.GetCaps        = PalGetCaps;
    50   Vtbl.GetEntries     = PalGetEntries;
    51   Vtbl.Initialize     = PalInitialize;
    52   Vtbl.SetEntries     = PalSetEntries;
    53 
    54   lpDraw                        = lpDirectDraw;
     47  Vtbl    = DDrawPaletteTable;
     48  lpVtbl  = &Vtbl;
     49
     50  lpDraw  = lpDirectDraw;
    5551  ((OS2IDirectDraw*)lpDraw)->Vtbl.AddRef(lpDraw);
    56   hDive                         = ((OS2IDirectDraw*)lpDirectDraw)->GetDiveInstance();
    57   dwCaps                        = dwPalFlags;
    58   hDiveCC                       = ((OS2IDirectDraw*)lpDirectDraw)->GetCCDiveInstance();
     52  hDive   = ((OS2IDirectDraw*)lpDirectDraw)->GetDiveInstance();
     53  dwCaps  = dwPalFlags;
     54  hDiveCC = ((OS2IDirectDraw*)lpDirectDraw)->GetCCDiveInstance();
    5955
    6056  dwSize = palsize;
     
    9389//******************************************************************************
    9490//******************************************************************************
    95 HRESULT __stdcall PalQueryInterface(THIS This, REFIID riid, LPVOID FAR * ppvObj)
     91HRESULT WIN32API PalQueryInterface(THIS This, REFIID riid, LPVOID FAR * ppvObj)
    9692{
    9793  dprintf(("DDRAW: OS2IDirectDrawPalette::PalQueryInterface"));
     
    110106//******************************************************************************
    111107//******************************************************************************
    112 ULONG __stdcall PalAddRef(THIS This)
     108ULONG WIN32API PalAddRef(THIS This)
    113109{
    114110  OS2IDirectDrawPalette *me = (OS2IDirectDrawPalette *)This;
     
    120116//******************************************************************************
    121117//******************************************************************************
    122 ULONG __stdcall PalRelease(THIS This)
     118ULONG WIN32API PalRelease(THIS This)
    123119{
    124120  OS2IDirectDrawPalette *me = (OS2IDirectDrawPalette *)This;
     
    142138//******************************************************************************
    143139//******************************************************************************
    144 HRESULT __stdcall PalGetCaps(THIS This, LPDWORD lpdwCaps)
     140HRESULT WIN32API PalGetCaps(THIS This, LPDWORD lpdwCaps)
    145141{
    146142  OS2IDirectDrawPalette *me = (OS2IDirectDrawPalette *)This;
     
    161157//******************************************************************************
    162158//******************************************************************************
    163 HRESULT __stdcall PalGetEntries(THIS This, DWORD dwFlags,
     159HRESULT WIN32API PalGetEntries(THIS This, DWORD dwFlags,
    164160                                      DWORD dwBase,
    165161                                      DWORD dwNumEntries,
     
    183179//******************************************************************************
    184180//******************************************************************************
    185 HRESULT __stdcall PalInitialize(THIS, LPDIRECTDRAW, DWORD, LPPALETTEENTRY)
     181HRESULT WIN32API PalInitialize(THIS, LPDIRECTDRAW, DWORD, LPPALETTEENTRY)
    186182{
    187183  dprintf(("DDRAW: OS2IDirectDrawPalette::PalInitialize"));
     
    190186//******************************************************************************
    191187//******************************************************************************
    192 HRESULT __stdcall PalSetEntries(THIS This, DWORD dwFlags,
     188HRESULT WIN32API PalSetEntries(THIS This, DWORD dwFlags,
    193189                                      DWORD dwBase,
    194190                                      DWORD dwNumEntries,
     
    274270//******************************************************************************
    275271//******************************************************************************
    276 
     272IDirectDrawPaletteVtbl DDrawPaletteTable =
     273{
     274  PalQueryInterface,
     275  PalAddRef,
     276  PalRelease,
     277  PalGetCaps,
     278  PalGetEntries,
     279  PalInitialize,
     280  PalSetEntries
     281};
     282//******************************************************************************
     283//******************************************************************************
  • trunk/src/ddraw/palette.h

    r9459 r9560  
    1 /* $Id: palette.h,v 1.1 2002-12-04 10:35:01 sandervl Exp $ */
     1/* $Id: palette.h,v 1.2 2002-12-29 14:11:02 sandervl Exp $ */
    22
    33/*
     
    6262  DWORD          dwSize;
    6363  BOOL           fAttachedToPrimary;
    64   friend    HRESULT __stdcall PalQueryInterface(THIS, REFIID riid, LPVOID FAR * ppvObj);
    65   friend    ULONG   __stdcall PalAddRef(THIS);
    66   friend    ULONG   __stdcall PalRelease(THIS);
    67   friend    HRESULT __stdcall PalGetCaps(THIS, LPDWORD);
    68   friend    HRESULT __stdcall PalGetEntries(THIS, DWORD,DWORD,DWORD,LPPALETTEENTRY);
    69   friend    HRESULT __stdcall PalInitialize(THIS, LPDIRECTDRAW, DWORD, LPPALETTEENTRY);
    70   friend    HRESULT __stdcall PalSetEntries(THIS, DWORD,DWORD,DWORD,LPPALETTEENTRY);
     64  friend    HRESULT WIN32API PalQueryInterface(THIS, REFIID riid, LPVOID FAR * ppvObj);
     65  friend    ULONG   WIN32API PalAddRef(THIS);
     66  friend    ULONG   WIN32API PalRelease(THIS);
     67  friend    HRESULT WIN32API PalGetCaps(THIS, LPDWORD);
     68  friend    HRESULT WIN32API PalGetEntries(THIS, DWORD,DWORD,DWORD,LPPALETTEENTRY);
     69  friend    HRESULT WIN32API PalInitialize(THIS, LPDIRECTDRAW, DWORD, LPPALETTEENTRY);
     70  friend    HRESULT WIN32API PalSetEntries(THIS, DWORD,DWORD,DWORD,LPPALETTEENTRY);
    7171};
    7272
    7373
    74 HRESULT __stdcall PalQueryInterface(THIS, REFIID riid, LPVOID FAR * ppvObj);
    75 ULONG   __stdcall PalAddRef(THIS);
    76 ULONG   __stdcall PalRelease(THIS);
    77 HRESULT __stdcall PalGetCaps(THIS, LPDWORD);
    78 HRESULT __stdcall PalGetEntries(THIS, DWORD,DWORD,DWORD,LPPALETTEENTRY);
    79 HRESULT __stdcall PalInitialize(THIS, LPDIRECTDRAW, DWORD, LPPALETTEENTRY);
    80 HRESULT __stdcall PalSetEntries(THIS, DWORD,DWORD,DWORD,LPPALETTEENTRY);
     74HRESULT WIN32API PalQueryInterface(THIS, REFIID riid, LPVOID FAR * ppvObj);
     75ULONG   WIN32API PalAddRef(THIS);
     76ULONG   WIN32API PalRelease(THIS);
     77HRESULT WIN32API PalGetCaps(THIS, LPDWORD);
     78HRESULT WIN32API PalGetEntries(THIS, DWORD,DWORD,DWORD,LPPALETTEENTRY);
     79HRESULT WIN32API PalInitialize(THIS, LPDIRECTDRAW, DWORD, LPPALETTEENTRY);
     80HRESULT WIN32API PalSetEntries(THIS, DWORD,DWORD,DWORD,LPPALETTEENTRY);
    8181
    8282
  • trunk/src/ddraw/surface.cpp

    r9462 r9560  
    1 /* $Id: surface.cpp,v 1.2 2002-12-04 15:21:42 sandervl Exp $ */
     1/* $Id: surface.cpp,v 1.3 2002-12-29 14:11:02 sandervl Exp $ */
    22
    33/*
     
    4747#endif
    4848
    49 
     49extern IDirectDrawSurface4Vtbl DDrawSurfaceV4Table;
     50extern IDirectDrawSurface3Vtbl DDrawSurfaceV3Table;
     51extern IDirectDrawSurface2Vtbl DDrawSurfaceV2Table;
    5052
    5153//******************************************************************************
     
    7375  lpVtbl2                    = &Vtbl2;
    7476  dwUnknownData              = 0xDEADDEAD;
    75   Vtbl.AddRef                = SurfAddRef;
    76   Vtbl.Release               = SurfRelease;
    77   Vtbl.QueryInterface        = SurfQueryInterface;
    78   Vtbl.AddAttachedSurface    = SurfAddAttachedSurface4;
    79   Vtbl.AddOverlayDirtyRect   = SurfAddOverlayDirtyRect;
    80   Vtbl.Blt                   = SurfBlt4;
    81   Vtbl.BltBatch              = SurfBltBatch;
    82   Vtbl.BltFast               = SurfBltFast4;
    83   Vtbl.DeleteAttachedSurface = SurfDeleteAttachedSurface4;
    84   Vtbl.EnumAttachedSurfaces  = SurfEnumAttachedSurfaces4;
    85   Vtbl.EnumOverlayZOrders    = SurfEnumOverlayZOrders4;
    86   Vtbl.Flip                  = SurfFlip4;
    87   Vtbl.GetAttachedSurface    = SurfGetAttachedSurface4;
    88   Vtbl.GetBltStatus          = SurfGetBltStatus;
    89   Vtbl.GetCaps               = SurfGetCaps4;
    90   Vtbl.GetClipper            = SurfGetClipper;
    91   Vtbl.GetColorKey           = SurfGetColorKey;
    92   Vtbl.GetDC                 = SurfGetDC;
    93   Vtbl.GetFlipStatus         = SurfGetFlipStatus;
    94   Vtbl.GetOverlayPosition    = SurfGetOverlayPosition;
    95   Vtbl.GetPalette            = SurfGetPalette;
    96   Vtbl.GetPixelFormat        = SurfGetPixelFormat;
    97   Vtbl.GetSurfaceDesc        = SurfGetSurfaceDesc4;
    98   Vtbl.Initialize            = SurfInitialize4;
    99   Vtbl.IsLost                = SurfIsLost;
    100   Vtbl.Lock                  = SurfLock4;
    101   Vtbl.ReleaseDC             = SurfReleaseDC;
    102   Vtbl.Restore               = SurfRestore;
    103   Vtbl.SetClipper            = SurfSetClipper;
    104   Vtbl.SetColorKey           = SurfSetColorKey;
    105   Vtbl.SetOverlayPosition    = SurfSetOverlayPosition;
    106   Vtbl.SetPalette            = SurfSetPalette;
    107   Vtbl.Unlock                = SurfUnlock4;
    108   Vtbl.UpdateOverlay         = SurfUpdateOverlay4;
    109   Vtbl.UpdateOverlayDisplay  = SurfUpdateOverlayDisplay;
    110   Vtbl.UpdateOverlayZOrder   = SurfUpdateOverlayZOrder4;
    111   Vtbl.GetDDInterface        = SurfGetDDInterface;
    112   Vtbl.PageLock              = SurfPageLock;
    113   Vtbl.PageUnlock            = SurfPageUnlock;
    114   Vtbl.SetSurfaceDesc        = SurfSetSurfaceDesc4;
    115   Vtbl.SetPrivateData        = SurfSetPrivateData;
    116   Vtbl.GetPrivateData        = SurfGetPrivateData;
    117   Vtbl.FreePrivateData       = SurfFreePrivateData;
    118   Vtbl.ChangeUniquenessValue = SurfChangeUniquenessValue;
    119   Vtbl.GetUniquenessValue    = SurfGetUniquenessValue;
    120 
    121   Vtbl3.AddRef                = SurfAddRef;
    122   Vtbl3.Release               = SurfRelease;
    123   Vtbl3.QueryInterface        = SurfQueryInterface;
    124   Vtbl3.AddAttachedSurface    = SurfAddAttachedSurface3;
    125   Vtbl3.AddOverlayDirtyRect   = SurfAddOverlayDirtyRect;
    126   Vtbl3.Blt                   = SurfBlt3;
    127   Vtbl3.BltBatch              = SurfBltBatch;
    128   Vtbl3.BltFast               = SurfBltFast3;
    129   Vtbl3.DeleteAttachedSurface = SurfDeleteAttachedSurface3;
    130   Vtbl3.EnumAttachedSurfaces  = SurfEnumAttachedSurfaces;
    131   Vtbl3.EnumOverlayZOrders    = SurfEnumOverlayZOrders;
    132   Vtbl3.Flip                  = SurfFlip3;
    133   Vtbl3.GetAttachedSurface    = SurfGetAttachedSurface3;
    134   Vtbl3.GetBltStatus          = SurfGetBltStatus;
    135   Vtbl3.GetCaps               = SurfGetCaps;
    136   Vtbl3.GetClipper            = SurfGetClipper;
    137   Vtbl3.GetColorKey           = SurfGetColorKey;
    138   Vtbl3.GetDC                 = SurfGetDC;
    139   Vtbl3.GetFlipStatus         = SurfGetFlipStatus;
    140   Vtbl3.GetOverlayPosition    = SurfGetOverlayPosition;
    141   Vtbl3.GetPalette            = SurfGetPalette;
    142   Vtbl3.GetPixelFormat        = SurfGetPixelFormat;
    143   Vtbl3.GetSurfaceDesc        = SurfGetSurfaceDesc;
    144   Vtbl3.Initialize            = SurfInitialize;
    145   Vtbl3.IsLost                = SurfIsLost;
    146   Vtbl3.Lock                  = SurfLock;
    147   Vtbl3.ReleaseDC             = SurfReleaseDC;
    148   Vtbl3.Restore               = SurfRestore;
    149   Vtbl3.SetClipper            = SurfSetClipper;
    150   Vtbl3.SetColorKey           = SurfSetColorKey;
    151   Vtbl3.SetOverlayPosition    = SurfSetOverlayPosition;
    152   Vtbl3.SetPalette            = SurfSetPalette;
    153   Vtbl3.Unlock                = SurfUnlock;
    154   Vtbl3.UpdateOverlay         = SurfUpdateOverlay3;
    155   Vtbl3.UpdateOverlayDisplay  = SurfUpdateOverlayDisplay;
    156   Vtbl3.UpdateOverlayZOrder   = SurfUpdateOverlayZOrder3;
    157   Vtbl3.GetDDInterface        = SurfGetDDInterface;
    158   Vtbl3.PageLock              = SurfPageLock;
    159   Vtbl3.PageUnlock            = SurfPageUnlock;
    160   Vtbl3.SetSurfaceDesc        = SurfSetSurfaceDesc;
    161 
    162   Vtbl2.AddRef                = SurfAddRef;
    163   Vtbl2.Release               = SurfRelease;
    164   Vtbl2.QueryInterface        = SurfQueryInterface;
    165   Vtbl2.AddAttachedSurface    = SurfAddAttachedSurface;
    166   Vtbl2.AddOverlayDirtyRect   = SurfAddOverlayDirtyRect;
    167   Vtbl2.Blt                   = SurfBlt;
    168   Vtbl2.BltBatch              = SurfBltBatch;
    169   Vtbl2.BltFast               = SurfBltFast;
    170   Vtbl2.DeleteAttachedSurface = SurfDeleteAttachedSurface;
    171   Vtbl2.EnumAttachedSurfaces  = SurfEnumAttachedSurfaces;
    172   Vtbl2.EnumOverlayZOrders    = SurfEnumOverlayZOrders;
    173   Vtbl2.Flip                  = SurfFlip;
    174   Vtbl2.GetAttachedSurface    = SurfGetAttachedSurface;
    175   Vtbl2.GetBltStatus          = SurfGetBltStatus;
    176   Vtbl2.GetCaps               = SurfGetCaps;
    177   Vtbl2.GetClipper            = SurfGetClipper;
    178   Vtbl2.GetColorKey           = SurfGetColorKey;
    179   Vtbl2.GetDC                 = SurfGetDC;
    180   Vtbl2.GetFlipStatus         = SurfGetFlipStatus;
    181   Vtbl2.GetOverlayPosition    = SurfGetOverlayPosition;
    182   Vtbl2.GetPalette            = SurfGetPalette;
    183   Vtbl2.GetPixelFormat        = SurfGetPixelFormat;
    184   Vtbl2.GetSurfaceDesc        = SurfGetSurfaceDesc;
    185   Vtbl2.Initialize            = SurfInitialize;
    186   Vtbl2.IsLost                = SurfIsLost;
    187   Vtbl2.Lock                  = SurfLock;
    188   Vtbl2.ReleaseDC             = SurfReleaseDC;
    189   Vtbl2.Restore               = SurfRestore;
    190   Vtbl2.SetClipper            = SurfSetClipper;
    191   Vtbl2.SetColorKey           = SurfSetColorKey;
    192   Vtbl2.SetOverlayPosition    = SurfSetOverlayPosition;
    193   Vtbl2.SetPalette            = SurfSetPalette;
    194   Vtbl2.Unlock                = SurfUnlock;
    195   Vtbl2.UpdateOverlay         = SurfUpdateOverlay;
    196   Vtbl2.UpdateOverlayDisplay  = SurfUpdateOverlayDisplay;
    197   Vtbl2.UpdateOverlayZOrder   = SurfUpdateOverlayZOrder;
    198   Vtbl2.GetDDInterface        = SurfGetDDInterface;
    199   Vtbl2.PageLock              = SurfPageLock;
    200   Vtbl2.PageUnlock            = SurfPageUnlock;
     77
     78  //copy DirectDraw V2, V3 & V4 tables
     79  Vtbl  = DDrawSurfaceV4Table;
     80  Vtbl3 = DDrawSurfaceV3Table;
     81  Vtbl2 = DDrawSurfaceV2Table;
    20182
    20283  lpDraw                     = lpDirectDraw;
     
    16821563//******************************************************************************
    16831564//******************************************************************************
    1684 HRESULT WIN32API SurfAddOverlayDirtyRect(THIS, LPRECT)
    1685 {
    1686   dprintf(("DDRAW: SurfAddOverlayDirtyRect Not implemented by M$ in DX 6.0!\n"));
    1687 
    1688   return(DD_OK);
    1689 }
    1690 //******************************************************************************
    1691 //******************************************************************************
    1692 HRESULT WIN32API SurfBlt(THIS This, LPRECT lpDestRect, LPDIRECTDRAWSURFACE2 lpDDSrcSurface,
    1693         LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
    1694 {
    1695  return SurfBlt4( This,
    1696                   lpDestRect,
    1697                   (LPDIRECTDRAWSURFACE4)lpDDSrcSurface,
    1698                   lpSrcRect,
    1699                   dwFlags,
    1700                   lpDDBltFx);
    1701 }
    1702 //******************************************************************************
    1703 //******************************************************************************
    1704 HRESULT WIN32API SurfBlt3(THIS This, LPRECT lpDestRect, LPDIRECTDRAWSURFACE3 lpDDSrcSurface,
    1705         LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
    1706 {
    1707  return SurfBlt4( This,
    1708                   lpDestRect,
    1709                   (LPDIRECTDRAWSURFACE4)lpDDSrcSurface,
    1710                   lpSrcRect,
    1711                   dwFlags,
    1712                   lpDDBltFx);
    1713 }
    1714 //******************************************************************************
    1715 //******************************************************************************
    1716 HRESULT WIN32API SurfBlt4(THIS This, LPRECT lpDestRect, LPDIRECTDRAWSURFACE4 lpDDSrcSurface,
    1717         LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
    1718 {
    1719  OS2IDirectDrawSurface *dest = (OS2IDirectDrawSurface *)This;
    1720  OS2IDirectDrawSurface *src  = (OS2IDirectDrawSurface *)lpDDSrcSurface;
    1721 
    1722  DDSURFACEDESC2  DestSurfaceDesc, SrcSurfaceDesc;
    1723  DDRectangle    *pIRectDest,*pIRectSrc,*pIRectTest;
    1724  RECT            DestRect, SrcRect;
    1725  BOOL            Found;
    1726  int             i;
    1727  HRESULT         ret = DD_OK;
    1728 
    1729     dprintf(("DDRAW: SurfBlt4 To Surf %08X, from Surf %08X\n",dest,src));
    1730     if ( (NULL!=lpDestRect)&& (NULL!=lpSrcRect))
    1731       dprintf(("DDRAW: SurfBlt4 to (%d,%d)(%d,%d) at %08X from (%d,%d)(%d,%d) at %08X\n", lpDestRect->left, lpDestRect->top,
    1732                lpDestRect->right, lpDestRect->bottom, dest, lpSrcRect->left, lpSrcRect->top,
    1733                lpSrcRect->right, lpSrcRect->bottom, src));
    1734 
    1735     _dump_DDBLT(dwFlags);
    1736 
    1737   if (NULL!=lpDestRect)
    1738   {
    1739     // HACK: RA does pass in negative values we might be better return an error,
    1740     //for now we clip
    1741 #define RA_HACK 1
    1742 
    1743 #ifdef RA_HACK
    1744     int top,left,bottom,right;
    1745 
    1746     top    = lpDestRect->top;
    1747     left   = lpDestRect->left;
    1748     bottom = lpDestRect->bottom;
    1749     right  = lpDestRect->right;
    1750 
    1751     if(top<0)
    1752     {
    1753       bottom += top;
    1754       top = 0;
    1755     }
    1756 
    1757     if(top > dest->height)
    1758       return DDERR_INVALIDPARAMS;
    1759 
    1760     if(bottom<0)
    1761       return DDERR_INVALIDPARAMS;
    1762 
    1763     if(bottom>dest->height)
    1764       bottom=dest->height;
    1765 
    1766     if(left<0)
    1767     {
    1768       right += left;
    1769       left = 0;
    1770     }
    1771 
    1772     if(left>dest->width)
    1773       return DDERR_INVALIDPARAMS;
    1774 
    1775     if(right<0)
    1776       return DDERR_INVALIDPARAMS;
    1777 
    1778     if(right>dest->width)
    1779        right = dest->width;
    1780 #endif    // RA_HACK
    1781 
    1782     pIRectDest = new DDRectangle( left, top, right, bottom);
    1783 #ifdef RA_HACK
    1784     DestRect.top    = top;
    1785     DestRect.left   = left;
    1786     DestRect.bottom = bottom;
    1787     DestRect.right  = right;
    1788 #else
    1789     memcpy(&DestRect,lpDestRect,sizeof(RECT) );
    1790 #endif //RA_HACK
    1791   }
    1792   else
    1793   {
    1794     pIRectDest = new DDRectangle( 0, 0, dest->width, dest->height);
    1795     DestRect.top    = 0;
    1796     DestRect.left   = 0;
    1797     DestRect.bottom = dest->height;
    1798     DestRect.right  = dest->width;
    1799   }
    1800 
    1801   if(dest->fLocked)
    1802   {
    1803     if (NULL==lpDestRect)
    1804     {
    1805       // If anything is locked we can't blit to the complete surface as
    1806       // a part is locked
    1807       Found = TRUE;
    1808     }
    1809     else
    1810     {
    1811       // If the dest Rectangle intersects with any of the locked rectangles
    1812       // we can't blit to it
    1813 
    1814       Found = FALSE;
    1815       i=0;
    1816       while( (i<DPA_GetPtrCount(dest->DPA_LockedRects))  && !Found)
    1817       {
    1818         pIRectTest = (DDRectangle*) DPA_FastGetPtr(dest->DPA_LockedRects,i);
    1819         Found = pIRectDest->intersects(*pIRectTest);
    1820         i++;
    1821       }
    1822 
    1823     }
    1824     if (Found)
    1825     {
    1826       delete pIRectDest;
    1827       dprintf(("DDRAW: Blt: Dest Surface partially locked\n"));
    1828       return(DDERR_SURFACEBUSY);
    1829     }
    1830   }
    1831   delete pIRectDest;
    1832 
    1833   //src == NULL for colorfill
    1834   if(src)
    1835   {
    1836    if (NULL!=lpSrcRect)
    1837    {
    1838 #ifdef RA_HACK
    1839     // Same as for dest rectangle now for src
    1840 
    1841     int top,left,bottom,right;
    1842 
    1843     top    = lpSrcRect->top;
    1844     left   = lpSrcRect->left;
    1845     bottom = lpSrcRect->bottom;
    1846     right  = lpSrcRect->right;
    1847 
    1848     if(top<0)
    1849     {
    1850       bottom += top;
    1851       top = 0;
    1852     }
    1853 
    1854     if(top > src->height)
    1855       return DDERR_INVALIDPARAMS;
    1856 
    1857     if(bottom<0)
    1858       return DDERR_INVALIDPARAMS;
    1859 
    1860     if(bottom>src->height)
    1861       bottom=src->height;
    1862 
    1863     if(left<0)
    1864     {
    1865       right += left;
    1866       left = 0;
    1867     }
    1868 
    1869     if(left>src->width)
    1870       return DDERR_INVALIDPARAMS;
    1871 
    1872     if(right<0)
    1873       return DDERR_INVALIDPARAMS;
    1874 
    1875     if(right>src->width)
    1876        right = src->width;
    1877 #endif    // RA_HACK
    1878 
    1879     pIRectSrc = new DDRectangle( left, top, right, bottom );
    1880 #ifdef RA_HACK
    1881     SrcRect.top    = top;
    1882     SrcRect.left   = left;
    1883     SrcRect.bottom = bottom;
    1884     SrcRect.right  = right;
    1885 #else
    1886     memcpy(&SrcRect,lpSrcRect,sizeof(RECT) );
    1887 #endif
    1888    }
    1889    else
    1890    {
    1891     pIRectSrc = new DDRectangle( 0, 0, src->width, src->height);
    1892     SrcRect.top    = 0;
    1893     SrcRect.left   = 0;
    1894     SrcRect.bottom = src->height;
    1895     SrcRect.right  = src->width;
    1896    }
    1897  
    1898    if(src->fLocked)
    1899    {
    1900     if (NULL==lpSrcRect)
    1901     {
    1902       // If anything is locked we can't blit from the complete surface as
    1903       // a part is locked
    1904       Found = TRUE;
    1905     }
    1906     else
    1907     {
    1908       // If the src Rectangle intersects with any of the locked rectangles of the
    1909       // source surface we can't blit from it
    1910 
    1911       Found = FALSE;
    1912       i=0;
    1913 
    1914       while((i<DPA_GetPtrCount(src->DPA_LockedRects) ) && !Found)
    1915       {
    1916         pIRectTest = (DDRectangle*) DPA_FastGetPtr(src->DPA_LockedRects,i);
    1917         Found = pIRectDest->intersects(*pIRectTest);
    1918         i++;
    1919       }
    1920 
    1921     }
    1922 
    1923     if (Found)
    1924     {
    1925       delete pIRectSrc;
    1926       dprintf(("DDRAW: Blt: Src Surface partly locked\n"));
    1927 
    1928       return(DDERR_SURFACEBUSY);
    1929     }
    1930    }
    1931    delete pIRectSrc;
    1932   } //if(src)
    1933 
    1934   if(dest->diveBufNr == DIVE_BUFFER_SCREEN &&
    1935      !(dwFlags & (DDBLT_COLORFILL|DDBLT_DEPTHFILL|DDBLT_ROP) ) &&
    1936      dest->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount > 8 &&
    1937      src->DDSurfaceDesc.ddpfPixelFormat.dwRGBBitCount > 8)
    1938   {
    1939       int rc, temp, fChanged = FALSE;
    1940       int destheight = RECT_HEIGHT(&DestRect);
    1941       int destwidth  = RECT_WIDTH(&DestRect);
    1942       int srcheight  = RECT_HEIGHT(&SrcRect);
    1943       int srcwidth   = RECT_WIDTH(&SrcRect);
    1944 
    1945       //if full surface blit or stretching blit, then use Dive
    1946       if( (src->DDSurfaceDesc.dwHeight == srcheight &&
    1947            src->DDSurfaceDesc.dwWidth  == srcwidth) ||
    1948           (srcwidth != destwidth && srcheight != destheight) ) 
    1949       {
    1950           SETUP_BLITTER          sBlt = {0};
    1951 
    1952           sBlt.ulStructLen       = sizeof(sBlt);
    1953           sBlt.fInvert           = 0;
    1954           sBlt.fccSrcColorFormat = src->DDSurfaceDesc.ddpfPixelFormat.dwFourCC;
    1955           sBlt.ulSrcWidth        = srcwidth;
    1956           sBlt.ulSrcHeight       = srcheight;
    1957           sBlt.ulSrcPosX         = SrcRect.left;
    1958           sBlt.ulSrcPosY         = src->DDSurfaceDesc.dwHeight-SrcRect.bottom;
    1959           sBlt.ulDitherType      = 0;
    1960           sBlt.fccDstColorFormat = dest->DDSurfaceDesc.ddpfPixelFormat.dwFourCC;
    1961           sBlt.ulDstWidth        = destwidth;
    1962           sBlt.ulDstHeight       = destheight;
    1963           sBlt.lDstPosX          = 0;
    1964           sBlt.lDstPosY          = 0;
    1965           sBlt.lScreenPosX       = DestRect.left;
    1966           sBlt.lScreenPosY       = dest->DDSurfaceDesc.dwHeight-DestRect.bottom;
    1967           sBlt.ulNumDstRects     = DIVE_FULLY_VISIBLE;
    1968           sBlt.pVisDstRects      = NULL;
    1969 
    1970           if(dest->lpClipper && dest->lpClipper->IsClipListChangedInt())
    1971           {
    1972               DWORD rgnsize;
    1973               if(ClipGetClipList((IDirectDrawClipper*)dest->lpClipper, NULL, NULL, &rgnsize) == DD_OK)
    1974               {
    1975                   LPRGNDATA lpRgnData = (LPRGNDATA)alloca(rgnsize);
    1976                   if(lpRgnData == NULL) {
    1977                       DebugInt3();
    1978                       goto dodiveblit;
    1979                   }
    1980                   if(ClipGetClipList((IDirectDrawClipper*)dest->lpClipper, NULL, lpRgnData, &rgnsize) == DD_OK)
    1981                   {
    1982                       OS2RECTL *pRectl = (OS2RECTL *)&lpRgnData->Buffer;
    1983 
    1984                       if(sBlt.ulNumDstRects == 0) {
    1985                           dprintf(("empty cliplist, return"));
    1986                           return DD_OK;
    1987                       }
    1988                       dprintf(("visible region"));
    1989                       for(i=0;i<lpRgnData->rdh.nCount;i++)
    1990                       {
    1991                           //win32 -> os2 coordinates (region data in screen coordinates)
    1992                           temp               = pRectl[i].yTop;
    1993                           pRectl[i].yTop     = src->lpDraw->GetScreenHeight() - pRectl[i].yBottom;
    1994                           pRectl[i].yBottom  = src->lpDraw->GetScreenHeight() - temp;
    1995                           dprintf(("(%d,%d)(%d,%d)", pRectl[i].xLeft, pRectl[i].yBottom, pRectl[i].xRight, pRectl[i].yTop));
    1996 
    1997                           //clip rectangle must be relative to lScreenPos
    1998                           pRectl[i].xLeft   -= sBlt.lScreenPosX;
    1999                           pRectl[i].xRight  -= sBlt.lScreenPosX;
    2000                           pRectl[i].yTop    -= sBlt.lScreenPosY;
    2001                           pRectl[i].yBottom -= sBlt.lScreenPosY;
    2002                           dprintf(("(%d,%d)(%d,%d)", pRectl[i].xLeft, pRectl[i].yBottom, pRectl[i].xRight, pRectl[i].yTop));
    2003                       }
    2004                       fChanged = TRUE;
    2005                       sBlt.ulNumDstRects = lpRgnData->rdh.nCount;
    2006                       sBlt.pVisDstRects  = (PRECTL)&lpRgnData->Buffer;
    2007                   }
    2008               }
    2009           }
    2010 dodiveblit:
    2011 #ifdef PERFTEST
    2012           QueryPerformanceCounter(&liStart);
    2013 #endif
    2014           if(fChanged || memcmp(&sBlt, &dest->sBlt, sizeof(sBlt)-sizeof(PRECTL)-sizeof(ULONG)))
    2015           {
    2016               dprintf(("Setting up blitter: src  (%d,%d)(%d,%d)", sBlt.ulSrcPosX, sBlt.ulSrcPosY, sBlt.ulSrcWidth, sBlt.ulSrcHeight));
    2017               dprintf(("Setting up blitter: dest (%d,%d)(%d,%d)", sBlt.lScreenPosX, sBlt.lScreenPosY, sBlt.ulDstWidth, sBlt.ulDstHeight));
    2018               rc = DiveSetupBlitter(dest->hDive, &sBlt);
    2019               if(rc) {
    2020                   dprintf(("DiveSetupBlitter returned %d", rc));
    2021                   return(DD_OK);
    2022               }
    2023               sBlt.ulNumDstRects     = DIVE_FULLY_VISIBLE;
    2024               sBlt.pVisDstRects      = NULL;
    2025               memcpy(&dest->sBlt, &sBlt, sizeof(sBlt));
    2026           }
    2027           dprintf(("DiveBlitImage %x %d->%d", dest->hDive, src->diveBufNr, dest->diveBufNr));
    2028           rc = DiveBlitImage(dest->hDive, src->diveBufNr, dest->diveBufNr);
    2029           if(rc) {
    2030               dprintf(("DiveBlitImage returned %d", rc));
    2031               return(DD_OK);
    2032           }
    2033 #ifdef PERFTEST
    2034           QueryPerformanceCounter(&liEnd);
    2035           if(liEnd.HighPart == liStart.HighPart) {
    2036               if(average == 0) {
    2037                     average = (liEnd.LowPart - liStart.LowPart);
    2038               }
    2039               else  average = (average + (liEnd.LowPart - liStart.LowPart))/2;
    2040           }
    2041 #endif
    2042           SurfChangeUniquenessValue(dest);
    2043           return DD_OK;
    2044       }
    2045   }
    2046 
    2047   //TODO: do we need to check the source for clipping information in case
    2048   //      the app wants to copy from the frame buffer?
    2049   if(dest->lpClipper)
    2050   {
    2051       DWORD rgnsize;
    2052       if(ClipGetClipList((IDirectDrawClipper*)dest->lpClipper, NULL, NULL, &rgnsize) == DD_OK)
    2053       {
    2054           LPRGNDATA lpRgnData = (LPRGNDATA)alloca(rgnsize);
    2055           if(lpRgnData == NULL) {
    2056               DebugInt3();
    2057               goto doblit;
    2058           }
    2059           if(ClipGetClipList((IDirectDrawClipper*)dest->lpClipper, NULL, lpRgnData, &rgnsize) == DD_OK)
    2060           {
    2061               RECT newdest, newsrc;
    2062               LPRECT lpClipRect = (LPRECT)&lpRgnData->Buffer;
    2063 
    2064 #ifdef PERFTEST
    2065               QueryPerformanceCounter(&liStart);
    2066 #endif
    2067               for(i=0;i<lpRgnData->rdh.nCount;i++)
    2068               {
    2069                   if(IntersectRect(&newdest, &DestRect, &lpClipRect[i]) == TRUE)
    2070                   {
    2071                       //TODO: This is not correct for stretching blits
    2072                       if(lpSrcRect) {
    2073                           newsrc.left   = SrcRect.left + (newdest.left - DestRect.left);
    2074                           newsrc.top    = SrcRect.top + (newdest.top - DestRect.top);
    2075                           newsrc.right  = newsrc.left + RECT_WIDTH(&newdest);
    2076                           newsrc.bottom = newsrc.top + RECT_HEIGHT(&newdest);
    2077                       }
    2078 //                      DDSURFACEDESC2 surfdesc = {0};
    2079 //                      SurfLock4(dest, &newdest, &surfdesc, 0, 0);
    2080    
    2081                       ret = SurfDoBlt(This, &newdest, lpDDSrcSurface, (lpSrcRect) ? &newsrc : NULL, dwFlags, lpDDBltFx);
    2082                       if(ret != DD_OK) {
    2083                           break;
    2084                       }
    2085 //                      SurfUnlock(dest, surfdesc.lpSurface);
    2086                   }
    2087               }
    2088 #ifdef PERFTEST
    2089               if(liEnd.HighPart == liStart.HighPart) {
    2090                   QueryPerformanceCounter(&liEnd);
    2091                   if(average == 0) {
    2092                         average = (liEnd.LowPart - liStart.LowPart);
    2093                   }
    2094                   else  average = (average + (liEnd.LowPart - liStart.LowPart))/2;
    2095               }
    2096 #endif
    2097 
    2098               return ret;
    2099           }
    2100       }
    2101   }
    2102 doblit:
    2103   return SurfDoBlt(This, &DestRect, lpDDSrcSurface, (lpSrcRect) ? &SrcRect : NULL, dwFlags, lpDDBltFx);
    2104 }
    2105 //******************************************************************************
    2106 //******************************************************************************
    2107 HRESULT WIN32API SurfDoBlt(THIS This, LPRECT lpDestRect, LPDIRECTDRAWSURFACE4 lpDDSrcSurface,
    2108                            LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx)
    2109 {
    2110    // We have determine between 3 different blit senarios.
    2111    // 1. Blitting between Divebuffers (Front/Backbuffer and primary surface)
    2112    // 2. Blitting between memory and Divebuffers (Front/Backbuffer and primary surface).
    2113    // 3. Blitting between memory buffers.
    2114    // 1 and 3 are easy. DiveBlitImage or memcpy will do the job for non transparent blits
    2115    // 2 is now also easy as we do colorconverion via Dive after each unlocking of a surface
    2116    // The advantage is that we don't have to call DiveSetupBlitter each time. The Blitter will be
    2117    // setup only when the screen resolution is changed by ddraw. I guess we should see a big performance
    2118    // increase by doing it this way, unless the software blits directly from memory to the primary surface)
    2119    // But even then this could be faster as the SetupBlitter call is timeconsumeing and DIVE does emulate
    2120    // the blit in SW anyway as there is no interface in the driver to blit with HW support from the sysmem.
    2121 
    2122  OS2IDirectDrawSurface *dest = (OS2IDirectDrawSurface *)This;
    2123  OS2IDirectDrawSurface *src  = (OS2IDirectDrawSurface *)lpDDSrcSurface;
    2124 
    2125  int                    x, i, BlitWidth, BlitHeight;
    2126  char                  *pBltPos, *pSrcPos;
    2127  DDSURFACEDESC2         DestSurfaceDesc, SrcSurfaceDesc;
    2128  BOOL Found;
    2129  DWORD dwSrcColor, dwDestColor;
    2130 
    2131   dprintf(("DDRAW: SurfDoBlt To Surf %08X, from Surf %08X\n",dest,src));
    2132   if ( (NULL!=lpDestRect)&& (NULL!=lpSrcRect))
    2133       dprintf(("DDRAW: SurfDoBlt to (%d,%d)(%d,%d) at %08X from (%d,%d)(%d,%d) at %08X\n", lpDestRect->left, lpDestRect->top,
    2134                lpDestRect->right, lpDestRect->bottom, dest, lpSrcRect->left, lpSrcRect->top,
    2135                lpSrcRect->right, lpSrcRect->bottom, src));
    2136 
    2137   DestSurfaceDesc.dwSize = sizeof(DDSURFACEDESC2);
    2138   SrcSurfaceDesc.dwSize = sizeof(DDSURFACEDESC2);
    2139 
    2140   // First check the simple first
    2141 
    2142   dwFlags &= ~(DDBLT_WAIT|DDBLT_ASYNC); // FIXME: can't handle right now
    2143 
    2144   if(dwFlags & DDBLT_COLORFILL)
    2145   {
    2146     dprintf(("DDRAW: ColorFill\n"));
    2147     if((NULL==lpDDBltFx)||(lpDDBltFx->dwSize!=sizeof(DDBLTFX)) )
    2148       return DDERR_INVALIDPARAMS;
    2149 
    2150     dest->DoColorFill(lpDestRect,lpDDBltFx->dwFillColor);
    2151 
    2152     return(DD_OK); // according to the M$ DDK only one flag shall/can be set.
    2153   } // end of colorfill
    2154 
    2155   if (dwFlags & DDBLT_DEPTHFILL)
    2156   {
    2157     dprintf(("DDRAW: DepthFill\n"));
    2158   #ifdef USE_OPENGL
    2159     GLboolean ztest;
    2160     // Todo support more than one Z-Buffer
    2161     // Clears the screen
    2162     dprintf(("DDRAW: Filling depth buffer with %ld\n", lpbltfx->b.dwFillDepth));
    2163     glClearDepth(lpDDBltFx->b.dwFillDepth / 65535.0); // We suppose a 16 bit Z Buffer
    2164     glGetBooleanv(GL_DEPTH_TEST, &ztest);
    2165     glDepthMask(GL_TRUE); // Enables Z writing to be sure to delete also the Z buffer
    2166     glClear(GL_DEPTH_BUFFER_BIT);
    2167     glDepthMask(ztest);
    2168 
    2169     return (DD_OK);
    2170   #endif // USE_OPENGL
    2171   }
    2172 
    2173   if(dwFlags & DDBLT_ROP)
    2174   {
    2175     // HEL and we only support the following ROPS
    2176     // SRC_COPY
    2177     // BLACKNESS
    2178     // WHITENESS
    2179     //
    2180     if(lpDDBltFx->dwROP & SRCCOPY)
    2181       dwFlags = 0;  // srccopy is a normal fast blt
    2182     else
    2183     {
    2184       if(lpDDBltFx->dwROP & BLACKNESS)
    2185       {
    2186         if(1==dest->dwBytesPPDive)
    2187         {
    2188           // ToDo: Realy implement code to get the correct index for black in 8 Bitmode
    2189           dest->DoColorFill(lpDestRect, 0 );
    2190         }
    2191         else
    2192           dest->DoColorFill(lpDestRect, 0);
    2193         return DD_OK;
    2194       }
    2195 
    2196       if(lpDDBltFx->dwROP & WHITENESS)
    2197       {
    2198         if(1==dest->dwBytesPPDive)
    2199         {
    2200           // ToDo: Realy implement code to get the correct index for white in 8 Bitmode
    2201           dest->DoColorFill(lpDestRect, 0xFFFFFFFF );
    2202         }
    2203         else
    2204           dest->DoColorFill(lpDestRect, 0xFFFFFFFF);
    2205         return (DD_OK);
    2206       }
    2207 
    2208       return DDERR_NORASTEROPHW;
    2209     }
    2210   }
    2211 
    2212   if(NULL==src)
    2213   {
    2214     dprintf(("DDRAW: Unsupported sourceless FX operation. Flags = 0x%04X\n",dwFlags));
    2215 
    2216     return DD_OK;
    2217   }
    2218 
    2219   if( ( (NULL==lpDestRect) && (NULL!=lpSrcRect) ) ||
    2220       ( (NULL==lpSrcRect) && (NULL!=lpDestRect) ) )
    2221   {
    2222     dprintf(("DDRAW: Blitting with scaling\n Not supported.\n"));
    2223 
    2224     return DDERR_NOSTRETCHHW;
    2225   }
    2226 
    2227   if( ( RECT_WIDTH(lpDestRect)  != RECT_WIDTH(lpSrcRect) ) ||
    2228       ( RECT_HEIGHT(lpDestRect) != RECT_HEIGHT(lpSrcRect) )
    2229     )
    2230   {
    2231     // Stretching not supported
    2232     dprintf(("DDRAW: No stretched blits\n"));
    2233 
    2234     return DDERR_NOSTRETCHHW;
    2235   }
    2236 
    2237   if (dest->DDSurfaceDesc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
    2238   {
    2239     dprintf(("DDRAW: Dest is Primary Surface\n"));
    2240     if(src->DDSurfaceDesc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
    2241     {
    2242       // special Type 1 : Bliting between parts of the screen
    2243 
    2244       dprintf(("DDRAW: Src is Primary Surface\n"));
    2245 
    2246       if( RECT_EQUAL(lpDestRect, lpSrcRect))
    2247         return DD_OK; // rects are the same => no blit needed
    2248 
    2249       // Todo: might add transparent blits but I don't think they are used here, so later!
    2250 
    2251       MoveRects( dest->pDiveBuffer,
    2252                  lpDestRect,
    2253                  lpSrcRect,
    2254                  dest->dwBytesPPDive,
    2255                  dest->dwPitchDB);
    2256       // MoveRects in framebuufer if we use colorconversion
    2257       if(dest->pFrameBuffer != dest->pDiveBuffer)
    2258       {
    2259         MoveRects( dest->pFrameBuffer,
    2260                    lpDestRect,
    2261                    lpSrcRect,
    2262                    dest->lpDraw->GetScreenBpp()>>3,
    2263                    dest->dwPitchFB);
    2264       }
    2265 
    2266       // End of Special Type 1 blitting on the screen
    2267     }
    2268     else
    2269     {
    2270       if( src->diveBufNr>0)
    2271       {
    2272         dprintf(("DDRAW: DIVE Blit of all"));
    2273         if( (NULL==lpSrcRect)&&( NULL== lpDestRect))
    2274         {
    2275           // No Rectangles so use Dive to blit everything
    2276           // ToDo : Implement transparent blitting but that seams more
    2277           //        inportant for partial blits.
    2278           //        If we do this later we could skip this check and don't
    2279           //        use Dive .This keeps our simpler and smaler
    2280           //
    2281           DiveBlitImage(dest->hDive, src->diveBufNr, dest->diveBufNr);
    2282 
    2283         }
    2284       }
    2285 
    2286       // Everything else we do yourselfs
    2287       // Type 2 Sysmem to Primarysurface ca also be handled by this
    2288 
    2289       if(!dwFlags)
    2290       {
    2291         dprintf(("DDRAW: Solid Blit\n"));
    2292 
    2293         dest->BltSolid( dest->pDiveBuffer,
    2294                         dest->pFrameBuffer,
    2295                         lpDestRect->top,
    2296                         lpDestRect->left,
    2297                         dest->dwPitchDB,
    2298                         dest->dwPitchFB,
    2299                         src->pDiveBuffer,
    2300                         src->pFrameBuffer,
    2301                         lpSrcRect->top,
    2302                         lpSrcRect->left,
    2303                         RECT_WIDTH(lpDestRect),
    2304                         RECT_HEIGHT(lpDestRect),
    2305                         src->dwPitchDB,
    2306                         src->dwPitchFB
    2307                         );
    2308 
    2309       }
    2310       else
    2311       {
    2312         pBltPos = (char*) dest->pDiveBuffer + (lpDestRect->top * dest->dwPitchDB) +
    2313                   (lpDestRect->left * dest->dwBytesPPDive);
    2314 
    2315         pSrcPos = (char*) src->pDiveBuffer + (lpSrcRect->top * src->dwPitchDB) +
    2316                   (lpSrcRect->left * src->dwBytesPPDive);
    2317 
    2318         BlitHeight = RECT_HEIGHT(lpDestRect);
    2319         BlitWidth  = RECT_WIDTH(lpDestRect);
    2320         // Transparent Blit
    2321         if( (dwFlags &DDBLT_KEYSRC) || (dwFlags & DDBLT_KEYSRCOVERRIDE) )
    2322         {
    2323           dprintf(("DDRAW: Transparent src blit not done yet for primary!!"));
    2324         }
    2325         else
    2326         {
    2327           dprintf(("DDRAW: Unhandled Flags Destination colorkey ? 0x%04X",dwFlags));
    2328         }
    2329       }
    2330     } // end of handling blitting to primary
    2331   }  // end of target primary surface
    2332   else
    2333   {
    2334     if(0==src->diveBufNr)
    2335     {
    2336       // copy from the screen to a buffer
    2337 
    2338       if( (NULL==lpDestRect) &&
    2339           (NULL==lpSrcRect) &&
    2340           (dest->diveBufNr>0) )
    2341       {
    2342         // Blitting everything from frontbuffer to a Divebuffer
    2343         // ToDo: Might should add checking for flags here
    2344         DiveBlitImage(dest->hDive, src->diveBufNr, dest->diveBufNr);
    2345       }
    2346       else
    2347       {
    2348         // DIVE => DIVE  or Mem => Dive
    2349         // or a rectangle from streen to a buffer can be handelt in the same way
    2350         pBltPos = (char*) dest->pDiveBuffer + (lpDestRect->top * dest->dwPitchDB) +
    2351                   (lpDestRect->left * dest->dwBytesPPDive);
    2352 
    2353         pSrcPos = (char*) src->pDiveBuffer + (lpSrcRect->top * src->dwPitchDB) +
    2354                   (lpSrcRect->left * src->dwBytesPPDive);
    2355 
    2356         BlitHeight = RECT_HEIGHT(lpDestRect);
    2357         BlitWidth  = RECT_WIDTH(lpDestRect);
    2358 
    2359         // Check for transparent blit
    2360         if(!dwFlags)
    2361         {
    2362           dest->BltSolid( dest->pDiveBuffer,
    2363                           dest->pFrameBuffer,
    2364                           lpDestRect->top,
    2365                           lpDestRect->left,
    2366                           dest->dwPitchDB,
    2367                           dest->dwPitchFB,
    2368                           src->pDiveBuffer,
    2369                           src->pFrameBuffer,
    2370                           lpSrcRect->top,
    2371                           lpSrcRect->left,
    2372                           RECT_WIDTH(lpDestRect),
    2373                           RECT_HEIGHT(lpDestRect),
    2374                           src->dwPitchDB,
    2375                           src->dwPitchFB
    2376                           );
    2377         }
    2378         else
    2379         {
    2380           dprintf(("DDRAW: Transblt not done yet"));
    2381           if(dwFlags & DDBLT_KEYSRC)
    2382           {
    2383             if(!(src->DDSurfaceDesc.dwFlags & DDCKEY_SRCBLT))
    2384             {
    2385             }
    2386           }
    2387           else
    2388           {
    2389             if(dwFlags & DDBLT_KEYSRCOVERRIDE)
    2390             {
    2391             }
    2392             else
    2393             {
    2394             }
    2395           }
    2396         }
    2397       }
    2398     } // end handling source screen
    2399     else
    2400     {
    2401       // DIVE => DIVE  or Mem => Dive can be handelt in the same way
    2402 
    2403       if( (src->pDiveBuffer == dest->pDiveBuffer) &&
    2404           (intersects(lpDestRect, lpSrcRect) ) )
    2405       {
    2406         // Overlapping rects  on the same surface ?
    2407 
    2408         // ToDo : Maybe implement all the fancy blit flags here too ? ;)
    2409 
    2410         MoveRects( dest->pDiveBuffer,
    2411                    lpDestRect,
    2412                    lpSrcRect,
    2413                    dest->dwBytesPPDive,
    2414                    dest->dwPitchDB);
    2415 
    2416         // MoveRects in framebuufer if we use colorconversion
    2417         if(dest->pFrameBuffer != dest->pDiveBuffer)
    2418         {
    2419           MoveRects( dest->pFrameBuffer,
    2420                      lpDestRect,
    2421                      lpSrcRect,
    2422                      dest->lpDraw->GetScreenBpp()>>3,
    2423                      dest->dwPitchFB);
    2424         }
    2425         return DD_OK;
    2426       }
    2427 
    2428       // Check for transparent blit
    2429       if(!dwFlags)
    2430       {
    2431         dest->BltSolid( dest->pDiveBuffer,
    2432                         dest->pFrameBuffer,
    2433                         lpDestRect->top,
    2434                         lpDestRect->left,
    2435                         dest->dwPitchDB,
    2436                         dest->dwPitchFB,
    2437                         src->pDiveBuffer,
    2438                         src->pFrameBuffer,
    2439                         lpSrcRect->top,
    2440                         lpSrcRect->left,
    2441                         RECT_WIDTH(lpDestRect),
    2442                         RECT_HEIGHT(lpDestRect),
    2443                         src->dwPitchDB,
    2444                         src->dwPitchFB
    2445                         );
    2446       }
    2447       else
    2448       {
    2449         pBltPos = (char*) dest->pDiveBuffer + (lpDestRect->top * dest->dwPitchDB) +
    2450                   (lpDestRect->left * dest->dwBytesPPDive);
    2451 
    2452         pSrcPos = (char*) src->pDiveBuffer + (lpSrcRect->top * src->dwPitchDB) +
    2453                   (lpSrcRect->left * src->dwBytesPPDive);
    2454 
    2455         BlitHeight = RECT_HEIGHT(lpDestRect);
    2456         BlitWidth  = RECT_WIDTH(lpDestRect);
    2457         DWORD dwPitch = dest->dwPitchDB;
    2458 
    2459         if(dwFlags &DDBLT_ROTATIONANGLE)
    2460         {
    2461           return DDERR_NOROTATIONHW;
    2462         }
    2463 
    2464         if(dwFlags & DDBLT_DDFX)
    2465         {
    2466           DWORD dwFx;
    2467 
    2468           dwFlags &= ~DDBLT_DDFX; // remove the handled flag
    2469 
    2470           if( NULL==lpDDBltFx)
    2471             return DDERR_INVALIDPARAMS;
    2472 
    2473           dwFx = lpDDBltFx->dwDDFX;
    2474 
    2475           // Remove unsupported Flags
    2476           dwFx &= ~(DDBLTFX_ARITHSTRETCHY |    // Not streach support
    2477                     DDBLTFX_ZBUFFERBASEDEST |  // All ZBuffer flags are not
    2478                     DDBLTFX_ZBUFFERRANGE |     // implementet in M$ Dx 6
    2479                     DDBLTFX_NOTEARING );       // No sync with VRetrace yet
    2480 
    2481           if(dwFx & DDBLTFX_ROTATE180)
    2482           {
    2483             // 180 degree turn is a mix of a flip up/down and one left/right
    2484             dwFx |= (DDBLTFX_MIRRORUPDOWN | DDBLTFX_MIRRORLEFTRIGHT);
    2485             dwFx &= ~DDBLTFX_ROTATE180; // remove handled flag
    2486           }
    2487           if(dwFx & DDBLTFX_MIRRORUPDOWN)
    2488           {
    2489             // switching the the direction can be integrated with other flags
    2490             dwPitch = -dwPitch;
    2491             pBltPos = (char*) dest->pDiveBuffer +
    2492                       ((lpDestRect->top +BlitHeight)* dest->dwPitchDB) +
    2493                       (lpDestRect->left * dest->dwBytesPPDive);
    2494 
    2495             dwFx &= ~DDBLTFX_MIRRORUPDOWN;  // remove handled flag
    2496           }
    2497 
    2498           if(dwFx & DDBLTFX_MIRRORLEFTRIGHT)
    2499           {
    2500             // 180 degree turn or a LR Mirroring
    2501             // don't support any other dwFlags like transparent at the moment
    2502 
    2503             switch(dest->dwBytesPPDive)
    2504             {
    2505               case 1:
    2506                 while(BlitHeight--)
    2507                 {
    2508                   x = BlitWidth;
    2509                   while(x)
    2510                   {
    2511                     pBltPos[BlitWidth-x] = pSrcPos[x];
    2512                     x--;
    2513                   }
    2514                   pBltPos += dwPitch;
    2515                   pSrcPos += src->dwPitchDB;
    2516                 }
    2517                 break;
    2518               case 2:
    2519                 while(BlitHeight--)
    2520                 {
    2521                   x = BlitWidth;
    2522                   while(x)
    2523                   {
    2524                     ((USHORT*)pBltPos)[BlitWidth-x] = ((USHORT*)pSrcPos)[x];
    2525                     x--;
    2526                   }
    2527                   pBltPos += dwPitch;
    2528                   pSrcPos += src->dwPitchDB;
    2529                 }
    2530                 break;
    2531               case 3:
    2532                 BlitWidth *= 3;
    2533                 while(BlitHeight--)
    2534                 {
    2535                   x = BlitWidth;
    2536                   while(x)
    2537                   {
    2538                     pBltPos[BlitWidth-x] = pSrcPos[x-2];
    2539                     x--;
    2540                     pBltPos[BlitWidth-x] = pSrcPos[x];
    2541                     x--;
    2542                     pBltPos[BlitWidth-x] = pSrcPos[x+2];
    2543                     x--;
    2544                   }
    2545                   pBltPos += dwPitch;
    2546                   pSrcPos += src->dwPitchDB;
    2547                 }
    2548                 break;
    2549               case 4:
    2550                 while(BlitHeight--)
    2551                 {
    2552                   x = BlitWidth;
    2553                   while(x)
    2554                   {
    2555                     ((DWORD*)pBltPos)[BlitWidth-x] = ((DWORD*)pSrcPos)[x];
    2556                     x--;
    2557                   }
    2558                   pBltPos += dwPitch;
    2559                   pSrcPos += src->dwPitchDB;
    2560                 }
    2561                 break;
    2562             }  // end switch
    2563             SurfChangeUniquenessValue(dest);
    2564             return DD_OK;
    2565           }
    2566 
    2567             if(dwFx)
    2568               _dump_DDBLTFX(dwFx);
    2569 
    2570           // We ignore unhandled flags at the moment
    2571         }
    2572 
    2573         if( (dwFlags & DDBLT_KEYSRC) |
    2574             (dwFlags & DDBLT_KEYSRCOVERRIDE) )
    2575         {
    2576           if(dwFlags & DDBLT_KEYSRCOVERRIDE)
    2577           {
    2578 
    2579             if( NULL==lpDDBltFx)
    2580               return DDERR_INVALIDPARAMS;
    2581 
    2582             dwFlags &= ~DDBLT_KEYSRCOVERRIDE;
    2583 
    2584             // We work like the HEL and test only the low value
    2585             dwSrcColor = lpDDBltFx->ddckSrcColorkey.dwColorSpaceLowValue;
    2586 
    2587           }
    2588           else
    2589           {
    2590 
    2591             dwFlags &= ~DDBLT_KEYSRC;
    2592 
    2593             // Not sure if that is OK maybe check if one is set ?
    2594             // if(!(src->DDSurfaceDesc.dwFlags & DDCKEY_SRCBLT)) return DDERR_WRONGPARAM;?
    2595 
    2596             dwSrcColor = src->DDSurfaceDesc.ddckCKSrcBlt.dwColorSpaceLowValue;
    2597           }
    2598 
    2599           // ToDo : We currently indicate that we don't support
    2600           // DDBLT_KEYDEST but HEL does change that!
    2601           // also add this key in the get/setColorKey functions
    2602 
    2603           if( (dwFlags & DDBLT_KEYDEST) |
    2604               (dwFlags & DDBLT_KEYDESTOVERRIDE) )
    2605           {
    2606             // Source and dest color keying SLOW!!!
    2607             if(dwFlags & DDBLT_KEYDESTOVERRIDE)
    2608             {
    2609               if( NULL==lpDDBltFx)
    2610                 return DDERR_INVALIDPARAMS;
    2611 
    2612               dwFlags &= ~DDBLT_KEYDESTOVERRIDE;
    2613 
    2614               // We work like the HEL and test only the low value
    2615               dwDestColor = lpDDBltFx->ddckDestColorkey.dwColorSpaceLowValue;
    2616 
    2617             }
    2618             else
    2619             {
    2620 
    2621               dwFlags &= ~DDBLT_KEYDEST;
    2622 
    2623               // Not sure if that is OK maybe check if one is set ?
    2624               // if(!(Dest->DDSurfaceDesc.dwFlags & DDCKEY_DESTBLT)) return DDERR_WRONGPARAM;?
    2625 
    2626               dwDestColor = dest->DDSurfaceDesc.ddckCKDestBlt.dwColorSpaceLowValue;
    2627             }
    2628 
    2629             // This will be be slow maybe move to ASM ?
    2630             // using MMX should be much faster
    2631             switch(dest->dwBytesPPDive)
    2632             {
    2633               case 1:
    2634                 while(BlitHeight--)
    2635                 {
    2636                   x = 0;
    2637                   while(x<BlitWidth)
    2638                   {
    2639                     if(pSrcPos[x] != (char) dwSrcColor)
    2640                     {
    2641                       if(pBltPos[x] != (char) dwDestColor)
    2642                         pBltPos[x] = pSrcPos[x];
    2643                     }
    2644                     x++;
    2645                   }
    2646                   pBltPos += dwPitch;
    2647                   pSrcPos += src->dwPitchDB;
    2648                 }
    2649                 break;
    2650               case 2:
    2651                 while(BlitHeight--)
    2652                 {
    2653                   x = 0;
    2654                   while(x<BlitWidth)
    2655                   {
    2656                     if(((USHORT*)pSrcPos)[x] != (USHORT) dwSrcColor)
    2657                     {
    2658                       if(((USHORT*)pBltPos)[x] != (USHORT) dwDestColor)
    2659                         ((USHORT*)pBltPos)[x] = ((USHORT*)pSrcPos)[x];
    2660                     }
    2661                     x++;
    2662                   }
    2663                   pBltPos += dwPitch;
    2664                   pSrcPos += src->dwPitchDB;
    2665                 }
    2666                 break;
    2667               case 3:
    2668               {
    2669                 char *pSC, *pDC;
    2670                 pSC = (char*)&dwSrcColor;
    2671                 pDC = (char*)&dwDestColor;
    2672                 BlitWidth *=3;
    2673 
    2674                 while(BlitHeight--)
    2675                 {
    2676                   x = 0;
    2677 
    2678                   while(x<BlitWidth)
    2679                   {
    2680                     if( (pSrcPos[x]   != pSC[1]) &&
    2681                         (pSrcPos[x+1] != pSC[2]) &&
    2682                         (pSrcPos[x+2] != pSC[3])
    2683                       )
    2684                     {
    2685                       if( (pBltPos[x]   != pDC[1]) &&
    2686                           (pBltPos[x+1] != pDC[2]) &&
    2687                           (pBltPos[x+2] != pDC[3])
    2688                         )
    2689                         {
    2690                           pBltPos[x] = pSrcPos[x];
    2691                           pBltPos[x+1] = pSrcPos[x+2];
    2692                           pBltPos[x+1] = pSrcPos[x+2];
    2693                         }
    2694                     }
    2695                     x +=3;
    2696                   }
    2697                   pBltPos += dwPitch;
    2698                   pSrcPos += src->dwPitchDB;
    2699                 }
    2700                 break;
    2701               }
    2702               case 4:
    2703                 while(BlitHeight--)
    2704                 {
    2705                   x = 0;
    2706                   while(x<BlitWidth)
    2707                   {
    2708                     if(((DWORD*)pSrcPos)[x] != dwSrcColor)
    2709                     {
    2710                       if(((DWORD*)pBltPos)[x] != dwDestColor)
    2711                         ((DWORD*)pBltPos)[x] = ((DWORD*)pSrcPos)[x];
    2712                     }
    2713                     x++;
    2714                   }
    2715                   pBltPos += dwPitch;
    2716                   pSrcPos += src->dwPitchDB;
    2717                 }
    2718                 break;
    2719             }  // End switch
    2720           }
    2721           else
    2722           {
    2723             // This will be be slow maybe move to ASM ?
    2724             // using MMX should be much faster
    2725             switch(dest->dwBytesPPDive)
    2726             {
    2727               case 1:
    2728                 while(BlitHeight--)
    2729                 {
    2730                   x = 0;
    2731                   while(x<BlitWidth)
    2732                   {
    2733                     if(pSrcPos[x] != (char) dwSrcColor)
    2734                     {
    2735                       pBltPos[x] = pSrcPos[x];
    2736                     }
    2737                     x++;
    2738                   }
    2739                   pBltPos += dwPitch;
    2740                   pSrcPos += src->dwPitchDB;
    2741                 }
    2742                 break;
    2743               case 2:
    2744                 while(BlitHeight--)
    2745                 {
    2746                   x = 0;
    2747                   while(x<BlitWidth)
    2748                   {
    2749                     if(((USHORT*)pSrcPos)[x] != (USHORT) dwSrcColor)
    2750                     {
    2751                       ((USHORT*)pBltPos)[x] = ((USHORT*)pSrcPos)[x];
    2752                     }
    2753                     x++;
    2754                   }
    2755                   pBltPos += dwPitch;
    2756                   pSrcPos += src->dwPitchDB;
    2757                 }
    2758                 break;
    2759               case 3:
    2760               {
    2761                 char *pSC, *pDC;
    2762                 pSC = (char*)&dwSrcColor;
    2763                 pDC = (char*)&dwDestColor;
    2764                 BlitWidth *=3;
    2765 
    2766                 while(BlitHeight--)
    2767                 {
    2768                   x = 0;
    2769 
    2770                   while(x<BlitWidth)
    2771                   {
    2772                     if( (pSrcPos[x]   != pSC[1]) &&
    2773                         (pSrcPos[x+1] != pSC[2]) &&
    2774                         (pSrcPos[x+2] != pSC[3])
    2775                       )
    2776                     {
    2777                        pBltPos[x] = pSrcPos[x];
    2778                        pBltPos[x+1] = pSrcPos[x+2];
    2779                        pBltPos[x+1] = pSrcPos[x+2];
    2780                     }
    2781                     x +=3;
    2782                   }
    2783                   pBltPos += dwPitch;
    2784                   pSrcPos += src->dwPitchDB;
    2785                 }
    2786                 break;
    2787               }
    2788               case 4:
    2789                 while(BlitHeight--)
    2790                 {
    2791                   x = 0;
    2792                   while(x<BlitWidth)
    2793                   {
    2794                     if(((DWORD*)pSrcPos)[x] != dwSrcColor)
    2795                     {
    2796                       ((DWORD*)pBltPos)[x] = ((DWORD*)pSrcPos)[x];
    2797                     }
    2798                     x++;
    2799                   }
    2800                   pBltPos += dwPitch;
    2801                   pSrcPos += src->dwPitchDB;
    2802                 }
    2803                 break;
    2804             }  // End switch
    2805             // Only Source colorkey
    2806           }
    2807           SurfChangeUniquenessValue(dest);
    2808           return DD_OK;
    2809         }
    2810 
    2811         if( (dwFlags & DDBLT_KEYDEST) |
    2812             (dwFlags & DDBLT_KEYDESTOVERRIDE) )
    2813         {
    2814           // Dest color keying SLOW!!!
    2815           if(dwFlags & DDBLT_KEYSRCOVERRIDE)
    2816           {
    2817             if( NULL==lpDDBltFx)
    2818               return DDERR_INVALIDPARAMS;
    2819 
    2820             dwFlags &= ~DDBLT_KEYSRCOVERRIDE;
    2821 
    2822             // We work like the HEL and test only the low value
    2823             dwDestColor = lpDDBltFx->ddckDestColorkey.dwColorSpaceLowValue;
    2824 
    2825           }
    2826           else
    2827           {
    2828 
    2829             dwFlags &= ~DDBLT_KEYDEST;
    2830 
    2831             // Not sure if that is OK maybe check if one is set ?
    2832             // if(!(src->DDSurfaceDesc.dwFlags & DDCKEY_DESTBLT)) return DDERR_WRONGPARAM;?
    2833 
    2834             dwDestColor = dest->DDSurfaceDesc.ddckCKDestBlt.dwColorSpaceLowValue;
    2835           }
    2836 
    2837           // This will be be slow maybe move to ASM ?
    2838           // using MMX should be much faster
    2839           switch(dest->dwBytesPPDive)
    2840           {
    2841             case 1:
    2842               while(BlitHeight--)
    2843               {
    2844                 x = 0;
    2845                 while(x<BlitWidth)
    2846                 {
    2847                   if(pBltPos[x] != (char) dwDestColor)
    2848                     pBltPos[x] = pSrcPos[x];
    2849                   x++;
    2850                 }
    2851                 pBltPos += dwPitch;
    2852                 pSrcPos += src->dwPitchDB;
    2853               }
    2854               break;
    2855             case 2:
    2856               while(BlitHeight--)
    2857               {
    2858                 x = 0;
    2859                 while(x<BlitWidth)
    2860                 {
    2861                   if(((USHORT*)pBltPos)[x] != (USHORT) dwDestColor)
    2862                     ((USHORT*)pBltPos)[x] = ((USHORT*)pSrcPos)[x];
    2863                   x++;
    2864                 }
    2865                 pBltPos += dwPitch;
    2866                 pSrcPos += src->dwPitchDB;
    2867               }
    2868               break;
    2869             case 3:
    2870             {
    2871               char *pSC, *pDC;
    2872               pSC = (char*)&dwSrcColor;
    2873               pDC = (char*)&dwDestColor;
    2874               BlitWidth *=3;
    2875 
    2876               while(BlitHeight--)
    2877               {
    2878                 x = 0;
    2879 
    2880                 while(x<BlitWidth)
    2881                 {
    2882                   if( (pBltPos[x]   != pDC[1]) &&
    2883                       (pBltPos[x+1] != pDC[2]) &&
    2884                       (pBltPos[x+2] != pDC[3])
    2885                     )
    2886                   {
    2887                     pBltPos[x] = pSrcPos[x];
    2888                     pBltPos[x+1] = pSrcPos[x+2];
    2889                     pBltPos[x+1] = pSrcPos[x+2];
    2890                   }
    2891                   x +=3;
    2892                 }
    2893                 pBltPos += dwPitch;
    2894                 pSrcPos += src->dwPitchDB;
    2895               }
    2896               break;
    2897             }
    2898             case 4:
    2899               while(BlitHeight--)
    2900               {
    2901                 x = 0;
    2902                 while(x<BlitWidth)
    2903                 {
    2904                   if( ((DWORD*)pBltPos)[x] != dwDestColor)
    2905                     ((DWORD*)pBltPos)[x] = ((DWORD*)pSrcPos)[x];
    2906                   x++;
    2907                 }
    2908                 pBltPos += dwPitch;
    2909                 pSrcPos += src->dwPitchDB;
    2910               }
    2911               break;
    2912           }  // End switch
    2913         } // End of Dest ColorKey
    2914 
    2915 
    2916       }// end  handling dwFlags
    2917     } // End handling source not Framebuffer
    2918 
    2919   }// end handling destination not framebuffer
    2920 
    2921   SurfChangeUniquenessValue(dest);
    2922   return(DD_OK);
    2923 }
    2924 //******************************************************************************
    2925 //******************************************************************************
    2926 HRESULT WIN32API SurfBltBatch(THIS, LPDDBLTBATCH, DWORD, DWORD )
    2927 {
    2928   dprintf(("DDRAW: SurfBltBatch Not implemented by M$\n"));
    2929 
    2930   return(DD_OK);
    2931 }
    2932 //******************************************************************************
    2933 //******************************************************************************
    2934 HRESULT WIN32API SurfBltFast( THIS This ,
    2935                                DWORD dwX,
    2936                                DWORD dwY,
    2937                                LPDIRECTDRAWSURFACE2 lpDDSrcSurface,
    2938                                LPRECT lpSrcRect,
    2939                                DWORD dwTrans)
    2940 {
    2941   dprintf(("DDRAW: SurfBltFast=>"));
    2942   return SurfBltFast4( This,
    2943                        dwX,
    2944                        dwY,
    2945                        (LPDIRECTDRAWSURFACE4) lpDDSrcSurface,
    2946                        lpSrcRect,
    2947                        dwTrans);
    2948 }
    2949 //******************************************************************************
    2950 //******************************************************************************
    2951 HRESULT WIN32API SurfBltFast3(THIS This ,
    2952                                DWORD dwX,
    2953                                DWORD dwY,
    2954                                LPDIRECTDRAWSURFACE3 lpDDSrcSurface,
    2955                                LPRECT lpSrcRect,
    2956                                DWORD dwTrans)
    2957 {
    2958   dprintf(("DDRAW: SurfBltFast3=>"));
    2959   return SurfBltFast4( This,
    2960                        dwX,
    2961                        dwY,
    2962                        (LPDIRECTDRAWSURFACE4) lpDDSrcSurface,
    2963                        lpSrcRect,
    2964                        dwTrans);
    2965 }
    2966 //******************************************************************************
    2967 //******************************************************************************
    2968 HRESULT WIN32API SurfBltFast4( THIS This,
    2969                                 DWORD dwX,
    2970                                 DWORD dwY,
    2971                                 LPDIRECTDRAWSURFACE4 lpDDSrcSurface,
    2972                                 LPRECT lpSrcRect,
    2973                                 DWORD dwTrans)
    2974 {
    2975   OS2IDirectDrawSurface *dest = (OS2IDirectDrawSurface *)This;
    2976   OS2IDirectDrawSurface *src  = (OS2IDirectDrawSurface *)lpDDSrcSurface;
    2977   RECTL SrcRect;
    2978   char *pBltPos, *pSrcPos;
    2979   DWORD dwDestColor, dwSrcColor, BlitWidth, BlitHeight, x;
    2980 
    2981   dprintf(("DDRAW: SurfBltFast4 %08X at(%d/%d) onto %08X with flags %08X\n",src, dwX,dwY, dest, dwTrans));
    2982 
    2983   if( (NULL == lpDDSrcSurface) ||
    2984       ((LONG)dwX < 0) || ((LONG)dwY < 0) ||
    2985       (dwX > dest->width) ||
    2986       (dwY > dest->height))
    2987   {
    2988     dprintf(("DDRAW: Invalid Parameters %08X, %d %d", lpDDSrcSurface ,dest->width , dest->height));
    2989     return DDERR_INVALIDPARAMS;
    2990   }
    2991 
    2992   if (NULL != lpSrcRect)
    2993   {
    2994     memcpy(&SrcRect,lpSrcRect,sizeof(RECTL) );
    2995   }
    2996   else
    2997   {
    2998     SrcRect.top    = 0;
    2999     SrcRect.left   = 0;
    3000     SrcRect.bottom = src->height;
    3001     SrcRect.right  = src->width;
    3002   }
    3003 
    3004   // Todo: Test for locked src/dest
    3005 
    3006   pBltPos = (char*) dest->pDiveBuffer + (dwY * dest->dwPitchDB) +
    3007             (dwX * dest->dwBytesPPDive);
    3008 
    3009   pSrcPos = (char*) src->pDiveBuffer + (SrcRect.top * src->dwPitchDB) +
    3010             (SrcRect.left * src->dwBytesPPDive);
    3011 
    3012   BlitHeight = SrcRect.bottom - SrcRect.top;
    3013   BlitWidth  = (SrcRect.right - SrcRect.left) * src->dwBytesPPDive;
    3014 
    3015   // Remove unsupported wait flag
    3016   dwTrans &= ~DDBLTFAST_WAIT;
    3017 
    3018   if(DDBLTFAST_NOCOLORKEY == dwTrans )
    3019   {
    3020     dprintf(( "Solid Blit, %d bits => %d bytes per line\n",
    3021               (SrcRect.right - SrcRect.left),
    3022               BlitWidth) );
    3023     #ifdef USE_ASM
    3024       BltRec(pBltPos, pSrcPos, BlitWidth, BlitHeight,
    3025              dest->dwPitchDB,
    3026              src->dwPitchDB);
    3027     #else
    3028       // Solid Blit
    3029       while(1)
    3030       {
    3031         memcpy(pBltPos,pSrcPos,BlitWidth);
    3032         pBltPos += dest->dwPitchDB;
    3033         pSrcPos += src->dwPitchDB;
    3034         if(! (--BlitHeight))
    3035           break;
    3036       }
    3037     #endif
    3038 
    3039   }
    3040   else
    3041   {
    3042     dprintf(("DDRAW: TransBlit\n"));
    3043 
    3044     if(dwTrans & DDBLTFAST_SRCCOLORKEY)
    3045     {
    3046       dprintf(("DDRAW: Trans SRC\n"));
    3047       // transparent source
    3048       dwSrcColor = src->DDSurfaceDesc.ddckCKSrcBlt.dwColorSpaceLowValue;
    3049       if(dwTrans & DDBLTFAST_DESTCOLORKEY)
    3050       {
    3051         dprintf(("DDRAW: And Dest Colorkey"));
    3052         dwDestColor = dest->DDSurfaceDesc.ddckCKDestBlt.dwColorSpaceLowValue;
    3053         // Source and dest colorkeying
    3054         switch(dest->dwBytesPPDive)
    3055         {
    3056           case 1:
    3057             while(BlitHeight--)
    3058             {
    3059               x = 0;
    3060               while(x<BlitWidth)
    3061               {
    3062                 if(pSrcPos[x] != (char) dwSrcColor)
    3063                 {
    3064                   if(pBltPos[x] != (char) dwDestColor)
    3065                     pBltPos[x] = pSrcPos[x];
    3066                 }
    3067                 x++;
    3068               }
    3069               pBltPos += dest->dwPitchDB;
    3070               pSrcPos += src->dwPitchDB;
    3071             }
    3072             break;
    3073           case 2:
    3074             while(BlitHeight--)
    3075             {
    3076               x = 0;
    3077               while(x<BlitWidth)
    3078               {
    3079                 if(((USHORT*)pSrcPos)[x] != (USHORT) dwSrcColor)
    3080                 {
    3081                   if(((USHORT*)pBltPos)[x] != (USHORT) dwDestColor)
    3082                     ((USHORT*)pBltPos)[x] = ((USHORT*)pSrcPos)[x];
    3083                 }
    3084                 x++;
    3085               }
    3086               pBltPos += dest->dwPitchDB;
    3087               pSrcPos += src->dwPitchDB;
    3088             }
    3089             break;
    3090           case 3:
    3091           {
    3092             char *pSC, *pDC;
    3093             pSC = (char*)&dwSrcColor;
    3094             pDC = (char*)&dwDestColor;
    3095             BlitWidth *=3;
    3096 
    3097             while(BlitHeight--)
    3098             {
    3099               x = 0;
    3100 
    3101               while(x<BlitWidth)
    3102               {
    3103                 if( (pSrcPos[x]   != pSC[1]) &&
    3104                     (pSrcPos[x+1] != pSC[2]) &&
    3105                     (pSrcPos[x+2] != pSC[3])
    3106                   )
    3107                 {
    3108                   if( (pBltPos[x]   != pDC[1]) &&
    3109                       (pBltPos[x+1] != pDC[2]) &&
    3110                       (pBltPos[x+2] != pDC[3])
    3111                     )
    3112                     {
    3113                       pBltPos[x] = pSrcPos[x];
    3114                       pBltPos[x+1] = pSrcPos[x+2];
    3115                       pBltPos[x+1] = pSrcPos[x+2];
    3116                     }
    3117                 }
    3118                 x +=3;
    3119               }
    3120               pBltPos += dest->dwPitchDB;
    3121               pSrcPos += src->dwPitchDB;
    3122             }
    3123             break;
    3124           }
    3125           case 4:
    3126             while(BlitHeight--)
    3127             {
    3128               x = 0;
    3129               while(x<BlitWidth)
    3130               {
    3131                 if(((DWORD*)pSrcPos)[x] != dwSrcColor)
    3132                 {
    3133                   if(((DWORD*)pBltPos)[x] != dwDestColor)
    3134                     ((DWORD*)pBltPos)[x] = ((DWORD*)pSrcPos)[x];
    3135                 }
    3136                 x++;
    3137               }
    3138               pBltPos += dest->dwPitchDB;
    3139               pSrcPos += src->dwPitchDB;
    3140             }
    3141             break;
    3142         }  // End switch
    3143       }
    3144       else
    3145       {
    3146         // This MMX detection should be moved into OS2Draw
    3147         // and into the surface constructor a setup for blitting pointers
    3148         dprintf(("DDRAW: Only Src ColorKey"));
    3149         switch(dest->dwBytesPPDive)
    3150         {
    3151           case 1:
    3152             if (CPUHasMMX())
    3153               while (BlitHeight--)
    3154               {
    3155                 BlitColorKey8MMX((PBYTE)pBltPos,(PBYTE)pSrcPos,dwSrcColor,BlitWidth);
    3156                 pBltPos += dest->dwPitchDB;
    3157                 pSrcPos += src->dwPitchDB;
    3158               }
    3159             else
    3160               while (BlitHeight--)
    3161               {
    3162                 BlitColorKey8((PBYTE)pBltPos,(PBYTE)pSrcPos,dwSrcColor,BlitWidth);
    3163                 pBltPos += dest->dwPitchDB;
    3164                 pSrcPos += src->dwPitchDB;
    3165               }
    3166             break;
    3167           case 2:
    3168 
    3169             if (CPUHasMMX())
    3170               while(BlitHeight--)
    3171               {
    3172                 BlitColorKey16MMX((PBYTE)pBltPos,(PBYTE)pSrcPos,dwSrcColor,BlitWidth);
    3173                 pBltPos += dest->dwPitchDB;
    3174                 pSrcPos += src->dwPitchDB;
    3175               }
    3176             else
    3177               while(BlitHeight--)
    3178               {
    3179                 BlitColorKey16((PBYTE)pBltPos,(PBYTE)pSrcPos,dwSrcColor,BlitWidth);
    3180                 pBltPos += dest->dwPitchDB;
    3181                 pSrcPos += src->dwPitchDB;
    3182               }
    3183             break;
    3184           case 3:
    3185             char *pSC;
    3186             pSC = (char*)&dwSrcColor;
    3187             BlitWidth *=3;
    3188 
    3189             while(BlitHeight--)
    3190             {
    3191               x = 0;
    3192 
    3193               while(x<BlitWidth)
    3194               {
    3195                 if( (pSrcPos[x]   != pSC[1]) &&
    3196                     (pSrcPos[x+1] != pSC[2]) &&
    3197                     (pSrcPos[x+2] != pSC[3])
    3198                   )
    3199                 {
    3200                   pBltPos[x] = pSrcPos[x];
    3201                   pBltPos[x+1] = pSrcPos[x+1];
    3202                   pBltPos[x+1] = pSrcPos[x+2];
    3203                 }
    3204                 x +=3;
    3205               }
    3206               pBltPos += dest->dwPitchDB;
    3207               pSrcPos += src->dwPitchDB;
    3208             }
    3209             break;
    3210           case 4:
    3211             break;
    3212         }
    3213       }
    3214     }
    3215     else
    3216     {
    3217       if (dwTrans & DDBLTFAST_DESTCOLORKEY)
    3218       {
    3219         dprintf(("DDRAW: DestColorKey\n"));
    3220 
    3221         dwDestColor = dest->DDSurfaceDesc.ddckCKDestBlt.dwColorSpaceLowValue;
    3222         switch(dest->dwBytesPPDive)
    3223         {
    3224           case 1:
    3225             while(BlitHeight--)
    3226             {
    3227               x = 0;
    3228               while(x<BlitWidth)
    3229               {
    3230                 if(pBltPos[x] != (char) dwDestColor)
    3231                   pBltPos[x] = pSrcPos[x];
    3232                 x++;
    3233               }
    3234               pBltPos += dest->dwPitchDB;
    3235               pSrcPos += src->dwPitchDB;
    3236             }
    3237             break;
    3238           case 2:
    3239             while(BlitHeight--)
    3240             {
    3241               x = 0;
    3242               while(x<BlitWidth)
    3243               {
    3244                 if(((USHORT*)pBltPos)[x] != (USHORT) dwDestColor)
    3245                   ((USHORT*)pBltPos)[x] = ((USHORT*)pSrcPos)[x];
    3246                 x++;
    3247               }
    3248               pBltPos += dest->dwPitchDB;
    3249               pSrcPos += src->dwPitchDB;
    3250             }
    3251             break;
    3252           case 3:
    3253           {
    3254             char *pSC, *pDC;
    3255             pSC = (char*)&dwSrcColor;
    3256             pDC = (char*)&dwDestColor;
    3257             BlitWidth *=3;
    3258 
    3259             while(BlitHeight--)
    3260             {
    3261               x = 0;
    3262 
    3263               while(x<BlitWidth)
    3264               {
    3265                 if( (pBltPos[x]   != pDC[1]) &&
    3266                     (pBltPos[x+1] != pDC[2]) &&
    3267                     (pBltPos[x+2] != pDC[3])
    3268                   )
    3269                 {
    3270                   pBltPos[x] = pSrcPos[x];
    3271                   pBltPos[x+1] = pSrcPos[x+2];
    3272                   pBltPos[x+1] = pSrcPos[x+2];
    3273                 }
    3274                 x +=3;
    3275               }
    3276               pBltPos += dest->dwPitchDB;
    3277               pSrcPos += src->dwPitchDB;
    3278             }
    3279             break;
    3280           }
    3281           case 4:
    3282             while(BlitHeight--)
    3283             {
    3284               x = 0;
    3285               while(x<BlitWidth)
    3286               {
    3287                 if(((DWORD*)pBltPos)[x] != dwDestColor)
    3288                   ((DWORD*)pBltPos)[x] = ((DWORD*)pSrcPos)[x];
    3289                 x++;
    3290               }
    3291               pBltPos += dest->dwPitchDB;
    3292               pSrcPos += src->dwPitchDB;
    3293             }
    3294             break;
    3295         }  // End switch
    3296       }
    3297       else
    3298       {
    3299         dprintf(("DDRAW: Unexpected Flags"));
    3300       }
    3301     }
    3302   }
    3303 
    3304   // if(dest->lpVtbl == dest->Vtbl4)
    3305   //   dest->Vtbl4->ChangeUniquenessValue(dest);
    3306 
    3307   return DD_OK;
    3308 }
    3309 //******************************************************************************
    3310 //******************************************************************************
    33111565HRESULT WIN32API SurfDeleteAttachedSurface(THIS This, DWORD dwFlags, LPDIRECTDRAWSURFACE2 lpDDSurface)
    33121566{
     
    35351789    }
    35361790  }
    3537 
    3538   return(DD_OK);
    3539 }
    3540 //******************************************************************************
    3541 //******************************************************************************
    3542 HRESULT WIN32API SurfEnumOverlayZOrders(THIS, DWORD,LPVOID,LPDDENUMSURFACESCALLBACK)
    3543 {
    3544   dprintf(("DDRAW: SurfEnumOverlayZOrders\n"));
    3545 
    3546   return(DD_OK);
    3547 }
    3548 //******************************************************************************
    3549 //******************************************************************************
    3550 HRESULT WIN32API SurfEnumOverlayZOrders4(THIS, DWORD,LPVOID,LPDDENUMSURFACESCALLBACK2)
    3551 {
    3552   dprintf(("DDRAW: SurfEnumOverlayZOrders\n"));
    35531791
    35541792  return(DD_OK);
     
    40902328//******************************************************************************
    40912329//******************************************************************************
    4092 HRESULT WIN32API SurfGetOverlayPosition(THIS This, LPLONG lplX, LPLONG lplY)
    4093 {
    4094   OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    4095   dprintf(("DDRAW: SurfGetOverlayPosition\n"));
    4096 
    4097   // Maybe simply return dderr_notsupported as we retun a max overlay value of 0 in the caps ?
    4098 
    4099   if( (NULL==lplX) || (NULL==lplY))
    4100     return DDERR_INVALIDPARAMS;
    4101 
    4102   if(!(me->DDSurfaceDesc.ddsCaps.dwCaps & DDSCAPS_OVERLAY))
    4103     return DDERR_NOTAOVERLAYSURFACE;
    4104 
    4105   if(!(me->DDSurfaceDesc.ddsCaps.dwCaps & DDSCAPS_VISIBLE))
    4106     return DDERR_OVERLAYNOTVISIBLE;
    4107 
    4108   if(!me->fOverlayValid)
    4109     return DDERR_NOOVERLAYDEST;
    4110 
    4111   *lplX = me->lOverlayX;
    4112   *lplY = me->lOverlayY;
    4113 
    4114   return(DD_OK);
    4115 }
    4116 //******************************************************************************
    4117 //******************************************************************************
    41182330HRESULT WIN32API SurfGetPalette(THIS This, LPDIRECTDRAWPALETTE FAR *lplpPalette)
    41192331{
     
    45832795//******************************************************************************
    45842796//******************************************************************************
    4585 HRESULT WIN32API SurfSetOverlayPosition(THIS This, LONG lX, LONG lY)
    4586 {
    4587   OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This;
    4588 
    4589   dprintf(("DDRAW: SurfSetOverlayPosition\n"));
    4590 
    4591   if( (me->DDSurfaceDesc.dwFlags & DDSD_CAPS) &&
    4592       (me->DDSurfaceDesc.ddsCaps.dwCaps & DDSCAPS_OVERLAY) )
    4593   {
    4594     if(me->fOverlayValid)
    4595       return(DDERR_NOOVERLAYDEST);
    4596 
    4597     if(!(me->DDSurfaceDesc.dwFlags & DDSCAPS_VISIBLE))
    4598       return(DDERR_OVERLAYNOTVISIBLE);
    4599 
    4600     // ToDo: If we implement alignment restricions to the Overlay position
    4601     // check if the new values are OK otherwiese return DDERR_INVALIDPOSITION
    4602 
    4603     me->lOverlayX = lX;
    4604     me->lOverlayY = lY;
    4605     return(DD_OK);
    4606   }
    4607 
    4608   return(DDERR_NOTAOVERLAYSURFACE);
    4609 }
    4610 //******************************************************************************
    4611 //******************************************************************************
    46122797HRESULT WIN32API SurfSetPalette(THIS This, LPDIRECTDRAWPALETTE lpPalette)
    46132798{
     
    49413126
    49423127  return rc;
    4943 }
    4944 //******************************************************************************
    4945 //******************************************************************************
    4946 HRESULT WIN32API SurfUpdateOverlay(THIS This, LPRECT, LPDIRECTDRAWSURFACE2,LPRECT,DWORD, LPDDOVERLAYFX)
    4947 {
    4948   dprintf(("DDRAW: SurfUpdateOverlay\n"));
    4949   return(DD_OK);
    4950 }
    4951 //******************************************************************************
    4952 //******************************************************************************
    4953 HRESULT WIN32API SurfUpdateOverlay3(THIS This, LPRECT, LPDIRECTDRAWSURFACE3,LPRECT,DWORD, LPDDOVERLAYFX)
    4954 {
    4955   dprintf(("DDRAW: SurfUpdateOverlay\n"));
    4956   return(DD_OK);
    4957 }
    4958 //******************************************************************************
    4959 //******************************************************************************
    4960 HRESULT WIN32API SurfUpdateOverlay4(THIS, LPRECT, LPDIRECTDRAWSURFACE4,LPRECT,DWORD, LPDDOVERLAYFX)
    4961 {
    4962   dprintf(("DDRAW: SurfUpdateOverlay\n"));
    4963   return(DD_OK);
    4964 }
    4965 //******************************************************************************
    4966 //******************************************************************************
    4967 HRESULT WIN32API SurfUpdateOverlayDisplay(THIS, DWORD)
    4968 {
    4969   dprintf(("DDRAW: SurfUpdateOverlayDisplay\n"));
    4970   return(DD_OK);
    4971 }
    4972 //******************************************************************************
    4973 //******************************************************************************
    4974 HRESULT WIN32API SurfUpdateOverlayZOrder(THIS, DWORD, LPDIRECTDRAWSURFACE2)
    4975 {
    4976   dprintf(("DDRAW: SurfUpdateOverlayZOrder\n"));
    4977   return(DD_OK);
    4978 }
    4979 //******************************************************************************
    4980 //******************************************************************************
    4981 HRESULT WIN32API SurfUpdateOverlayZOrder3(THIS, DWORD, LPDIRECTDRAWSURFACE3)
    4982 {
    4983   dprintf(("DDRAW: SurfUpdateOverlayZOrder\n"));
    4984   return(DD_OK);
    4985 }
    4986 //******************************************************************************
    4987 //******************************************************************************
    4988 HRESULT WIN32API SurfUpdateOverlayZOrder4(THIS, DWORD, LPDIRECTDRAWSURFACE4)
    4989 {
    4990   dprintf(("DDRAW: SurfUpdateOverlayZOrder4\n"));
    4991   return(DD_OK);
    49923128}
    49933129//******************************************************************************
     
    54563592}
    54573593
    5458 
    5459 
     3594//******************************************************************************
     3595//******************************************************************************
     3596IDirectDrawSurface4Vtbl DDrawSurfaceV4Table =
     3597{
     3598 SurfQueryInterface,
     3599 SurfAddRef,
     3600 SurfRelease,
     3601 SurfAddAttachedSurface4,
     3602 SurfAddOverlayDirtyRect,
     3603 SurfBlt4,
     3604 SurfBltBatch,
     3605 SurfBltFast4,
     3606 SurfDeleteAttachedSurface4,
     3607 SurfEnumAttachedSurfaces4,
     3608 SurfEnumOverlayZOrders4,
     3609 SurfFlip4,
     3610 SurfGetAttachedSurface4,
     3611 SurfGetBltStatus,
     3612 SurfGetCaps4,
     3613 SurfGetClipper,
     3614 SurfGetColorKey,
     3615 SurfGetDC,
     3616 SurfGetFlipStatus,
     3617 SurfGetOverlayPosition,
     3618 SurfGetPalette,
     3619 SurfGetPixelFormat,
     3620 SurfGetSurfaceDesc4,
     3621 SurfInitialize4,
     3622 SurfIsLost,
     3623 SurfLock4,
     3624 SurfReleaseDC,
     3625 SurfRestore,
     3626 SurfSetClipper,
     3627 SurfSetColorKey,
     3628 SurfSetOverlayPosition,
     3629 SurfSetPalette,
     3630 SurfUnlock4,
     3631 SurfUpdateOverlay4,
     3632 SurfUpdateOverlayDisplay,
     3633 SurfUpdateOverlayZOrder4,
     3634 SurfGetDDInterface,
     3635 SurfPageLock,
     3636 SurfPageUnlock,
     3637 SurfSetSurfaceDesc4,
     3638 SurfSetPrivateData,
     3639 SurfGetPrivateData,
     3640 SurfFreePrivateData,
     3641 SurfGetUniquenessValue,
     3642 SurfChangeUniquenessValue
     3643};
     3644//******************************************************************************
     3645//******************************************************************************
     3646IDirectDrawSurface3Vtbl DDrawSurfaceV3Table =
     3647{
     3648 SurfQueryInterface,
     3649 SurfAddRef,
     3650 SurfRelease,
     3651 SurfAddAttachedSurface3,
     3652 SurfAddOverlayDirtyRect,
     3653 SurfBlt3,
     3654 SurfBltBatch,
     3655 SurfBltFast3,
     3656 SurfDeleteAttachedSurface3,
     3657 SurfEnumAttachedSurfaces,
     3658 SurfEnumOverlayZOrders,
     3659 SurfFlip3,
     3660 SurfGetAttachedSurface3,
     3661 SurfGetBltStatus,
     3662 SurfGetCaps,
     3663 SurfGetClipper,
     3664 SurfGetColorKey,
     3665 SurfGetDC,
     3666 SurfGetFlipStatus,
     3667 SurfGetOverlayPosition,
     3668 SurfGetPalette,
     3669 SurfGetPixelFormat,
     3670 SurfGetSurfaceDesc,
     3671 SurfInitialize,
     3672 SurfIsLost,
     3673 SurfLock,
     3674 SurfReleaseDC,
     3675 SurfRestore,
     3676 SurfSetClipper,
     3677 SurfSetColorKey,
     3678 SurfSetOverlayPosition,
     3679 SurfSetPalette,
     3680 SurfUnlock,
     3681 SurfUpdateOverlay3,
     3682 SurfUpdateOverlayDisplay,
     3683 SurfUpdateOverlayZOrder3,
     3684 SurfGetDDInterface,
     3685 SurfPageLock,
     3686 SurfPageUnlock,
     3687 SurfSetSurfaceDesc
     3688};
     3689//******************************************************************************
     3690//******************************************************************************
     3691IDirectDrawSurface2Vtbl DDrawSurfaceV2Table =
     3692{
     3693 SurfQueryInterface,
     3694 SurfAddRef,
     3695 SurfRelease,
     3696 SurfAddAttachedSurface,
     3697 SurfAddOverlayDirtyRect,
     3698 SurfBlt,
     3699 SurfBltBatch,
     3700 SurfBltFast,
     3701 SurfDeleteAttachedSurface,
     3702 SurfEnumAttachedSurfaces,
     3703 SurfEnumOverlayZOrders,
     3704 SurfFlip,
     3705 SurfGetAttachedSurface,
     3706 SurfGetBltStatus,
     3707 SurfGetCaps,
     3708 SurfGetClipper,
     3709 SurfGetColorKey,
     3710 SurfGetDC,
     3711 SurfGetFlipStatus,
     3712 SurfGetOverlayPosition,
     3713 SurfGetPalette,
     3714 SurfGetPixelFormat,
     3715 SurfGetSurfaceDesc,
     3716 SurfInitialize,
     3717 SurfIsLost,
     3718 SurfLock,
     3719 SurfReleaseDC,
     3720 SurfRestore,
     3721 SurfSetClipper,
     3722 SurfSetColorKey,
     3723 SurfSetOverlayPosition,
     3724 SurfSetPalette,
     3725 SurfUnlock,
     3726 SurfUpdateOverlay,
     3727 SurfUpdateOverlayDisplay,
     3728 SurfUpdateOverlayZOrder,
     3729 SurfGetDDInterface,
     3730 SurfPageLock,
     3731 SurfPageUnlock
     3732};
     3733//******************************************************************************
     3734//******************************************************************************
  • trunk/src/ddraw/surface.h

    r9459 r9560  
    1 /* $Id: surface.h,v 1.1 2002-12-04 10:35:02 sandervl Exp $ */
     1/* $Id: surface.h,v 1.2 2002-12-29 14:11:02 sandervl Exp $ */
    22
    33/*
     
    5555  //this one has to go first!
    5656  IDirectDrawSurface2Vtbl *lpVtbl;
    57   IDirectDrawSurface2Vtbl *lpVtbl2;         // 2nd Vtable pointer An other MS assumtion see below
     57  IDirectDrawSurface2Vtbl *lpVtbl2;         // 2nd Vtable pointer An other MS assumption see below
    5858//  IDirectDrawSurface4Vtbl *lpVtbl;
    59 //  IDirectDrawSurface4Vtbl *lpVtbl2;         // 2nd Vtable pointer An other MS assumtion see below
     59//  IDirectDrawSurface4Vtbl *lpVtbl2;         // 2nd Vtable pointer An other MS assumption see below
    6060  DWORD                    dwUnknownData;   // Pointer to unknown data set to DEADDEAD to indicate that we can't handle this
    6161  IDirectDrawSurface2Vtbl  Vtbl2;
Note: See TracChangeset for help on using the changeset viewer.