Go to the source code of this file.
Functions | |
WINGDIAPI BOOL WINAPI | wglSwapBuffers (HDC hdc) |
WINGDIAPI int WINAPI | wglChoosePixelFormat (HDC hdc, CONST PIXELFORMATDESCRIPTOR *ppfd) |
WINGDIAPI int WINAPI | wglDescribePixelFormat (HDC hdc, int iPixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd) |
WINGDIAPI int WINAPI | wglGetPixelFormat (HDC hdc) |
WINGDIAPI BOOL WINAPI | wglSetPixelFormat (HDC hdc, int iPixelFormat, CONST PIXELFORMATDESCRIPTOR *ppfd) |
WINGDIAPI int WINAPI wglChoosePixelFormat | ( | HDC | hdc, | |
CONST PIXELFORMATDESCRIPTOR * | ppfd | |||
) |
Definition at line 38 of file stw_wgl_pixelformat.c.
References pixelformat_info::alpha, pixelformat_alpha_info::alphabits, pixelformat_color_info::bluebits, pixelformat_info::color, pixelformat_info::depth, pixelformat_depth_info::depthbits, pixelformat_info::flags, pixelformat_color_info::greenbits, PF_FLAG_DOUBLEBUFFER, pixelformat_get_count(), pixelformat_get_info(), pixelformat_color_info::redbits, and pixelformat_depth_info::stencilbits.
00041 { 00042 uint count; 00043 uint index; 00044 uint bestindex; 00045 uint bestdelta; 00046 00047 (void) hdc; 00048 00049 count = pixelformat_get_count(); 00050 bestindex = count; 00051 bestdelta = 0xffffffff; 00052 00053 if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR ) || ppfd->nVersion != 1) 00054 return 0; 00055 if (ppfd->iPixelType != PFD_TYPE_RGBA) 00056 return 0; 00057 if (!(ppfd->dwFlags & PFD_DRAW_TO_WINDOW)) 00058 return 0; 00059 if (!(ppfd->dwFlags & PFD_SUPPORT_OPENGL)) 00060 return 0; 00061 if (ppfd->dwFlags & PFD_DRAW_TO_BITMAP) 00062 return 0; 00063 if (ppfd->dwFlags & PFD_SUPPORT_GDI) 00064 return 0; 00065 if (!(ppfd->dwFlags & PFD_STEREO_DONTCARE) && (ppfd->dwFlags & PFD_STEREO)) 00066 return 0; 00067 00068 for (index = 0; index < count; index++) { 00069 uint delta = 0; 00070 const struct pixelformat_info *pf = pixelformat_get_info( index ); 00071 00072 if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE)) { 00073 if ((ppfd->dwFlags & PFD_DOUBLEBUFFER) && !(pf->flags & PF_FLAG_DOUBLEBUFFER)) 00074 continue; 00075 if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER) && (pf->flags & PF_FLAG_DOUBLEBUFFER)) 00076 continue; 00077 } 00078 00079 if (ppfd->cColorBits != pf->color.redbits + pf->color.greenbits + pf->color.bluebits) 00080 delta += 8; 00081 00082 if (ppfd->cDepthBits != pf->depth.depthbits) 00083 delta += 4; 00084 00085 if (ppfd->cStencilBits != pf->depth.stencilbits) 00086 delta += 2; 00087 00088 if (ppfd->cAlphaBits != pf->alpha.alphabits) 00089 delta++; 00090 00091 if (delta < bestdelta) { 00092 bestindex = index; 00093 bestdelta = delta; 00094 if (bestdelta == 0) 00095 break; 00096 } 00097 } 00098 00099 if (bestindex == count) 00100 return 0; 00101 return bestindex + 1; 00102 }
WINGDIAPI int WINAPI wglDescribePixelFormat | ( | HDC | hdc, | |
int | iPixelFormat, | |||
UINT | nBytes, | |||
LPPIXELFORMATDESCRIPTOR | ppfd | |||
) |
Definition at line 105 of file stw_wgl_pixelformat.c.
References pixelformat_info::alpha, pixelformat_alpha_info::alphabits, pixelformat_alpha_info::alphashift, pixelformat_color_info::bluebits, pixelformat_color_info::blueshift, pixelformat_info::color, pixelformat_info::depth, pixelformat_depth_info::depthbits, pixelformat_info::flags, pixelformat_color_info::greenbits, pixelformat_color_info::greenshift, PF_FLAG_DOUBLEBUFFER, pixelformat_get_extended_count(), pixelformat_get_info(), pixelformat_color_info::redbits, pixelformat_color_info::redshift, and pixelformat_depth_info::stencilbits.
00110 { 00111 uint count; 00112 uint index; 00113 const struct pixelformat_info *pf; 00114 00115 (void) hdc; 00116 00117 count = pixelformat_get_extended_count(); 00118 index = (uint) iPixelFormat - 1; 00119 00120 if (ppfd == NULL) 00121 return count; 00122 if (index >= count || nBytes != sizeof( PIXELFORMATDESCRIPTOR )) 00123 return 0; 00124 00125 pf = pixelformat_get_info( index ); 00126 00127 ppfd->nSize = sizeof( PIXELFORMATDESCRIPTOR ); 00128 ppfd->nVersion = 1; 00129 ppfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; 00130 if (pf->flags & PF_FLAG_DOUBLEBUFFER) 00131 ppfd->dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_COPY; 00132 ppfd->iPixelType = PFD_TYPE_RGBA; 00133 ppfd->cColorBits = pf->color.redbits + pf->color.greenbits + pf->color.bluebits; 00134 ppfd->cRedBits = pf->color.redbits; 00135 ppfd->cRedShift = pf->color.redshift; 00136 ppfd->cGreenBits = pf->color.greenbits; 00137 ppfd->cGreenShift = pf->color.greenshift; 00138 ppfd->cBlueBits = pf->color.bluebits; 00139 ppfd->cBlueShift = pf->color.blueshift; 00140 ppfd->cAlphaBits = pf->alpha.alphabits; 00141 ppfd->cAlphaShift = pf->alpha.alphashift; 00142 ppfd->cAccumBits = 0; 00143 ppfd->cAccumRedBits = 0; 00144 ppfd->cAccumGreenBits = 0; 00145 ppfd->cAccumBlueBits = 0; 00146 ppfd->cAccumAlphaBits = 0; 00147 ppfd->cDepthBits = pf->depth.depthbits; 00148 ppfd->cStencilBits = pf->depth.stencilbits; 00149 ppfd->cAuxBuffers = 0; 00150 ppfd->iLayerType = 0; 00151 ppfd->bReserved = 0; 00152 ppfd->dwLayerMask = 0; 00153 ppfd->dwVisibleMask = 0; 00154 ppfd->dwDamageMask = 0; 00155 00156 return count; 00157 }
WINGDIAPI int WINAPI wglGetPixelFormat | ( | HDC | hdc | ) |
Definition at line 160 of file stw_wgl_pixelformat.c.
References currentpixelformat.
00162 { 00163 (void) hdc; 00164 00165 return currentpixelformat; 00166 }
WINGDIAPI BOOL WINAPI wglSetPixelFormat | ( | HDC | hdc, | |
int | iPixelFormat, | |||
CONST PIXELFORMATDESCRIPTOR * | ppfd | |||
) |
WINGDIAPI BOOL WINAPI wglSwapBuffers | ( | HDC | hdc | ) |
Definition at line 41 of file stw_wgl_swapbuffers.c.
References FALSE, stw_winsys::flush_frontbuffer, framebuffer_from_hdc(), stw_device::screen, st_get_framebuffer_surface(), st_notify_swapbuffers(), ST_SURFACE_BACK_LEFT, stw_framebuffer::stfb, stw_dev, stw_device::stw_winsys, TRUE, and pipe_screen::winsys.
00043 { 00044 struct stw_framebuffer *fb; 00045 struct pipe_surface *surf; 00046 00047 fb = framebuffer_from_hdc( hdc ); 00048 if (fb == NULL) 00049 return FALSE; 00050 00051 /* If we're swapping the buffer associated with the current context 00052 * we have to flush any pending rendering commands first. 00053 */ 00054 st_notify_swapbuffers( fb->stfb ); 00055 00056 surf = st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT ); 00057 00058 stw_dev->stw_winsys->flush_frontbuffer(stw_dev->screen->winsys, 00059 surf, 00060 hdc ); 00061 00062 return TRUE; 00063 }