Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrachytski <siarhei.rachytski@gmail.com>2012-01-30 19:27:21 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:32:46 +0300
commit3d1dafcd7324b8537aefd4a1f792d4eec8ff577c (patch)
tree47bf32791f274782d4d459ab6dedcc4b04d1479a /android/jni/com/mapswithme/platform/Platform.cpp
parent4f8275454fc1d3e2e959077dba7a655691a5e56e (diff)
Revert "[android] - Refactored jni system"
This reverts commit 99986948032751ec55b4d674a89c0e7b8a3aa04e. Conflicts: android/jni/com/mapswithme/maps/MWMActivity.cpp android/jni/com/mapswithme/platform/Platform.cpp android/jni/com/mapswithme/platform/Platform.hpp android/src/com/mapswithme/maps/MWMActivity.java
Diffstat (limited to 'android/jni/com/mapswithme/platform/Platform.cpp')
-rw-r--r--android/jni/com/mapswithme/platform/Platform.cpp40
1 files changed, 24 insertions, 16 deletions
diff --git a/android/jni/com/mapswithme/platform/Platform.cpp b/android/jni/com/mapswithme/platform/Platform.cpp
index e7983c117f..82c675b76d 100644
--- a/android/jni/com/mapswithme/platform/Platform.cpp
+++ b/android/jni/com/mapswithme/platform/Platform.cpp
@@ -1,5 +1,7 @@
#include "Platform.hpp"
+#include "../core/jni_string.hpp"
+
#include "../../../../../base/logging.hpp"
#include "../../../../../std/algorithm.hpp"
@@ -11,7 +13,8 @@ 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
+ /// ceiling screen sizes to the nearest power of two, and taking half of it as a tile size
+
double const log2 = log(2.0);
screenWidth = static_cast<int>(pow(2.0, ceil(log(double(screenWidth)) / log2)));
@@ -19,15 +22,15 @@ public:
m_tileSize = min(max(max(screenWidth, screenHeight) / 2, 128), 512);
- int const k = static_cast<int>((256.0 / m_tileSize) * (256.0 / m_tileSize));
+ int k = static_cast<int>((256.0 / m_tileSize) * (256.0 / m_tileSize));
- // calculating how much tiles we need for the screen of such size
+ /// calculating how much tiles we need for the screen of such size
- // pure magic ;)
+ /// pure magic ;)
- double const rotatedScreenCircleDiameter = sqrt(screenWidth * screenWidth + screenHeight * screenHeight);
- int const tilesOnOneSide = ceil(rotatedScreenCircleDiameter / (m_tileSize / 1.05 / 2));
- int const singleScreenTilesCount = tilesOnOneSide * tilesOnOneSide;
+ double rotatedScreenCircleDiameter = sqrt(screenWidth * screenWidth + screenHeight * screenHeight);
+ int tilesOnOneSide = ceil(rotatedScreenCircleDiameter / (m_tileSize / 1.05 / 2));
+ int singleScreenTilesCount = tilesOnOneSide * tilesOnOneSide;
m_maxTilesCount = singleScreenTilesCount * 2;
LOG(LINFO, ("minimum amount of tiles needed is", m_maxTilesCount));
@@ -91,19 +94,24 @@ namespace android
delete m_impl;
}
- void Platform::Initialize(int densityDpi, int screenWidth, int screenHeight,
- string const & apkPath,
- string const & storagePath, string const & tmpPath,
- string const & extTmpPath, string const & settingsPath)
+ void Platform::Initialize(JNIEnv * env,
+ jint densityDpi,
+ jint screenWidth,
+ jint screenHeight,
+ jstring apkPath,
+ jstring storagePath,
+ jstring tmpPath,
+ jstring extTmpPath,
+ jstring settingsPath)
{
m_impl = new PlatformImpl(densityDpi, screenWidth, screenHeight);
- m_resourcesDir = apkPath;
- m_writableDir = storagePath;
- m_settingsDir = settingsPath;
+ m_resourcesDir = jni::ToString(env, apkPath);
+ m_writableDir = jni::ToString(env, storagePath);
+ m_settingsDir = jni::ToString(env, settingsPath);
- m_localTmpPath = tmpPath;
- m_externalTmpPath = extTmpPath;
+ m_localTmpPath = jni::ToString(env, tmpPath);
+ m_externalTmpPath = jni::ToString(env, extTmpPath);
// By default use external temporary folder
m_tmpDir = m_externalTmpPath;