2 * Copyright 2000-2001 TransGaming Technologies Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef DDRAW_DSURFACE_MAIN_H_INCLUDED
20 #define DDRAW_DSURFACE_MAIN_H_INCLUDED
22 #include "ddraw_private.h"
24 /* Support for IDirectDrawSurface7::Set/Get/FreePrivateData. I don't think
25 * anybody uses it for much so a good implementation is optional. */
26 typedef struct PrivateData
28 struct PrivateData
* next
;
29 struct PrivateData
* prev
;
32 DWORD flags
; /* DDSPD_* */
33 DWORD uniqueness_value
;
44 extern ICOM_VTABLE(IDirectDrawGammaControl
) DDRAW_IDDGC_VTable
;
46 /* Non-interface functions */
48 Main_DirectDrawSurface_Construct(IDirectDrawSurfaceImpl
* This
,
50 const DDSURFACEDESC2
* pDDSD
);
51 void Main_DirectDrawSurface_ForceDestroy(IDirectDrawSurfaceImpl
* This
);
54 Main_DirectDrawSurface_final_release(IDirectDrawSurfaceImpl
* This
);
56 Main_DirectDrawSurface_late_allocate(IDirectDrawSurfaceImpl
* This
);
58 Main_DirectDrawSurface_attach(IDirectDrawSurfaceImpl
*This
,
59 IDirectDrawSurfaceImpl
*to
);
60 BOOL
Main_DirectDrawSurface_detach(IDirectDrawSurfaceImpl
*This
);
62 Main_DirectDrawSurface_lock_update(IDirectDrawSurfaceImpl
* This
,
63 LPCRECT pRect
, DWORD dwFlags
);
65 Main_DirectDrawSurface_unlock_update(IDirectDrawSurfaceImpl
* This
,
68 Main_DirectDrawSurface_lose_surface(IDirectDrawSurfaceImpl
* This
);
70 Main_DirectDrawSurface_set_palette(IDirectDrawSurfaceImpl
* This
,
71 IDirectDrawPaletteImpl
* pal
);
73 Main_DirectDrawSurface_update_palette(IDirectDrawSurfaceImpl
* This
,
74 IDirectDrawPaletteImpl
* pal
,
75 DWORD dwStart
, DWORD dwCount
,
76 LPPALETTEENTRY palent
);
78 Main_DirectDrawSurface_get_display_window(IDirectDrawSurfaceImpl
* This
);
81 Main_DirectDrawSurface_get_gamma_ramp(IDirectDrawSurfaceImpl
* This
,
83 LPDDGAMMARAMP lpGammaRamp
);
85 Main_DirectDrawSurface_set_gamma_ramp(IDirectDrawSurfaceImpl
* This
,
87 LPDDGAMMARAMP lpGammaRamp
);
89 BOOL
Main_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl
* front
,
90 IDirectDrawSurfaceImpl
* back
,
93 #define CHECK_LOST(This) \
95 if (This->lost) return DDERR_SURFACELOST; \
98 #define CHECK_TEXTURE(This) \
100 if (!(This->surface_desc.ddsCaps.dwCaps2 \
101 & DDSCAPS2_TEXTUREMANAGE)) \
102 return DDERR_INVALIDOBJECT; \
105 #define LOCK_OBJECT(This) do { } while (0)
106 #define UNLOCK_OBJECT(This) do { } while (0)
108 /* IDirectDrawSurface7 (partial) implementation */
110 Main_DirectDrawSurface_AddRef(LPDIRECTDRAWSURFACE7 iface
);
112 Main_DirectDrawSurface_Release(LPDIRECTDRAWSURFACE7 iface
);
114 Main_DirectDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface
, REFIID riid
,
117 Main_DirectDrawSurface_AddAttachedSurface(LPDIRECTDRAWSURFACE7 iface
,
118 LPDIRECTDRAWSURFACE7 pAttach
);
120 Main_DirectDrawSurface_AddOverlayDirtyRect(LPDIRECTDRAWSURFACE7 iface
,
123 Main_DirectDrawSurface_BltBatch(LPDIRECTDRAWSURFACE7 iface
,
124 LPDDBLTBATCH pBatch
, DWORD dwCount
,
127 Main_DirectDrawSurface_ChangeUniquenessValue(LPDIRECTDRAWSURFACE7 iface
);
129 Main_DirectDrawSurface_DeleteAttachedSurface(LPDIRECTDRAWSURFACE7 iface
,
131 LPDIRECTDRAWSURFACE7 pAttach
);
133 Main_DirectDrawSurface_EnumAttachedSurfaces(LPDIRECTDRAWSURFACE7 iface
,
135 LPDDENUMSURFACESCALLBACK7 cb
);
137 Main_DirectDrawSurface_EnumOverlayZOrders(LPDIRECTDRAWSURFACE7 iface
,
138 DWORD dwFlags
, LPVOID context
,
139 LPDDENUMSURFACESCALLBACK7 cb
);
141 Main_DirectDrawSurface_Flip(LPDIRECTDRAWSURFACE7 iface
,
142 LPDIRECTDRAWSURFACE7 override
, DWORD dwFlags
);
144 Main_DirectDrawSurface_FreePrivateData(LPDIRECTDRAWSURFACE7 iface
,
147 Main_DirectDrawSurface_GetAttachedSurface(LPDIRECTDRAWSURFACE7 iface
,
149 LPDIRECTDRAWSURFACE7
* ppSurface
);
151 Main_DirectDrawSurface_GetBltStatus(LPDIRECTDRAWSURFACE7 iface
,
154 Main_DirectDrawSurface_GetCaps(LPDIRECTDRAWSURFACE7 iface
,
157 Main_DirectDrawSurface_GetClipper(LPDIRECTDRAWSURFACE7 iface
,
158 LPDIRECTDRAWCLIPPER
* ppClipper
);
160 Main_DirectDrawSurface_GetColorKey(LPDIRECTDRAWSURFACE7 iface
,
161 DWORD dwFlags
, LPDDCOLORKEY pCKey
);
163 Main_DirectDrawSurface_GetDC(LPDIRECTDRAWSURFACE7 iface
, HDC
*phDC
);
165 Main_DirectDrawSurface_GetDDInterface(LPDIRECTDRAWSURFACE7 iface
,
168 Main_DirectDrawSurface_GetFlipStatus(LPDIRECTDRAWSURFACE7 iface
,
171 Main_DirectDrawSurface_GetLOD(LPDIRECTDRAWSURFACE7 iface
,
174 Main_DirectDrawSurface_GetOverlayPosition(LPDIRECTDRAWSURFACE7 iface
,
175 LPLONG pX
, LPLONG pY
);
177 Main_DirectDrawSurface_GetPalette(LPDIRECTDRAWSURFACE7 iface
,
178 LPDIRECTDRAWPALETTE
* ppPalette
);
180 Main_DirectDrawSurface_GetPixelFormat(LPDIRECTDRAWSURFACE7 iface
,
181 LPDDPIXELFORMAT pDDPixelFormat
);
183 Main_DirectDrawSurface_GetPriority(LPDIRECTDRAWSURFACE7 iface
,
184 LPDWORD pdwPriority
);
186 Main_DirectDrawSurface_GetPrivateData(LPDIRECTDRAWSURFACE7 iface
, REFGUID tag
,
187 LPVOID pBuffer
, LPDWORD pcbBufferSize
);
189 Main_DirectDrawSurface_GetSurfaceDesc(LPDIRECTDRAWSURFACE7 iface
,
190 LPDDSURFACEDESC2 pDDSD
);
192 Main_DirectDrawSurface_GetUniquenessValue(LPDIRECTDRAWSURFACE7 iface
,
195 Main_DirectDrawSurface_Initialize(LPDIRECTDRAWSURFACE7 iface
,
196 LPDIRECTDRAW pDD
, LPDDSURFACEDESC2 pDDSD
);
198 Main_DirectDrawSurface_IsLost(LPDIRECTDRAWSURFACE7 iface
);
200 Main_DirectDrawSurface_Lock(LPDIRECTDRAWSURFACE7 iface
, LPRECT prect
,
201 LPDDSURFACEDESC2 pDDSD
, DWORD flags
, HANDLE h
);
203 Main_DirectDrawSurface_PageLock(LPDIRECTDRAWSURFACE7 iface
, DWORD dwFlags
);
205 Main_DirectDrawSurface_PageUnlock(LPDIRECTDRAWSURFACE7 iface
, DWORD dwFlags
);
207 Main_DirectDrawSurface_ReleaseDC(LPDIRECTDRAWSURFACE7 iface
, HDC hDC
);
209 Main_DirectDrawSurface_SetClipper(LPDIRECTDRAWSURFACE7 iface
,
210 LPDIRECTDRAWCLIPPER pDDClipper
);
212 Main_DirectDrawSurface_SetColorKey(LPDIRECTDRAWSURFACE7 iface
,
213 DWORD dwFlags
, LPDDCOLORKEY pCKey
);
215 Main_DirectDrawSurface_SetLOD(LPDIRECTDRAWSURFACE7 iface
, DWORD dwMaxLOD
);
217 Main_DirectDrawSurface_SetOverlayPosition(LPDIRECTDRAWSURFACE7 iface
,
220 Main_DirectDrawSurface_SetPalette(LPDIRECTDRAWSURFACE7 iface
,
221 LPDIRECTDRAWPALETTE pPalette
);
223 Main_DirectDrawSurface_SetPriority(LPDIRECTDRAWSURFACE7 iface
,
226 Main_DirectDrawSurface_SetPrivateData(LPDIRECTDRAWSURFACE7 iface
,
227 REFGUID tag
, LPVOID pData
,
228 DWORD cbSize
, DWORD dwFlags
);
230 Main_DirectDrawSurface_Unlock(LPDIRECTDRAWSURFACE7 iface
, LPRECT pRect
);
232 Main_DirectDrawSurface_UpdateOverlay(LPDIRECTDRAWSURFACE7 iface
,
234 LPDIRECTDRAWSURFACE7 pDstSurface
,
235 LPRECT pDstRect
, DWORD dwFlags
,
238 Main_DirectDrawSurface_UpdateOverlayDisplay(LPDIRECTDRAWSURFACE7 iface
,
241 Main_DirectDrawSurface_UpdateOverlayZOrder(LPDIRECTDRAWSURFACE7 iface
,
243 LPDIRECTDRAWSURFACE7 pDDSRef
);