stw_wgl_arbpixelformat.c File Reference

Include dependency graph for stw_wgl_arbpixelformat.c:

Go to the source code of this file.

Data Structures

struct  attrib_match_info
struct  pixelformat_score

Defines

#define WGL_NUMBER_PIXEL_FORMATS_ARB   0x2000
#define WGL_DRAW_TO_WINDOW_ARB   0x2001
#define WGL_DRAW_TO_BITMAP_ARB   0x2002
#define WGL_ACCELERATION_ARB   0x2003
#define WGL_NEED_PALETTE_ARB   0x2004
#define WGL_NEED_SYSTEM_PALETTE_ARB   0x2005
#define WGL_SWAP_LAYER_BUFFERS_ARB   0x2006
#define WGL_SWAP_METHOD_ARB   0x2007
#define WGL_NUMBER_OVERLAYS_ARB   0x2008
#define WGL_NUMBER_UNDERLAYS_ARB   0x2009
#define WGL_TRANSPARENT_ARB   0x200A
#define WGL_TRANSPARENT_RED_VALUE_ARB   0x2037
#define WGL_TRANSPARENT_GREEN_VALUE_ARB   0x2038
#define WGL_TRANSPARENT_BLUE_VALUE_ARB   0x2039
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB   0x203A
#define WGL_TRANSPARENT_INDEX_VALUE_ARB   0x203B
#define WGL_SHARE_DEPTH_ARB   0x200C
#define WGL_SHARE_STENCIL_ARB   0x200D
#define WGL_SHARE_ACCUM_ARB   0x200E
#define WGL_SUPPORT_GDI_ARB   0x200F
#define WGL_SUPPORT_OPENGL_ARB   0x2010
#define WGL_DOUBLE_BUFFER_ARB   0x2011
#define WGL_STEREO_ARB   0x2012
#define WGL_PIXEL_TYPE_ARB   0x2013
#define WGL_COLOR_BITS_ARB   0x2014
#define WGL_RED_BITS_ARB   0x2015
#define WGL_RED_SHIFT_ARB   0x2016
#define WGL_GREEN_BITS_ARB   0x2017
#define WGL_GREEN_SHIFT_ARB   0x2018
#define WGL_BLUE_BITS_ARB   0x2019
#define WGL_BLUE_SHIFT_ARB   0x201A
#define WGL_ALPHA_BITS_ARB   0x201B
#define WGL_ALPHA_SHIFT_ARB   0x201C
#define WGL_ACCUM_BITS_ARB   0x201D
#define WGL_ACCUM_RED_BITS_ARB   0x201E
#define WGL_ACCUM_GREEN_BITS_ARB   0x201F
#define WGL_ACCUM_BLUE_BITS_ARB   0x2020
#define WGL_ACCUM_ALPHA_BITS_ARB   0x2021
#define WGL_DEPTH_BITS_ARB   0x2022
#define WGL_STENCIL_BITS_ARB   0x2023
#define WGL_AUX_BUFFERS_ARB   0x2024
#define WGL_NO_ACCELERATION_ARB   0x2025
#define WGL_GENERIC_ACCELERATION_ARB   0x2026
#define WGL_FULL_ACCELERATION_ARB   0x2027
#define WGL_SWAP_EXCHANGE_ARB   0x2028
#define WGL_SWAP_COPY_ARB   0x2029
#define WGL_SWAP_UNDEFINED_ARB   0x202A
#define WGL_TYPE_RGBA_ARB   0x202B
#define WGL_TYPE_COLORINDEX_ARB   0x202C

Functions

static boolean query_attrib (int iPixelFormat, int iLayerPlane, int attrib, int *pvalue)
static BOOL score_pixelformats (struct pixelformat_score *scores, uint count, int attribute, int expected_value)
WINGDIAPI BOOL APIENTRY wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats)
WINGDIAPI BOOL APIENTRY wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues)
WINGDIAPI BOOL APIENTRY wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues)

