X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8cc897966965e018c5205be32273bda68cbeb2a7..b0ae60498d2a1cab6cff09d425d235a0847135e8:/src/osx/utils_osx.cpp diff --git a/src/osx/utils_osx.cpp b/src/osx/utils_osx.cpp index 0cd8cda713..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" @@ -248,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 ]); + } } //---------------------------------------------------------------------------