diff options
author | bjarni <bjarni@openttd.org> | 2008-08-09 17:56:31 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2008-08-09 17:56:31 +0000 |
commit | fbef6535a5bcb07ea660bbf1c07c65136caa7d88 (patch) | |
tree | cf2a86f9a06cac03ab895f9ff6968daab60de2f4 /src | |
parent | 731685cf64088360f7bd7212b40b75a88c9059c1 (diff) | |
download | openttd-fbef6535a5bcb07ea660bbf1c07c65136caa7d88.tar.xz |
(svn r14032) -Fix (r13584): [OSX] changed the condition for selecting 8 or 32 bpp blitter by default
Now we will pick 32 bpp if no 8 bpp fullscreen resolutions are available on the main display (the one with the dock)
Diffstat (limited to 'src')
-rw-r--r-- | src/blitter/factory.hpp | 16 | ||||
-rw-r--r-- | src/video/cocoa/fullscreen.mm | 9 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/blitter/factory.hpp b/src/blitter/factory.hpp index b33c9e5a9..304d73832 100644 --- a/src/blitter/factory.hpp +++ b/src/blitter/factory.hpp @@ -10,6 +10,10 @@ #include "../string_func.h" #include <map> +#if defined(WITH_COCOA) +bool QZ_CanDisplay8bpp(); +#endif /* defined(WITH_COCOA) */ + /** * The base factory, keeping track of all blitters. */ @@ -77,13 +81,15 @@ public: { const char *default_blitter = "8bpp-optimized"; -#if defined(__APPLE__) - /* MacOS X 10.5 removed 8bpp fullscreen support. - * Because of this we will pick 32bpp by default */ - if (MacOSVersionIsAtLeast(10, 5, 0)) { +#if defined(WITH_COCOA) + /* Some people reported lack of fullscreen support in 8 bpp mode. + * While we prefer 8 bpp since it's faster, we will still have to test for support. */ + if (!QZ_CanDisplay8bpp()) { + /* The main display can't go to 8 bpp fullscreen mode. + * We will have to switch to 32 bpp by default. */ default_blitter = "32bpp-anim"; } -#endif /* defined(__APPLE__) */ +#endif /* defined(WITH_COCOA) */ if (GetBlitters().size() == 0) return NULL; const char *bname = (StrEmpty(name)) ? default_blitter : name; diff --git a/src/video/cocoa/fullscreen.mm b/src/video/cocoa/fullscreen.mm index d7f542009..d24a3704e 100644 --- a/src/video/cocoa/fullscreen.mm +++ b/src/video/cocoa/fullscreen.mm @@ -155,6 +155,15 @@ uint QZ_ListModes(OTTD_Point* modes, uint max_modes, CGDirectDisplayID display_i return count; } +/* Small function to test if the main display can display 8 bpp in fullscreen */ +bool QZ_CanDisplay8bpp() +{ + OTTD_Point p; + + /* We want to know if 8 bpp is possible in fullscreen and not anything about resolutions. + * Because of this we want to fill a list of 1 resolution of 8 bpp on display 0 (main) and return if we found one. */ + return QZ_ListModes(&p, 1, 0, 8); +} class FullscreenSubdriver: public CocoaSubdriver { int display_width; |