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 "pipe/p_debug.h"
31 #include "shared/stw_public.h"
35 boolean
stw_wgl_init( void )
37 debug_printf("%s\n", __FUNCTION__
);
41 void stw_wgl_cleanup( void )
45 static INLINE
struct stw_context
*stw_context( HGLRC hglrc
)
47 return (struct stw_context
*)hglrc
;
51 WINGDIAPI BOOL APIENTRY
57 return stw_copy_context( stw_context(hglrcSrc
),
58 stw_context(hglrcDst
),
62 WINGDIAPI HGLRC APIENTRY
66 return (HGLRC
) stw_create_context( hdc
, 0 );
69 WINGDIAPI HGLRC APIENTRY
70 wglCreateLayerContext(
74 return (HGLRC
) stw_create_context( hdc
, iLayerPlane
);
77 WINGDIAPI BOOL APIENTRY
81 return stw_delete_context( stw_context(hglrc
) );
85 WINGDIAPI HGLRC APIENTRY
86 wglGetCurrentContext( VOID
)
88 return (HGLRC
) stw_get_current_context();
91 WINGDIAPI HDC APIENTRY
92 wglGetCurrentDC( VOID
)
94 return stw_get_current_dc();
97 WINGDIAPI BOOL APIENTRY
102 return stw_make_current( hdc
, stw_context(hglrc
) );
106 WINGDIAPI BOOL APIENTRY
110 return stw_swap_buffers( hdc
);
114 WINGDIAPI BOOL APIENTRY
125 WINGDIAPI PROC APIENTRY
129 return stw_get_proc_address( lpszProc
);
133 WINGDIAPI
int APIENTRY
134 wglChoosePixelFormat(
136 CONST PIXELFORMATDESCRIPTOR
*ppfd
)
138 if (ppfd
->nSize
!= sizeof( PIXELFORMATDESCRIPTOR
) || ppfd
->nVersion
!= 1)
140 if (ppfd
->iPixelType
!= PFD_TYPE_RGBA
)
142 if (!(ppfd
->dwFlags
& PFD_DRAW_TO_WINDOW
))
144 if (!(ppfd
->dwFlags
& PFD_SUPPORT_OPENGL
))
146 if (ppfd
->dwFlags
& PFD_DRAW_TO_BITMAP
)
148 if (ppfd
->dwFlags
& PFD_SUPPORT_GDI
)
150 if (!(ppfd
->dwFlags
& PFD_STEREO_DONTCARE
) && (ppfd
->dwFlags
& PFD_STEREO
))
153 return stw_pixelformat_choose( hdc
, ppfd
);
156 WINGDIAPI
int APIENTRY
157 wglDescribePixelFormat(
161 LPPIXELFORMATDESCRIPTOR ppfd
)
163 return stw_pixelformat_describe( hdc
, iPixelFormat
, nBytes
, ppfd
);
166 WINGDIAPI
int APIENTRY
170 return stw_pixelformat_get( hdc
);
173 WINGDIAPI BOOL APIENTRY
177 const PIXELFORMATDESCRIPTOR
*ppfd
)
179 if (ppfd
->nSize
!= sizeof( PIXELFORMATDESCRIPTOR
))
182 return stw_pixelformat_set( hdc
, iPixelFormat
);
186 WINGDIAPI BOOL APIENTRY
203 WINGDIAPI BOOL APIENTRY
216 WINGDIAPI BOOL APIENTRY
233 WINGDIAPI BOOL APIENTRY
242 LPGLYPHMETRICSFLOAT lpgmf
)
258 WINGDIAPI BOOL APIENTRY
267 LPGLYPHMETRICSFLOAT lpgmf
)
283 WINGDIAPI BOOL APIENTRY
284 wglDescribeLayerPlane(
289 LPLAYERPLANEDESCRIPTOR plpd
)
302 WINGDIAPI
int APIENTRY
303 wglSetLayerPaletteEntries(
308 CONST COLORREF
*pcr
)
321 WINGDIAPI
int APIENTRY
322 wglGetLayerPaletteEntries(
340 WINGDIAPI BOOL APIENTRY
341 wglRealizeLayerPalette(