diff options
author | rachytski <siarhei.rachytski@gmail.com> | 2012-05-12 20:35:38 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:38:23 +0300 |
commit | e17d25ab7c3ffd5a7d51b1043ff5064aeef359a1 (patch) | |
tree | 8bf77a920784e4591a865a07eef76e441ce9d35b /android/jni/com/mapswithme/platform/Platform.cpp | |
parent | 58e55db2d7175e5649e1890aa53d1ad590af9dc3 (diff) |
refactored RenderPolicies to accept visualScale, skinName and screenSize among other parameters. removed Platform::VisualScale, *::SkinName and *::TileSize.
Diffstat (limited to 'android/jni/com/mapswithme/platform/Platform.cpp')
-rw-r--r-- | android/jni/com/mapswithme/platform/Platform.cpp | 70 |
1 files changed, 4 insertions, 66 deletions
diff --git a/android/jni/com/mapswithme/platform/Platform.cpp b/android/jni/com/mapswithme/platform/Platform.cpp index e500ca0dc3..5b5af670eb 100644 --- a/android/jni/com/mapswithme/platform/Platform.cpp +++ b/android/jni/com/mapswithme/platform/Platform.cpp @@ -11,74 +11,15 @@ class Platform::PlatformImpl { public: - PlatformImpl(int densityDpi, int screenWidth, int screenHeight) - { // Constants are taken from android.util.DisplayMetrics - - /// ceiling screen sizes to the nearest power of two, and taking half of it as a tile size - - double const log2 = log(2.0); - -// LOG(LINFO, ("width:", screenWidth, ", height:", screenHeight)); - - size_t ceiledScreenWidth = static_cast<int>(pow(2.0, ceil(log(double(screenWidth)) / log2))); - size_t ceiledScreenHeight = static_cast<int>(pow(2.0, ceil(log(double(screenHeight)) / log2))); - - size_t ceiledScreenSize = max(ceiledScreenWidth, ceiledScreenHeight); - -// LOG(LINFO, ("ceiledScreenSize=", ceiledScreenSize)); - - m_tileSize = min(max(ceiledScreenSize / 2, (size_t)128), (size_t)512); - - LOG(LINFO, ("tileSize=", m_tileSize)); + PlatformImpl() + { m_preCachingDepth = 3; - - switch (densityDpi) - { - case 120: - m_visualScale = 0.75; - m_skinName = "basic_ldpi.skn"; - LOG(LINFO, ("using LDPI resources")); - break; - case 160: - m_visualScale = 1.0; - m_skinName = "basic_mdpi.skn"; - LOG(LINFO, ("using MDPI resources")); - break; - case 240: - m_visualScale = 1.5; - m_skinName = "basic_hdpi.skn"; - LOG(LINFO, ("using HDPI resources")); - break; - default: - m_visualScale = 2.0; - m_skinName = "basic_xhdpi.skn"; - LOG(LINFO, ("using XHDPI resources")); - break; - } } - double m_visualScale; - string m_skinName; - int m_maxTilesCount; - size_t m_tileSize; + size_t m_preCachingDepth; }; -double Platform::VisualScale() const -{ - return m_impl->m_visualScale; -} - -string Platform::SkinName() const -{ - return m_impl->m_skinName; -} - -int Platform::TileSize() const -{ - return m_impl->m_tileSize; -} - int Platform::PreCachingDepth() const { return m_impl->m_preCachingDepth; @@ -135,9 +76,6 @@ namespace android } void Platform::Initialize(JNIEnv * env, - jint densityDpi, - jint screenWidth, - jint screenHeight, jstring apkPath, jstring storagePath, jstring tmpPath, @@ -147,7 +85,7 @@ namespace android if (m_impl) delete m_impl; - m_impl = new PlatformImpl(densityDpi, screenWidth, screenHeight); + m_impl = new PlatformImpl(); m_resourcesDir = jni::ToString(env, apkPath); m_writableDir = jni::ToString(env, storagePath); |