diff options
Diffstat (limited to 'drape')
-rw-r--r-- | drape/framebuffer.cpp | 7 | ||||
-rw-r--r-- | drape/support_manager.cpp | 15 | ||||
-rw-r--r-- | drape/support_manager.hpp | 2 |
3 files changed, 24 insertions, 0 deletions
diff --git a/drape/framebuffer.cpp b/drape/framebuffer.cpp index 010cd4d5cd..cef169a37c 100644 --- a/drape/framebuffer.cpp +++ b/drape/framebuffer.cpp @@ -1,5 +1,6 @@ #include "drape/framebuffer.hpp" #include "drape/glfunctions.hpp" +#include "drape/support_manager.hpp" #include "base/assert.hpp" #include "base/logging.hpp" @@ -111,6 +112,12 @@ void Framebuffer::SetSize(uint32_t width, uint32_t height) if (!m_isSupported) return; + if (!SupportManager::Instance().IsFramebufferSupported()) + { + m_isSupported = false; + return; + } + if (m_width == width && m_height == height) return; diff --git a/drape/support_manager.cpp b/drape/support_manager.cpp index 5528f467bc..beac26753f 100644 --- a/drape/support_manager.cpp +++ b/drape/support_manager.cpp @@ -5,6 +5,10 @@ #include "base/logging.hpp" +#ifdef OMIM_OS_ANDROID +#include "android/jni/com/mapswithme/platform/Platform.hpp" +#endif + #include "3party/Alohalytics/src/alohalytics.h" #include <algorithm> @@ -68,6 +72,17 @@ void SupportManager::Init() #endif settings::Set(kSupportedAntialiasing, m_isAntialiasingEnabledByDefault); } + + // Disable framebuffer for old Android OS versions. +#ifdef OMIM_OS_ANDROID + int constexpr kMinSdkVersionForFramebuffer = 18; + int const sdkVersion = android::GetAndroidSdkVersion(); + if (sdkVersion != 0) + m_isFramebufferSupported = (sdkVersion >= kMinSdkVersionForFramebuffer); + + if (!m_isFramebufferSupported) + LOG(LINFO, ("Framebuffer is not supported on Android API level ", sdkVersion)); +#endif } SupportManager & SupportManager::Instance() diff --git a/drape/support_manager.hpp b/drape/support_manager.hpp index e7a9df6aa9..4b2bb14a83 100644 --- a/drape/support_manager.hpp +++ b/drape/support_manager.hpp @@ -20,6 +20,7 @@ public: bool IsTegraDevice() const { return m_isTegra; } int GetMaxLineWidth() const { return m_maxLineWidth; } bool IsAntialiasingEnabledByDefault() const { return m_isAntialiasingEnabledByDefault; } + bool IsFramebufferSupported() const { return m_isFramebufferSupported; } private: SupportManager() = default; @@ -29,6 +30,7 @@ private: bool m_isTegra = false; int m_maxLineWidth = 1; bool m_isAntialiasingEnabledByDefault = false; + bool m_isFramebufferSupported = true; DISALLOW_COPY_AND_MOVE(SupportManager); }; |