Variables

static struct attrib_match_info attrib_match []


Define Documentation

#define WGL_ACCELERATION_ARB   0x2003

Definition at line 39 of file stw_wgl_arbpixelformat.c.

#define WGL_ACCUM_ALPHA_BITS_ARB   0x2021

Definition at line 73 of file stw_wgl_arbpixelformat.c.

#define WGL_ACCUM_BITS_ARB   0x201D

Definition at line 69 of file stw_wgl_arbpixelformat.c.

#define WGL_ACCUM_BLUE_BITS_ARB   0x2020

Definition at line 72 of file stw_wgl_arbpixelformat.c.

#define WGL_ACCUM_GREEN_BITS_ARB   0x201F

Definition at line 71 of file stw_wgl_arbpixelformat.c.

#define WGL_ACCUM_RED_BITS_ARB   0x201E

Definition at line 70 of file stw_wgl_arbpixelformat.c.

#define WGL_ALPHA_BITS_ARB   0x201B

Definition at line 67 of file stw_wgl_arbpixelformat.c.

#define WGL_ALPHA_SHIFT_ARB   0x201C

Definition at line 68 of file stw_wgl_arbpixelformat.c.

#define WGL_AUX_BUFFERS_ARB   0x2024

Definition at line 76 of file stw_wgl_arbpixelformat.c.

#define WGL_BLUE_BITS_ARB   0x2019

Definition at line 65 of file stw_wgl_arbpixelformat.c.

#define WGL_BLUE_SHIFT_ARB   0x201A

Definition at line 66 of file stw_wgl_arbpixelformat.c.

#define WGL_COLOR_BITS_ARB   0x2014

Definition at line 60 of file stw_wgl_arbpixelformat.c.

#define WGL_DEPTH_BITS_ARB   0x2022

Definition at line 74 of file stw_wgl_arbpixelformat.c.

#define WGL_DOUBLE_BUFFER_ARB   0x2011

Definition at line 57 of file stw_wgl_arbpixelformat.c.

#define WGL_DRAW_TO_BITMAP_ARB   0x2002

Definition at line 38 of file stw_wgl_arbpixelformat.c.

#define WGL_DRAW_TO_WINDOW_ARB   0x2001

Definition at line 37 of file stw_wgl_arbpixelformat.c.

#define WGL_FULL_ACCELERATION_ARB   0x2027

Definition at line 80 of file stw_wgl_arbpixelformat.c.

#define WGL_GENERIC_ACCELERATION_ARB   0x2026

Definition at line 79 of file stw_wgl_arbpixelformat.c.

#define WGL_GREEN_BITS_ARB   0x2017

Definition at line 63 of file stw_wgl_arbpixelformat.c.

#define WGL_GREEN_SHIFT_ARB   0x2018

Definition at line 64 of file stw_wgl_arbpixelformat.c.

#define WGL_NEED_PALETTE_ARB   0x2004

Definition at line 40 of file stw_wgl_arbpixelformat.c.

#define WGL_NEED_SYSTEM_PALETTE_ARB   0x2005

Definition at line 41 of file stw_wgl_arbpixelformat.c.

#define WGL_NO_ACCELERATION_ARB   0x2025

Definition at line 78 of file stw_wgl_arbpixelformat.c.

#define WGL_NUMBER_OVERLAYS_ARB   0x2008

Definition at line 44 of file stw_wgl_arbpixelformat.c.

#define WGL_NUMBER_PIXEL_FORMATS_ARB   0x2000

Definition at line 36 of file stw_wgl_arbpixelformat.c.

#define WGL_NUMBER_UNDERLAYS_ARB   0x2009

Definition at line 45 of file stw_wgl_arbpixelformat.c.

#define WGL_PIXEL_TYPE_ARB   0x2013

Definition at line 59 of file stw_wgl_arbpixelformat.c.

