1 /**************************************************************************
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
30 #include "util/u_debug.h"
32 #include "stw_context.h"
33 #include "stw_pixelformat.h"
37 WINGDIAPI BOOL APIENTRY
43 return DrvCopyContext( (DHGLRC
)(UINT_PTR
)hglrcSrc
,
44 (DHGLRC
)(UINT_PTR
)hglrcDst
,
48 WINGDIAPI HGLRC APIENTRY
52 return (HGLRC
) DrvCreateContext(hdc
);
55 WINGDIAPI HGLRC APIENTRY
56 wglCreateLayerContext(
60 return (HGLRC
) DrvCreateLayerContext( hdc
, iLayerPlane
);
63 WINGDIAPI BOOL APIENTRY
67 return DrvDeleteContext((DHGLRC
)(UINT_PTR
)hglrc
);
71 WINGDIAPI HGLRC APIENTRY
72 wglGetCurrentContext( VOID
)
74 return (HGLRC
)(UINT_PTR
)stw_get_current_context();
77 WINGDIAPI HDC APIENTRY
78 wglGetCurrentDC( VOID
)
80 return stw_get_current_dc();
83 WINGDIAPI BOOL APIENTRY
88 return DrvSetContext( hdc
, (DHGLRC
)(UINT_PTR
)hglrc
, NULL
) ? TRUE
: FALSE
;
92 WINGDIAPI BOOL APIENTRY
96 return DrvSwapBuffers( hdc
);
100 WINGDIAPI DWORD WINAPI
101 wglSwapMultipleBuffers(UINT n
,
106 for (i
=0; i
< n
; ++i
)
107 wglSwapBuffers(ps
->hdc
);
113 WINGDIAPI BOOL APIENTRY
118 return DrvSwapLayerBuffers( hdc
, fuPlanes
);
121 WINGDIAPI PROC APIENTRY
125 return DrvGetProcAddress( lpszProc
);
129 WINGDIAPI
int APIENTRY
130 wglChoosePixelFormat(
132 CONST PIXELFORMATDESCRIPTOR
*ppfd
)
134 if (ppfd
->nSize
!= sizeof( PIXELFORMATDESCRIPTOR
) || ppfd
->nVersion
!= 1)
136 if (ppfd
->iPixelType
!= PFD_TYPE_RGBA
)
138 if (!(ppfd
->dwFlags
& PFD_DRAW_TO_WINDOW
))
140 if (!(ppfd
->dwFlags
& PFD_SUPPORT_OPENGL
))
142 if (ppfd
->dwFlags
& PFD_DRAW_TO_BITMAP
)
144 if (ppfd
->dwFlags
& PFD_SUPPORT_GDI
)
146 if (!(ppfd
->dwFlags
& PFD_STEREO_DONTCARE
) && (ppfd
->dwFlags
& PFD_STEREO
))
149 return stw_pixelformat_choose( hdc
, ppfd
);
152 WINGDIAPI
int APIENTRY
153 wglDescribePixelFormat(
157 LPPIXELFORMATDESCRIPTOR ppfd
)
159 return DrvDescribePixelFormat( hdc
, iPixelFormat
, nBytes
, ppfd
);
162 WINGDIAPI
int APIENTRY
166 return stw_pixelformat_get( hdc
);
169 WINGDIAPI BOOL APIENTRY
173 const PIXELFORMATDESCRIPTOR
*ppfd
)
175 if (ppfd
->nSize
!= sizeof( PIXELFORMATDESCRIPTOR
))
178 return DrvSetPixelFormat( hdc
, iPixelFormat
);
182 WINGDIAPI BOOL APIENTRY
199 WINGDIAPI BOOL APIENTRY
204 return DrvShareLists((DHGLRC
)(UINT_PTR
)hglrc1
,
205 (DHGLRC
)(UINT_PTR
)hglrc2
);
208 WINGDIAPI BOOL APIENTRY
225 WINGDIAPI BOOL APIENTRY
234 LPGLYPHMETRICSFLOAT lpgmf
)
250 WINGDIAPI BOOL APIENTRY
259 LPGLYPHMETRICSFLOAT lpgmf
)
275 WINGDIAPI BOOL APIENTRY
276 wglDescribeLayerPlane(
281 LPLAYERPLANEDESCRIPTOR plpd
)
283 return DrvDescribeLayerPlane(hdc
, iPixelFormat
, iLayerPlane
, nBytes
, plpd
);
286 WINGDIAPI
int APIENTRY
287 wglSetLayerPaletteEntries(
292 CONST COLORREF
*pcr
)
294 return DrvSetLayerPaletteEntries(hdc
, iLayerPlane
, iStart
, cEntries
, pcr
);
297 WINGDIAPI
int APIENTRY
298 wglGetLayerPaletteEntries(
305 return DrvGetLayerPaletteEntries(hdc
, iLayerPlane
, iStart
, cEntries
, pcr
);
308 WINGDIAPI BOOL APIENTRY
309 wglRealizeLayerPalette(