1 /* 2 * COPYRIGHT: See COPYING in the top level directory 3 * PROJECT: ReactOS kernel 4 * PURPOSE: Native DirectDraw implementation 5 * FILE: win32ss/reactx/ntddraw/ddsurf.c 6 * PROGRAMER: Magnus Olsen (greatlord@reactos.org) 7 * REVISION HISTORY: 8 * 19/7-2006 Magnus Olsen 9 */ 10 11 #include <win32k.h> 12 #include <debug.h> 13 14 /************************************************************************/ 15 /* NtGdiDdDestroySurface */ 16 /************************************************************************/ 17 DWORD 18 APIENTRY 19 NtGdiDdDestroySurface(HANDLE hSurface, BOOL bRealDestroy) 20 { 21 PGD_DXDDDESTROYSURFACE pfnDdDestroySurface = (PGD_DXDDDESTROYSURFACE)gpDxFuncs[DXG_INDEX_DxDdDestroySurface].pfn; 22 23 if (pfnDdDestroySurface == NULL) 24 { 25 DPRINT1("Warning: no pfnDdDestroySurface"); 26 return DDHAL_DRIVER_NOTHANDLED; 27 } 28 29 DPRINT1("Calling on dxg.sys pfnDdDestroySurface"); 30 return pfnDdDestroySurface(hSurface, bRealDestroy); 31 } 32 33 /************************************************************************/ 34 /* NtGdiDdFlip */ 35 /************************************************************************/ 36 DWORD 37 APIENTRY 38 NtGdiDdFlip(HANDLE hSurfaceCurrent, 39 HANDLE hSurfaceTarget, 40 HANDLE hSurfaceCurrentLeft, 41 HANDLE hSurfaceTargetLeft, 42 PDD_FLIPDATA puFlipData) 43 { 44 PGD_DXDDFLIP pfnDdDdFlip = (PGD_DXDDFLIP)gpDxFuncs[DXG_INDEX_DxDdFlip].pfn; 45 46 if (pfnDdDdFlip == NULL) 47 { 48 DPRINT1("Warning: no pfnDdDdFlip"); 49 return DDHAL_DRIVER_NOTHANDLED; 50 } 51 52 DPRINT1("Calling on dxg.sys pfnDdDdFlip"); 53 return pfnDdDdFlip(hSurfaceCurrent, hSurfaceTarget, hSurfaceCurrentLeft, hSurfaceTargetLeft, puFlipData); 54 } 55 56 /************************************************************************/ 57 /* NtGdiDdUnlock */ 58 /************************************************************************/ 59 DWORD 60 APIENTRY 61 NtGdiDdLock(HANDLE hSurface, 62 PDD_LOCKDATA puLockData, 63 HDC hdcClip) 64 { 65 PGD_DXDDLOCK pfnDdLock = (PGD_DXDDLOCK)gpDxFuncs[DXG_INDEX_DxDdLock].pfn; 66 67 if (pfnDdLock == NULL) 68 { 69 DPRINT1("Warning: no pfnDdLock"); 70 return DDHAL_DRIVER_NOTHANDLED; 71 } 72 73 DPRINT1("Calling on dxg.sys pfnDdLock"); 74 return pfnDdLock(hSurface, puLockData, hdcClip); 75 } 76 77 /************************************************************************/ 78 /* NtGdiDdunlock */ 79 /************************************************************************/ 80 DWORD 81 APIENTRY 82 NtGdiDdUnlock(HANDLE hSurface, 83 PDD_UNLOCKDATA puUnlockData) 84 { 85 PGD_DXDDUNLOCK pfnDdUnlock = (PGD_DXDDUNLOCK)gpDxFuncs[DXG_INDEX_DxDdUnlock].pfn; 86 87 if (pfnDdUnlock == NULL) 88 { 89 DPRINT1("Warning: no pfnDdUnlock"); 90 return DDHAL_DRIVER_NOTHANDLED; 91 } 92 93 DPRINT1("Calling on dxg.sys pfnDdUnlock"); 94 return pfnDdUnlock(hSurface, puUnlockData); 95 } 96 97 /************************************************************************/ 98 /* NtGdiDdBlt */ 99 /************************************************************************/ 100 DWORD 101 APIENTRY 102 NtGdiDdBlt(HANDLE hSurfaceDest, 103 HANDLE hSurfaceSrc, 104 PDD_BLTDATA puBltData) 105 { 106 PGD_DDBLT pfnDdBlt = (PGD_DDBLT)gpDxFuncs[DXG_INDEX_DxDdBlt].pfn; 107 108 if (pfnDdBlt == NULL) 109 { 110 DPRINT1("Warning: no pfnDdBlt"); 111 return DDHAL_DRIVER_NOTHANDLED; 112 } 113 114 DPRINT1("Calling on dxg.sys DdBlt"); 115 return pfnDdBlt(hSurfaceDest,hSurfaceSrc,puBltData); 116 } 117 118 /************************************************************************/ 119 /* NtGdiDdSetColorKey */ 120 /************************************************************************/ 121 DWORD 122 APIENTRY 123 NtGdiDdSetColorKey(HANDLE hSurface, 124 PDD_SETCOLORKEYDATA puSetColorKeyData) 125 { 126 PGD_DXDDSETCOLORKEY pfnDdSetColorKey = (PGD_DXDDSETCOLORKEY)gpDxFuncs[DXG_INDEX_DxDdSetColorKey].pfn; 127 128 if (pfnDdSetColorKey == NULL) 129 { 130 DPRINT1("Warning: no pfnDdSetColorKey"); 131 return DDHAL_DRIVER_NOTHANDLED; 132 } 133 134 DPRINT1("Calling on dxg.sys pfnDdSetColorKey"); 135 return pfnDdSetColorKey(hSurface,puSetColorKeyData); 136 137 } 138 139 /************************************************************************/ 140 /* NtGdiDdAddAttachedSurface */ 141 /************************************************************************/ 142 143 DWORD 144 APIENTRY 145 NtGdiDdAddAttachedSurface(HANDLE hSurface, 146 HANDLE hSurfaceAttached, 147 PDD_ADDATTACHEDSURFACEDATA puAddAttachedSurfaceData) 148 { 149 PGD_DDADDATTACHEDSURFACE pfnDdAddAttachedSurface = (PGD_DDADDATTACHEDSURFACE)gpDxFuncs[DXG_INDEX_DxDdAddAttachedSurface].pfn; 150 151 if (pfnDdAddAttachedSurface == NULL) 152 { 153 DPRINT1("Warning: no pfnDdAddAttachedSurface"); 154 return DDHAL_DRIVER_NOTHANDLED; 155 } 156 157 DPRINT1("Calling on dxg.sys DdAddAttachedSurface"); 158 return pfnDdAddAttachedSurface(hSurface,hSurfaceAttached,puAddAttachedSurfaceData); 159 } 160 161 /************************************************************************/ 162 /* NtGdiDdGetBltStatus */ 163 /************************************************************************/ 164 DWORD 165 APIENTRY 166 NtGdiDdGetBltStatus(HANDLE hSurface, 167 PDD_GETBLTSTATUSDATA puGetBltStatusData) 168 { 169 PGD_DXDDGETBLTSTATUS pfnDdGetBltStatus = (PGD_DXDDGETBLTSTATUS)gpDxFuncs[DXG_INDEX_DxDdGetBltStatus].pfn; 170 171 if (pfnDdGetBltStatus == NULL) 172 { 173 DPRINT1("Warning: no pfnDdGetBltStatus"); 174 return DDHAL_DRIVER_NOTHANDLED; 175 } 176 177 DPRINT1("Calling on dxg.sys pfnDdGetBltStatus"); 178 return pfnDdGetBltStatus(hSurface,puGetBltStatusData); 179 } 180 181 /************************************************************************/ 182 /* NtGdiDdGetFlipStatus */ 183 /************************************************************************/ 184 DWORD 185 APIENTRY 186 NtGdiDdGetFlipStatus(HANDLE hSurface, 187 PDD_GETFLIPSTATUSDATA puGetFlipStatusData) 188 { 189 PGD_DXDDGETFLIPSTATUS pfnDdGetFlipStatus = (PGD_DXDDGETFLIPSTATUS)gpDxFuncs[DXG_INDEX_DxDdGetFlipStatus].pfn; 190 191 if (pfnDdGetFlipStatus == NULL) 192 { 193 DPRINT1("Warning: no pfnDdGetFlipStatus"); 194 return DDHAL_DRIVER_NOTHANDLED; 195 } 196 197 DPRINT1("Calling on dxg.sys pfnDdGetFlipStatus"); 198 return pfnDdGetFlipStatus(hSurface,puGetFlipStatusData); 199 } 200 201 /************************************************************************/ 202 /* NtGdiDdUpdateOverlay */ 203 /************************************************************************/ 204 DWORD 205 APIENTRY 206 NtGdiDdUpdateOverlay(HANDLE hSurfaceDestination, 207 HANDLE hSurfaceSource, 208 PDD_UPDATEOVERLAYDATA puUpdateOverlayData) 209 { 210 PGD_DXDDUPDATEOVERLAY pfnDdUpdateOverlay = (PGD_DXDDUPDATEOVERLAY)gpDxFuncs[DXG_INDEX_DxDdUpdateOverlay].pfn; 211 212 if (pfnDdUpdateOverlay == NULL) 213 { 214 DPRINT1("Warning: no pfnDdUpdateOverlay"); 215 return DDHAL_DRIVER_NOTHANDLED; 216 } 217 218 DPRINT1("Calling on dxg.sys pfnDdUpdateOverlay"); 219 return pfnDdUpdateOverlay(hSurfaceDestination,hSurfaceSource,puUpdateOverlayData); 220 } 221 222 /************************************************************************/ 223 /* NtGdiDdSetOverlayPosition */ 224 /************************************************************************/ 225 226 DWORD 227 APIENTRY 228 NtGdiDdSetOverlayPosition(HANDLE hSurfaceSource, 229 HANDLE hSurfaceDestination, 230 PDD_SETOVERLAYPOSITIONDATA puSetOverlayPositionData) 231 { 232 PGD_DXDDSETOVERLAYPOSITION pfnDdSetOverlayPosition = (PGD_DXDDSETOVERLAYPOSITION)gpDxFuncs[DXG_INDEX_DxDdSetOverlayPosition].pfn; 233 234 if (pfnDdSetOverlayPosition == NULL) 235 { 236 DPRINT1("Warning: no pfnDdSetOverlayPosition"); 237 return DDHAL_DRIVER_NOTHANDLED; 238 } 239 240 DPRINT1("Calling on dxg.sys pfnDdSetOverlayPosition"); 241 return pfnDdSetOverlayPosition(hSurfaceSource,hSurfaceDestination,puSetOverlayPositionData); 242 } 243 244 /************************************************************************/ 245 /* This is not part of the ddsurface interface but it */ 246 /* deals with the surface */ 247 /************************************************************************/ 248 249 250 /************************************************************************/ 251 /* NtGdiDdAlphaBlt */ 252 /************************************************************************/ 253 DWORD 254 APIENTRY 255 NtGdiDdAlphaBlt(HANDLE hSurfaceDest, 256 HANDLE hSurfaceSrc, 257 PDD_BLTDATA puBltData) 258 { 259 PGD_DDALPHABLT pfnDdAlphaBlt = (PGD_DDALPHABLT)gpDxFuncs[DXG_INDEX_DxDdAlphaBlt].pfn; 260 261 if (pfnDdAlphaBlt == NULL) 262 { 263 DPRINT1("Warning: no pfnDdAlphaBlt"); 264 return DDHAL_DRIVER_NOTHANDLED; 265 } 266 267 DPRINT1("Calling on dxg.sys DdAlphaBlt"); 268 return pfnDdAlphaBlt(hSurfaceDest,hSurfaceSrc,puBltData); 269 } 270 271 /************************************************************************/ 272 /* NtGdiDdAttachSurface */ 273 /************************************************************************/ 274 BOOL 275 APIENTRY 276 NtGdiDdAttachSurface(HANDLE hSurfaceFrom, 277 HANDLE hSurfaceTo 278 ) 279 { 280 PGD_DDATTACHSURFACE pfnDdAttachSurface = (PGD_DDATTACHSURFACE)gpDxFuncs[DXG_INDEX_DxDdAttachSurface].pfn; 281 282 if (pfnDdAttachSurface == NULL) 283 { 284 DPRINT1("Warning: no pfnDdAttachSurface"); 285 return DDHAL_DRIVER_NOTHANDLED; 286 } 287 288 DPRINT1("Calling on dxg.sys pfnDdAttachSurface"); 289 return pfnDdAttachSurface(hSurfaceFrom,hSurfaceTo); 290 } 291 292 /************************************************************************/ 293 /* NtGdiDdUnattachSurface */ 294 /************************************************************************/ 295 /* Note: MSDN protypes is VOID APIENTRY NtGdiDdUnattachSurface(HANDLE hSurface, HANDLE hSurfaceAttached) 296 But it say it return either DDHAL_DRIVER_NOTHANDLED or DDHAL_DRIVER_HANDLED 297 so I guess it is a typo in MSDN for this prototype for the info contradicts itself. 298 */ 299 NTSTATUS 300 APIENTRY 301 NtGdiDdUnattachSurface(HANDLE hSurface, 302 HANDLE hSurfaceAttached) 303 { 304 PGD_DXDDUNATTACHSURFACE pfnDdUnattachSurface = (PGD_DXDDUNATTACHSURFACE)gpDxFuncs[DXG_INDEX_DxDdUnattachSurface].pfn; 305 if (pfnDdUnattachSurface == NULL) 306 { 307 DPRINT1("Warning: no pfnDdUnattachSurface"); 308 //return DDHAL_DRIVER_NOTHANDLED; 309 return STATUS_NOT_IMPLEMENTED; 310 } 311 312 DPRINT1("Calling on dxg.sys pfnDdUnattachSurface"); 313 return pfnDdUnattachSurface(hSurface,hSurfaceAttached); 314 } 315