#define WGL_RED_BITS_ARB   0x2015

Definition at line 61 of file stw_wgl_arbpixelformat.c.

#define WGL_RED_SHIFT_ARB   0x2016

Definition at line 62 of file stw_wgl_arbpixelformat.c.

#define WGL_SHARE_ACCUM_ARB   0x200E

Definition at line 54 of file stw_wgl_arbpixelformat.c.

#define WGL_SHARE_DEPTH_ARB   0x200C

Definition at line 52 of file stw_wgl_arbpixelformat.c.

#define WGL_SHARE_STENCIL_ARB   0x200D

Definition at line 53 of file stw_wgl_arbpixelformat.c.

#define WGL_STENCIL_BITS_ARB   0x2023

Definition at line 75 of file stw_wgl_arbpixelformat.c.

#define WGL_STEREO_ARB   0x2012

Definition at line 58 of file stw_wgl_arbpixelformat.c.

#define WGL_SUPPORT_GDI_ARB   0x200F

Definition at line 55 of file stw_wgl_arbpixelformat.c.

#define WGL_SUPPORT_OPENGL_ARB   0x2010

Definition at line 56 of file stw_wgl_arbpixelformat.c.

#define WGL_SWAP_COPY_ARB   0x2029

Definition at line 83 of file stw_wgl_arbpixelformat.c.

#define WGL_SWAP_EXCHANGE_ARB   0x2028

Definition at line 82 of file stw_wgl_arbpixelformat.c.

#define WGL_SWAP_LAYER_BUFFERS_ARB   0x2006

Definition at line 42 of file stw_wgl_arbpixelformat.c.

#define WGL_SWAP_METHOD_ARB   0x2007

Definition at line 43 of file stw_wgl_arbpixelformat.c.

#define WGL_SWAP_UNDEFINED_ARB   0x202A

Definition at line 84 of file stw_wgl_arbpixelformat.c.

#define WGL_TRANSPARENT_ALPHA_VALUE_ARB   0x203A

Definition at line 50 of file stw_wgl_arbpixelformat.c.

#define WGL_TRANSPARENT_ARB   0x200A

Definition at line 46 of file stw_wgl_arbpixelformat.c.

#define WGL_TRANSPARENT_BLUE_VALUE_ARB   0x2039

Definition at line 49 of file stw_wgl_arbpixelformat.c.

#define WGL_TRANSPARENT_GREEN_VALUE_ARB   0x2038

Definition at line 48 of file stw_wgl_arbpixelformat.c.

#define WGL_TRANSPARENT_INDEX_VALUE_ARB   0x203B

Definition at line 51 of file stw_wgl_arbpixelformat.c.

#define WGL_TRANSPARENT_RED_VALUE_ARB   0x2037

Definition at line 47 of file stw_wgl_arbpixelformat.c.

#define WGL_TYPE_COLORINDEX_ARB   0x202C

Definition at line 87 of file stw_wgl_arbpixelformat.c.

#define WGL_TYPE_RGBA_ARB   0x202B

Definition at line 86 of file stw_wgl_arbpixelformat.c.


Function Documentation

static boolean query_attrib ( int  iPixelFormat,
int  iLayerPlane,
int  attrib,
int *  pvalue 
) [static]

