Transplant revision b18dc32.
Original message is as follows: [Xcode4.4] wrong code: NSBitsPerPixelFromDepth seems to like to return 0. instead, use a reimplementation of CGGetDisplayBitsPerPixel
This commit is contained in:
@@ -501,6 +501,25 @@ int LowLevelWindow_MacOSX::ChangeDisplayMode( const VideoModeParams& p )
|
||||
return 0;
|
||||
}
|
||||
|
||||
// http://lukassen.wordpress.com/2010/01/18/taming-snow-leopard-cgdisplaybitsperpixel-deprication/
|
||||
static size_t GetDisplayBitsPerPixel( CGDirectDisplayID displayId )
|
||||
{
|
||||
|
||||
CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displayId);
|
||||
size_t depth = 0;
|
||||
|
||||
CFStringRef pixEnc = CGDisplayModeCopyPixelEncoding(mode);
|
||||
if(CFStringCompare(pixEnc, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
|
||||
depth = 32;
|
||||
else if(CFStringCompare(pixEnc, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
|
||||
depth = 16;
|
||||
else if(CFStringCompare(pixEnc, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
|
||||
depth = 8;
|
||||
|
||||
return depth;
|
||||
|
||||
}
|
||||
|
||||
void LowLevelWindow_MacOSX::SetActualParamsFromMode( CFDictionaryRef mode )
|
||||
{
|
||||
SInt32 rate;
|
||||
@@ -527,7 +546,7 @@ void LowLevelWindow_MacOSX::SetActualParamsFromMode( CFDictionaryRef mode )
|
||||
m_CurrentParams.height = int(size.height);
|
||||
}
|
||||
|
||||
m_CurrentParams.bpp = CGDisplayBitsPerPixel( kCGDirectMainDisplay );
|
||||
m_CurrentParams.bpp = GetDisplayBitsPerPixel( kCGDirectMainDisplay );
|
||||
}
|
||||
|
||||
static int GetIntValue( CFTypeRef r )
|
||||
|
||||
Reference in New Issue
Block a user