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 BOOL APIENTRY
105 return DrvSwapLayerBuffers( hdc
, fuPlanes
);
108 WINGDIAPI PROC APIENTRY
112 return DrvGetProcAddress( lpszProc
);
116 WINGDIAPI
int APIENTRY
117 wglChoosePixelFormat(
119 CONST PIXELFORMATDESCRIPTOR
*ppfd
)
121 if (ppfd
->nSize
!= sizeof( PIXELFORMATDESCRIPTOR
) || ppfd
->nVersion
!= 1)
123 if (ppfd
->iPixelType
!= PFD_TYPE_RGBA
)
125 if (!(ppfd
->dwFlags
& PFD_DRAW_TO_WINDOW
))
127 if (!(ppfd
->dwFlags
& PFD_SUPPORT_OPENGL
))
129 if (ppfd
->dwFlags
& PFD_DRAW_TO_BITMAP
)
131 if (ppfd
->dwFlags
& PFD_SUPPORT_GDI
)
133 if (!(ppfd
->dwFlags
& PFD_STEREO_DONTCARE
) && (ppfd
->dwFlags
& PFD_STEREO
))
136 return stw_pixelformat_choose( hdc
, ppfd
);
139 WINGDIAPI
int APIENTRY
140 wglDescribePixelFormat(
144 LPPIXELFORMATDESCRIPTOR ppfd
)
146 return DrvDescribePixelFormat( hdc
, iPixelFormat
, nBytes
, ppfd
);
149 WINGDIAPI
int APIENTRY
153 return stw_pixelformat_get( hdc
);
156 WINGDIAPI BOOL APIENTRY
160 const PIXELFORMATDESCRIPTOR
*ppfd
)
162 if (ppfd
->nSize
!= sizeof( PIXELFORMATDESCRIPTOR
))
165 return DrvSetPixelFormat( hdc
, iPixelFormat
);
169 WINGDIAPI BOOL APIENTRY
186 WINGDIAPI BOOL APIENTRY
191 return DrvShareLists((DHGLRC
)(UINT_PTR
)hglrc1
,
192 (DHGLRC
)(UINT_PTR
)hglrc2
);
195 WINGDIAPI BOOL APIENTRY
212 WINGDIAPI BOOL APIENTRY
221 LPGLYPHMETRICSFLOAT lpgmf
)
237 WINGDIAPI BOOL APIENTRY
246 LPGLYPHMETRICSFLOAT lpgmf
)
262 WINGDIAPI BOOL APIENTRY
263 wglDescribeLayerPlane(
268 LPLAYERPLANEDESCRIPTOR plpd
)
270 return DrvDescribeLayerPlane(hdc
, iPixelFormat
, iLayerPlane
, nBytes
, plpd
);
273 WINGDIAPI
int APIENTRY
274 wglSetLayerPaletteEntries(
279 CONST COLORREF
*pcr
)
281 return DrvSetLayerPaletteEntries(hdc
, iLayerPlane
, iStart
, cEntries
, pcr
);
284 WINGDIAPI
int APIENTRY
285 wglGetLayerPaletteEntries(
292 return DrvGetLayerPaletteEntries(hdc
, iLayerPlane
, iStart
, cEntries
, pcr
);
295 WINGDIAPI BOOL APIENTRY
296 wglRealizeLayerPalette(