Definition at line 90 of file stw_wgl_arbpixelformat.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, FALSE, pixelformat_info::flags, pixelformat_color_info::greenbits, pixelformat_color_info::greenshift, PF_FLAG_DOUBLEBUFFER, PF_FLAG_MULTISAMPLED, pixelformat_get_extended_count(), pixelformat_get_info(), pixelformat_color_info::redbits, pixelformat_color_info::redshift, pixelformat_depth_info::stencilbits, TRUE, WGL_ACCELERATION_ARB, WGL_ACCUM_ALPHA_BITS_ARB, WGL_ACCUM_BITS_ARB, WGL_ACCUM_BLUE_BITS_ARB, WGL_ACCUM_GREEN_BITS_ARB, WGL_ACCUM_RED_BITS_ARB, WGL_ALPHA_BITS_ARB, WGL_ALPHA_SHIFT_ARB, WGL_AUX_BUFFERS_ARB, WGL_BLUE_BITS_ARB, WGL_BLUE_SHIFT_ARB, WGL_COLOR_BITS_ARB, WGL_DEPTH_BITS_ARB, WGL_DOUBLE_BUFFER_ARB, WGL_DRAW_TO_BITMAP_ARB, WGL_DRAW_TO_WINDOW_ARB, WGL_FULL_ACCELERATION_ARB, WGL_GREEN_BITS_ARB, WGL_GREEN_SHIFT_ARB, WGL_NEED_PALETTE_ARB, WGL_NEED_SYSTEM_PALETTE_ARB, WGL_NUMBER_OVERLAYS_ARB, WGL_NUMBER_PIXEL_FORMATS_ARB, WGL_NUMBER_UNDERLAYS_ARB, WGL_PIXEL_TYPE_ARB, wgl_query_sample_buffers(), wgl_query_samples(), WGL_RED_BITS_ARB, WGL_RED_SHIFT_ARB, WGL_SAMPLE_BUFFERS_ARB, WGL_SAMPLES_ARB, WGL_SHARE_ACCUM_ARB, WGL_SHARE_DEPTH_ARB, WGL_SHARE_STENCIL_ARB, WGL_STENCIL_BITS_ARB, WGL_STEREO_ARB, WGL_SUPPORT_GDI_ARB, WGL_SUPPORT_OPENGL_ARB, WGL_SWAP_COPY_ARB, WGL_SWAP_LAYER_BUFFERS_ARB, WGL_SWAP_METHOD_ARB, WGL_SWAP_UNDEFINED_ARB, WGL_TRANSPARENT_ALPHA_VALUE_ARB, WGL_TRANSPARENT_ARB, WGL_TRANSPARENT_BLUE_VALUE_ARB, WGL_TRANSPARENT_GREEN_VALUE_ARB, WGL_TRANSPARENT_INDEX_VALUE_ARB, WGL_TRANSPARENT_RED_VALUE_ARB, and WGL_TYPE_RGBA_ARB.

