xref: /reactos/win32ss/reactx/ntddraw/dd.c (revision 24757e30)
1 /*
2  * COPYRIGHT:        See COPYING in the top level directory
3  * PROJECT:          ReactOS kernel
4  * PURPOSE:          Native DirectDraw implementation
5  * FILE:             win32ss/reactx/ntddraw/dd.c
6  * PROGRAMER:        Magnus Olsen (greatlord@reactos.org)
7  * REVISION HISTORY:
8  *       19/1-2006   Magnus Olsen
9  */
10 
11 #include <win32k.h>
12 
13 // #define NDEBUG
14 #include <debug.h>
15 
16 /************************************************************************/
17 /* NtGdiDdCreateSurface                                                 */
18 /************************************************************************/
19 DWORD
20 APIENTRY
NtGdiDdCreateSurface(HANDLE hDirectDrawLocal,HANDLE * hSurface,DDSURFACEDESC * puSurfaceDescription,DD_SURFACE_GLOBAL * puSurfaceGlobalData,DD_SURFACE_LOCAL * puSurfaceLocalData,DD_SURFACE_MORE * puSurfaceMoreData,PDD_CREATESURFACEDATA puCreateSurfaceData,HANDLE * puhSurface)21 NtGdiDdCreateSurface(HANDLE hDirectDrawLocal,
22                      HANDLE *hSurface,
23                      DDSURFACEDESC *puSurfaceDescription,
24                      DD_SURFACE_GLOBAL *puSurfaceGlobalData,
25                      DD_SURFACE_LOCAL *puSurfaceLocalData,
26                      DD_SURFACE_MORE *puSurfaceMoreData,
27                      PDD_CREATESURFACEDATA puCreateSurfaceData,
28                      HANDLE *puhSurface)
29 {
30     PGD_DDCREATESURFACE pfnDdCreateSurface = (PGD_DDCREATESURFACE)gpDxFuncs[DXG_INDEX_DxDdCreateSurface].pfn;
31 
32     if (pfnDdCreateSurface == NULL)
33     {
34         DPRINT1("Warning: no pfnDdCreateSurface\n");
35         return DDHAL_DRIVER_NOTHANDLED;
36     }
37 
38     DPRINT("Calling dxg.sys pfnDdCreateSurface\n");
39     return pfnDdCreateSurface(hDirectDrawLocal,hSurface,puSurfaceDescription,puSurfaceGlobalData,
40                               puSurfaceLocalData,puSurfaceMoreData,puCreateSurfaceData,puhSurface);
41 }
42 
43 /************************************************************************/
44 /* NtGdiDdWaitForVerticalBlank                                          */
45 /************************************************************************/
46 DWORD
47 APIENTRY
NtGdiDdWaitForVerticalBlank(HANDLE hDirectDraw,PDD_WAITFORVERTICALBLANKDATA puWaitForVerticalBlankData)48 NtGdiDdWaitForVerticalBlank(HANDLE hDirectDraw,
49                             PDD_WAITFORVERTICALBLANKDATA puWaitForVerticalBlankData)
50 {
51     PGD_DXDDWAITFORVERTICALBLANK pfnDdWaitForVerticalBlank = (PGD_DXDDWAITFORVERTICALBLANK)gpDxFuncs[DXG_INDEX_DxDdWaitForVerticalBlank].pfn;
52 
53     if (pfnDdWaitForVerticalBlank == NULL)
54     {
55         DPRINT1("Warning: no pfnDdWaitForVerticalBlank\n");
56         return DDHAL_DRIVER_NOTHANDLED;
57     }
58 
59     DPRINT("Calling dxg.sys pfnDdWaitForVerticalBlank\n");
60     return pfnDdWaitForVerticalBlank(hDirectDraw, puWaitForVerticalBlankData);
61 }
62 
63 /************************************************************************/
64 /* NtGdiDdCanCreateSurface                                              */
65 /************************************************************************/
66 DWORD
67 APIENTRY
NtGdiDdCanCreateSurface(HANDLE hDirectDrawLocal,PDD_CANCREATESURFACEDATA puCanCreateSurfaceData)68 NtGdiDdCanCreateSurface(HANDLE hDirectDrawLocal,
69                         PDD_CANCREATESURFACEDATA puCanCreateSurfaceData)
70 {
71     PGD_DDCANCREATESURFACE pfnDdCanCreateSurface = (PGD_DDCANCREATESURFACE)gpDxFuncs[DXG_INDEX_DxDdCanCreateSurface].pfn;
72 
73     if (pfnDdCanCreateSurface == NULL)
74     {
75         DPRINT1("Warning: no pfnDdCanCreateSurface\n");
76         return DDHAL_DRIVER_NOTHANDLED;
77     }
78 
79     DPRINT("Calling dxg.sys pfnDdCanCreateSurface\n");
80 
81     return pfnDdCanCreateSurface(hDirectDrawLocal,puCanCreateSurfaceData);
82 }
83 
84 /************************************************************************/
85 /* NtGdiDdGetScanLine                                                   */
86 /************************************************************************/
87 DWORD
88 APIENTRY
NtGdiDdGetScanLine(HANDLE hDirectDrawLocal,PDD_GETSCANLINEDATA puGetScanLineData)89 NtGdiDdGetScanLine(HANDLE hDirectDrawLocal,
90                    PDD_GETSCANLINEDATA puGetScanLineData)
91 {
92     PGD_DXDDGETSCANLINE  pfnDdGetScanLine = (PGD_DXDDGETSCANLINE)gpDxFuncs[DXG_INDEX_DxDdGetScanLine].pfn;
93 
94     if (pfnDdGetScanLine == NULL)
95     {
96         DPRINT1("Warning: no pfnDdGetScanLine\n");
97         return DDHAL_DRIVER_NOTHANDLED;
98     }
99 
100     DPRINT("Calling dxg.sys pfnDdGetScanLine\n");
101 
102     return pfnDdGetScanLine(hDirectDrawLocal,puGetScanLineData);
103 }
104 
105 
106 /************************************************************************/
107 /* This is not part of the ddsurface interface but it                   */
108 /* deals with the surface                                               */
109 /************************************************************************/
110 
111 /************************************************************************/
112 /* NtGdiDdCreateSurfaceEx                                               */
113 /************************************************************************/
114 DWORD
115 APIENTRY
NtGdiDdCreateSurfaceEx(HANDLE hDirectDraw,HANDLE hSurface,DWORD dwSurfaceHandle)116 NtGdiDdCreateSurfaceEx(HANDLE hDirectDraw,
117                        HANDLE hSurface,
118                        DWORD dwSurfaceHandle)
119 {
120     PGD_DXDDCREATESURFACEEX pfnDdCreateSurfaceEx  = (PGD_DXDDCREATESURFACEEX)gpDxFuncs[DXG_INDEX_DxDdCreateSurfaceEx].pfn;
121 
122     if (pfnDdCreateSurfaceEx == NULL)
123     {
124         DPRINT1("Warning: no pfnDdCreateSurfaceEx\n");
125         return DDHAL_DRIVER_NOTHANDLED;
126     }
127 
128     DPRINT("Calling dxg.sys pfnDdCreateSurfaceEx\n");
129     return pfnDdCreateSurfaceEx(hDirectDraw,hSurface,dwSurfaceHandle);
130 }
131