X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2415cf6725d5cfb11f52d29e5d28dfdaa197b366..7c60222510bc5e197b12f153c4bf05db66cb0f4a:/src/osx/utils_osx.cpp diff --git a/src/osx/utils_osx.cpp b/src/osx/utils_osx.cpp index 1f09af498f..438f7ddbf0 100644 --- a/src/osx/utils_osx.cpp +++ b/src/osx/utils_osx.cpp @@ -35,9 +35,7 @@ // #include "MoreFilesX.h" -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 - #include -#endif +#include #include "wx/osx/private.h" #include "wx/osx/private/timer.h" @@ -90,6 +88,7 @@ int wxDisplayDepth() theDepth = 32; // some reasonable default CFRelease(encoding); + CGDisplayModeRelease(currentMode); } else #endif @@ -247,9 +246,26 @@ CGColorSpaceRef wxMacGetGenericRGBColorSpace() CGColorRef wxMacCreateCGColorFromHITheme( ThemeBrush brush ) { - CGColorRef color ; - HIThemeBrushCreateCGColor( brush, &color ); - return color; + const int maxcachedbrush = 58+5; // negative indices are for metabrushes, cache down to -5) + int brushindex = brush+5; + if ( brushindex < 0 || brushindex > maxcachedbrush ) + { + CGColorRef color ; + HIThemeBrushCreateCGColor( brush, &color ); + return color; + } + else + { + static bool inited = false; + static CGColorRef themecolors[maxcachedbrush+1]; + if ( !inited ) + { + for ( int i = 0 ; i <= maxcachedbrush ; ++i ) + HIThemeBrushCreateCGColor( i-5, &themecolors[i] ); + inited = true; + } + return CGColorRetain(themecolors[brushindex ]); + } } //---------------------------------------------------------------------------