00095 {
00096    uint count;
00097    uint index;
00098    const struct pixelformat_info *pf;
00099 
00100    count = pixelformat_get_extended_count();
00101 
00102    if (attrib == WGL_NUMBER_PIXEL_FORMATS_ARB) {
00103       *pvalue = (int) count;
00104       return TRUE;
00105    }
00106 
00107    index = (uint) iPixelFormat - 1;
00108    if (index >= count)
00109       return FALSE;
00110 
00111    pf = pixelformat_get_info( index );
00112 
00113    switch (attrib) {
00114    case WGL_DRAW_TO_WINDOW_ARB:
00115       *pvalue = TRUE;
00116       return TRUE;
00117 
00118    case WGL_DRAW_TO_BITMAP_ARB:
00119       *pvalue = FALSE;
00120       return TRUE;
00121 
00122    case WGL_NEED_PALETTE_ARB:
00123       *pvalue = FALSE;
00124       return TRUE;
00125 
00126    case WGL_NEED_SYSTEM_PALETTE_ARB:
00127       *pvalue = FALSE;
00128       return TRUE;
00129 
00130    case WGL_SWAP_METHOD_ARB:
00131       if (pf->flags & PF_FLAG_DOUBLEBUFFER)
00132          *pvalue = WGL_SWAP_COPY_ARB;
00133       else
00134          *pvalue = WGL_SWAP_UNDEFINED_ARB;
00135       return TRUE;
00136 
00137    case WGL_SWAP_LAYER_BUFFERS_ARB:
00138       *pvalue = FALSE;
00139       return TRUE;
00140 
00141    case WGL_NUMBER_OVERLAYS_ARB:
00142       *pvalue = 0;
00143       return TRUE;
00144 
00145    case WGL_NUMBER_UNDERLAYS_ARB:
00146       *pvalue = 0;
00147       return TRUE;
00148    }
00149 
00150    if (iLayerPlane != 0)
00151       return FALSE;
00152 
00153    switch (attrib) {
00154    case WGL_ACCELERATION_ARB:
00155       *pvalue = WGL_FULL_ACCELERATION_ARB;
00156       break;
00157 
00158    case WGL_TRANSPARENT_ARB:
00159       *pvalue = FALSE;
00160       break;
00161 
00162    case WGL_TRANSPARENT_RED_VALUE_ARB:
00163    case WGL_TRANSPARENT_GREEN_VALUE_ARB:
00164    case WGL_TRANSPARENT_BLUE_VALUE_ARB:
00165    case WGL_TRANSPARENT_ALPHA_VALUE_ARB:
00166    case WGL_TRANSPARENT_INDEX_VALUE_ARB:
00167       break;
00168 
00169    case WGL_SHARE_DEPTH_ARB:
00170    case WGL_SHARE_STENCIL_ARB:
00171    case WGL_SHARE_ACCUM_ARB:
00172       *pvalue = TRUE;
00173       break;
00174 
00175    case WGL_SUPPORT_GDI_ARB:
00176       *pvalue = FALSE;
00177       break;
00178 
00179    case WGL_SUPPORT_OPENGL_ARB:
00180       *pvalue = TRUE;
00181       break;
00182 
00183    case WGL_DOUBLE_BUFFER_ARB:
00184       if (pf->flags & PF_FLAG_DOUBLEBUFFER)
00185          *pvalue = TRUE;
00186       else
00187          *pvalue = FALSE;
00188       break;
00189 
00190    case WGL_STEREO_ARB:
00191       *pvalue = FALSE;
00192       break;
00193 
00194    case WGL_PIXEL_TYPE_ARB:
00195       *pvalue = WGL_TYPE_RGBA_ARB;
00196       break;
00197 
00198    case WGL_COLOR_BITS_ARB:
00199       *pvalue = (int) (pf->color.redbits + pf->color.greenbits + pf->color.bluebits);
00200       break;
00201 
00202    case WGL_RED_BITS_ARB:
00203       *pvalue = (int) pf->color.redbits;
00204       break;
00205 
00206    case WGL_RED_SHIFT_ARB:
00207       *pvalue = (int) pf->color.redshift;
00208       break;
00209 
00210    case WGL_GREEN_BITS_ARB:
00211       *pvalue = (int) pf->color.greenbits;
00212       break;
00213 
00214    case WGL_GREEN_SHIFT_ARB:
00215       *pvalue = (int) pf->color.greenshift;
00216       break;
00217 
00218    case WGL_BLUE_BITS_ARB:
00219       *pvalue = (int) pf->color.bluebits;
00220       break;
00221 
00222    case WGL_BLUE_SHIFT_ARB:
00223       *pvalue = (int) pf->color.blueshift;
00224       break;
00225 
00226    case WGL_ALPHA_BITS_ARB:
00227       *pvalue = (int) pf->alpha.alphabits;
00228       break;
00229 
00230    case WGL_ALPHA_SHIFT_ARB:
00231       *pvalue = (int) pf->alpha.alphashift;
00232       break;
00233 
00234    case WGL_ACCUM_BITS_ARB:
00235    case WGL_ACCUM_RED_BITS_ARB:
00236    case WGL_ACCUM_GREEN_BITS_ARB:
00237    case WGL_ACCUM_BLUE_BITS_ARB:
00238    case WGL_ACCUM_ALPHA_BITS_ARB:
00239       *pvalue = 0;
00240       break;
00241 
00242    case WGL_DEPTH_BITS_ARB:
00243       *pvalue = (int) pf->depth.depthbits;
00244       break;
00245 
00246    case WGL_STENCIL_BITS_ARB:
00247       *pvalue = (int) pf->depth.stencilbits;
00248       break;
00249 
00250    case WGL_AUX_BUFFERS_ARB:
00251       *pvalue = 0;
00252       break;
00253 
00254    case WGL_SAMPLE_BUFFERS_ARB:
00255       if (pf->flags & PF_FLAG_MULTISAMPLED)
00256          *pvalue = wgl_query_sample_buffers();
00257       else
00258          *pvalue = 0;
00259       break;
00260 
00261    case WGL_SAMPLES_ARB:
00262       if (pf->flags & PF_FLAG_MULTISAMPLED)
00263          *pvalue = wgl_query_samples();
00264       else
00265          *pvalue = 0;
00266       break;
00267 
00268    default:
00269       return FALSE;
00270    }
00271 
00272    return TRUE;
00273 }

