Tomas Carnecky wrote:
This partial rewrite aims at cleaning up the pixelformat code. Windows sometimes advertises one or more almost identical and completely compatible pixelformats. These pixelformats differ in attributes like color-bits, but I suspect the driver developers do that only to work around buggy applications that don't follow the spec. This rewrite will also simplify the pixelformat code by removing redundant blocks and moving the core functionality to a few main functions.
This is the first patch that simplifies ChoosePixelFormat() by converting the PFD structure to a list of WGL attributes and then using a function to choose the pixelformat. This function doesn't do anything as we support only one pixelformat, but this function will be shared with wglChoosePixelFormat() once the infrastructure for that is in place.
I also have a second patch that converts DescribePixelFormat() to use the same approach, eg. querying the pixelformat attributes using a WGL attribute list and then copying the values back the the PFD structure.
Few notes: You constructed the array of some attributes which you never use. You don't check if those attributes match anything - the part you removed. When app will ask for something that can't be supported your code will return it to the app - which is plain wrong.
And being picky - you using tabs for indentation, please use 4 spaces instead, and no tabs.
Vitaliy