Converting a Bit Depth into a Flag

The BitDepthToFlags function is used by the ChooseDevice enumeration function to convert a bit depth into the appropriate DirectDraw bit depth flag. For more information, see Enumeration Function

static DWORD 
BitDepthToFlags(DWORD dwBitDepth) 
{ 
    switch (dwBitDepth) 
    { 
        case  1: return DDBD_1; 
        case  2: return DDBD_2; 
        case  4: return DDBD_4; 
        case  8: return DDBD_8; 
        case 16: return DDBD_16; 
        case 24: return DDBD_24; 
        case 32: return DDBD_32; 
        default: return 0; 
    } 
}