static BOOL score_pixelformats ( struct pixelformat_score scores,
uint  count,
int  attribute,
int  expected_value 
) [static]

Definition at line 328 of file stw_wgl_arbpixelformat.c.

References attrib_match_info::exact, FALSE, pixelformat_score::points, query_attrib(), TRUE, and attrib_match_info::weight.

00333 {
00334    uint i;
00335    struct attrib_match_info *ami = NULL;
00336    uint index;
00337 
00338    /* Find out if a given attribute should be considered for score calculation.
00339     */
00340    for (i = 0; i < sizeof( attrib_match ) / sizeof( attrib_match[0] ); i++) {
00341       if (attrib_match[i].attribute == attribute) {
00342          ami = &attrib_match[i];
00343          break;
00344       }
00345    }
00346    if (ami == NULL)
00347       return TRUE;
00348 
00349    /* Iterate all pixelformats, query the requested attribute and calculate
00350     * score points.
00351     */
00352    for (index = 0; index < count; index++) {
00353       int actual_value;
00354 
00355       if (!query_attrib( index + 1, 0, attribute, &actual_value ))
00356          return FALSE;
00357 
00358       if (ami->exact) {
00359          /* For an exact match criteria, if the actual and expected values differ,
00360           * the score is set to 0 points, effectively removing the pixelformat
00361           * from a list of matching pixelformats.
00362           */
00363          if (actual_value != expected_value)
00364             scores[index].points = 0;
00365       }
00366       else {
00367          /* For a minimum match criteria, if the actual value is smaller than the expected
00368           * value, the pixelformat is rejected (score set to 0). However, if the actual
00369           * value is bigger, the pixelformat is given a penalty to favour pixelformats that
00370           * more closely match the expected values.
00371           */
00372          if (actual_value < expected_value)
00373             scores[index].points = 0;
00374          else if (actual_value > expected_value)
00375             scores[index].points -= (actual_value - expected_value) * ami->weight;
00376       }
00377    }
00378 
00379    return TRUE;
00380 }

WINGDIAPI BOOL APIENTRY wglChoosePixelFormatARB ( HDC  hdc,
const int *  piAttribIList,
const FLOAT *  pfAttribFList,
UINT  nMaxFormats,
int *  piFormats,
UINT *  nNumFormats 
)

Definition at line 383 of file stw_wgl_arbpixelformat.c.

References FALSE, FREE, pixelformat_score::index, MALLOC, pixelformat_get_extended_count(), points(), pixelformat_score::points, score_pixelformats(), and TRUE.

