stw_wgl.c revision f724036f0045bd28f323af3666c43b3ef03b6886
1/************************************************************************** 2 * 3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. 4 * All Rights Reserved. 5 * 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: 13 * 14 * The above copyright notice and this permission notice (including the 15 * next paragraph) shall be included in all copies or substantial portions 16 * of the Software. 17 * 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. 25 * 26 **************************************************************************/ 27 28#include <windows.h> 29 30#include "util/u_debug.h" 31#include "stw_public.h" 32#include "stw_wgl.h" 33 34 35WINGDIAPI BOOL APIENTRY 36wglCopyContext( 37 HGLRC hglrcSrc, 38 HGLRC hglrcDst, 39 UINT mask ) 40{ 41 return stw_copy_context( (UINT_PTR)hglrcSrc, 42 (UINT_PTR)hglrcDst, 43 mask ); 44} 45 46WINGDIAPI HGLRC APIENTRY 47wglCreateContext( 48 HDC hdc ) 49{ 50 return wglCreateLayerContext(hdc, 0); 51} 52 53WINGDIAPI HGLRC APIENTRY 54wglCreateLayerContext( 55 HDC hdc, 56 int iLayerPlane ) 57{ 58 return (HGLRC) stw_create_layer_context( hdc, iLayerPlane ); 59} 60 61WINGDIAPI BOOL APIENTRY 62wglDeleteContext( 63 HGLRC hglrc ) 64{ 65 return stw_delete_context( (UINT_PTR)hglrc ); 66} 67 68 69WINGDIAPI HGLRC APIENTRY 70wglGetCurrentContext( VOID ) 71{ 72 return (HGLRC)stw_get_current_context(); 73} 74 75WINGDIAPI HDC APIENTRY 76wglGetCurrentDC( VOID ) 77{ 78 return stw_get_current_dc(); 79} 80 81WINGDIAPI BOOL APIENTRY 82wglMakeCurrent( 83 HDC hdc, 84 HGLRC hglrc ) 85{ 86 return stw_make_current( hdc, (UINT_PTR)hglrc ); 87} 88 89 90WINGDIAPI BOOL APIENTRY 91wglSwapBuffers( 92 HDC hdc ) 93{ 94 return stw_swap_buffers( hdc ); 95} 96 97 98WINGDIAPI BOOL APIENTRY 99wglSwapLayerBuffers( 100 HDC hdc, 101 UINT fuPlanes ) 102{ 103 return stw_swap_layer_buffers( hdc, fuPlanes ); 104} 105 106WINGDIAPI PROC APIENTRY 107wglGetProcAddress( 108 LPCSTR lpszProc ) 109{ 110 return stw_get_proc_address( lpszProc ); 111} 112 113 114WINGDIAPI int APIENTRY 115wglChoosePixelFormat( 116 HDC hdc, 117 CONST PIXELFORMATDESCRIPTOR *ppfd ) 118{ 119 if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR ) || ppfd->nVersion != 1) 120 return 0; 121 if (ppfd->iPixelType != PFD_TYPE_RGBA) 122 return 0; 123 if (!(ppfd->dwFlags & PFD_DRAW_TO_WINDOW)) 124 return 0; 125 if (!(ppfd->dwFlags & PFD_SUPPORT_OPENGL)) 126 return 0; 127 if (ppfd->dwFlags & PFD_DRAW_TO_BITMAP) 128 return 0; 129 if (ppfd->dwFlags & PFD_SUPPORT_GDI) 130 return 0; 131 if (!(ppfd->dwFlags & PFD_STEREO_DONTCARE) && (ppfd->dwFlags & PFD_STEREO)) 132 return 0; 133 134 return stw_pixelformat_choose( hdc, ppfd ); 135} 136 137WINGDIAPI int APIENTRY 138wglDescribePixelFormat( 139 HDC hdc, 140 int iPixelFormat, 141 UINT nBytes, 142 LPPIXELFORMATDESCRIPTOR ppfd ) 143{ 144 return stw_pixelformat_describe( hdc, iPixelFormat, nBytes, ppfd ); 145} 146 147WINGDIAPI int APIENTRY 148wglGetPixelFormat( 149 HDC hdc ) 150{ 151 return stw_pixelformat_get( hdc ); 152} 153 154WINGDIAPI BOOL APIENTRY 155wglSetPixelFormat( 156 HDC hdc, 157 int iPixelFormat, 158 const PIXELFORMATDESCRIPTOR *ppfd ) 159{ 160 if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR )) 161 return FALSE; 162 163 return stw_pixelformat_set( hdc, iPixelFormat ); 164} 165 166 167WINGDIAPI BOOL APIENTRY 168wglUseFontBitmapsA( 169 HDC hdc, 170 DWORD first, 171 DWORD count, 172 DWORD listBase ) 173{ 174 (void) hdc; 175 (void) first; 176 (void) count; 177 (void) listBase; 178 179 assert( 0 ); 180 181 return FALSE; 182} 183 184WINGDIAPI BOOL APIENTRY 185wglShareLists( 186 HGLRC hglrc1, 187 HGLRC hglrc2 ) 188{ 189 return stw_share_lists( (UINT_PTR)hglrc1, (UINT_PTR)hglrc2);; 190} 191 192WINGDIAPI BOOL APIENTRY 193wglUseFontBitmapsW( 194 HDC hdc, 195 DWORD first, 196 DWORD count, 197 DWORD listBase ) 198{ 199 (void) hdc; 200 (void) first; 201 (void) count; 202 (void) listBase; 203 204 assert( 0 ); 205 206 return FALSE; 207} 208 209WINGDIAPI BOOL APIENTRY 210wglUseFontOutlinesA( 211 HDC hdc, 212 DWORD first, 213 DWORD count, 214 DWORD listBase, 215 FLOAT deviation, 216 FLOAT extrusion, 217 int format, 218 LPGLYPHMETRICSFLOAT lpgmf ) 219{ 220 (void) hdc; 221 (void) first; 222 (void) count; 223 (void) listBase; 224 (void) deviation; 225 (void) extrusion; 226 (void) format; 227 (void) lpgmf; 228 229 assert( 0 ); 230 231 return FALSE; 232} 233 234WINGDIAPI BOOL APIENTRY 235wglUseFontOutlinesW( 236 HDC hdc, 237 DWORD first, 238 DWORD count, 239 DWORD listBase, 240 FLOAT deviation, 241 FLOAT extrusion, 242 int format, 243 LPGLYPHMETRICSFLOAT lpgmf ) 244{ 245 (void) hdc; 246 (void) first; 247 (void) count; 248 (void) listBase; 249 (void) deviation; 250 (void) extrusion; 251 (void) format; 252 (void) lpgmf; 253 254 assert( 0 ); 255 256 return FALSE; 257} 258 259WINGDIAPI BOOL APIENTRY 260wglDescribeLayerPlane( 261 HDC hdc, 262 int iPixelFormat, 263 int iLayerPlane, 264 UINT nBytes, 265 LPLAYERPLANEDESCRIPTOR plpd ) 266{ 267 (void) hdc; 268 (void) iPixelFormat; 269 (void) iLayerPlane; 270 (void) nBytes; 271 (void) plpd; 272 273 assert( 0 ); 274 275 return FALSE; 276} 277 278WINGDIAPI int APIENTRY 279wglSetLayerPaletteEntries( 280 HDC hdc, 281 int iLayerPlane, 282 int iStart, 283 int cEntries, 284 CONST COLORREF *pcr ) 285{ 286 (void) hdc; 287 (void) iLayerPlane; 288 (void) iStart; 289 (void) cEntries; 290 (void) pcr; 291 292 assert( 0 ); 293 294 return 0; 295} 296 297WINGDIAPI int APIENTRY 298wglGetLayerPaletteEntries( 299 HDC hdc, 300 int iLayerPlane, 301 int iStart, 302 int cEntries, 303 COLORREF *pcr ) 304{ 305 (void) hdc; 306 (void) iLayerPlane; 307 (void) iStart; 308 (void) cEntries; 309 (void) pcr; 310 311 assert( 0 ); 312 313 return 0; 314} 315 316WINGDIAPI BOOL APIENTRY 317wglRealizeLayerPalette( 318 HDC hdc, 319 int iLayerPlane, 320 BOOL bRealize ) 321{ 322 (void) hdc; 323 (void) iLayerPlane; 324 (void) bRealize; 325 326 assert( 0 ); 327 328 return FALSE; 329} 330