00390 {
00391    uint count;
00392    struct pixelformat_score *scores;
00393    uint i;
00394 
00395    *nNumFormats = 0;
00396 
00397    /* Allocate and initialize pixelformat score table -- better matches
00398     * have higher scores. Start with a high score and take out penalty
00399     * points for a mismatch when the match does not have to be exact.
00400     * Set a score to 0 if there is a mismatch for an exact match criteria.
00401     */
00402    count = pixelformat_get_extended_count();
00403    scores = (struct pixelformat_score *) MALLOC( count * sizeof( struct pixelformat_score ) );
00404    if (scores == NULL)
00405       return FALSE;
00406    for (i = 0; i < count; i++) {
00407       scores[i].points = 0x7fffffff;
00408       scores[i].index = i;
00409    }
00410 
00411    /* Given the attribute list calculate a score for each pixelformat.
00412     */
00413    if (piAttribIList != NULL) {
00414       while (*piAttribIList != 0) {
00415          if (!score_pixelformats( scores, count, piAttribIList[0], piAttribIList[1] )) {
00416             FREE( scores );
00417             return FALSE;
00418          }
00419          piAttribIList += 2;
00420       }
00421    }
00422    if (pfAttribFList != NULL) {
00423       while (*pfAttribFList != 0) {
00424          if (!score_pixelformats( scores, count, (int) pfAttribFList[0], (int) pfAttribFList[1] )) {
00425             FREE( scores );
00426             return FALSE;
00427          }
00428          pfAttribFList += 2;
00429       }
00430    }
00431 
00432    /* Bubble-sort the resulting scores. Pixelformats with higher scores go first.
00433     * TODO: Find out if there are any patent issues with it.
00434     */
00435    if (count > 1) {
00436       uint n = count;
00437       boolean swapped;
00438 
00439       do {
00440          swapped = FALSE;
00441          for (i = 1; i < n; i++) {
00442             if (scores[i - 1].points < scores[i].points) {
00443                struct pixelformat_score score = scores[i - 1];
00444 
00445                scores[i - 1] = scores[i];
00446                scores[i] = score;
00447                swapped = TRUE;
00448             }
00449          }
00450          n--;
00451       }
00452       while (swapped);
00453    }
00454 
00455    /* Return a list of pixelformats that are the best match.
00456     * Reject pixelformats with non-positive scores.
00457     */
00458    for (i = 0; i < count; i++) {
00459       if (scores[i].points > 0) {
00460          if (*nNumFormats < nMaxFormats)
00461             piFormats[*nNumFormats] = scores[i].index + 1;
00462          (*nNumFormats)++;
00463       }
00464    }
00465 
00466    FREE( scores );
00467    return TRUE;
00468 }

WINGDIAPI BOOL APIENTRY wglGetPixelFormatAttribfvARB ( HDC  hdc,
int  iPixelFormat,
int  iLayerPlane,
UINT  nAttributes,
const int *  piAttributes,
FLOAT *  pfValues 
)

Definition at line 471 of file stw_wgl_arbpixelformat.c.

References FALSE, FLOAT, query_attrib(), TRUE, and UINT.

00478 {
00479    UINT i;
00480 
00481    (void) hdc;
00482 
00483    for (i = 0; i < nAttributes; i++) {
00484       int value;
00485 
00486       if (!query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &value ))
00487          return FALSE;
00488       pfValues[i] = (FLOAT) value;
00489    }
00490 
00491    return TRUE;
00492 }

WINGDIAPI BOOL APIENTRY wglGetPixelFormatAttribivARB ( HDC  hdc,
int  iPixelFormat,
int  iLayerPlane,
UINT  nAttributes,
const int *  piAttributes,
int *  piValues 
)

Definition at line 495 of file stw_wgl_arbpixelformat.c.

References FALSE, query_attrib(), TRUE, and UINT.

00502 {
00503    UINT i;
00504 
00505    (void) hdc;
00506 
00507    for (i = 0; i < nAttributes; i++) {
00508       if (!query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &piValues[i] ))
00509          return FALSE;
00510    }
00511 
00512    return TRUE;
00513 }


Variable Documentation

struct attrib_match_info attrib_match[] [static]

Definition at line 282 of file stw_wgl_arbpixelformat.c.


Generated on Tue Sep 29 06:25:56 2009 for Gallium3D by  doxygen 1.5.4