From 486532f44f9980b85a035df51b0916c78c9725eb Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Fri, 20 Nov 2015 16:08:54 +0300 Subject: [PATCH] Moving VisualScale from base to drape. --- android/jni/com/mapswithme/maps/Framework.cpp | 4 ++-- base/base.pro | 1 - drape/drape_common.pri | 1 + {base => drape}/visual_scale.hpp | 5 ++++- iphone/Maps/Classes/EAGLView.mm | 4 ++-- 5 files changed, 9 insertions(+), 6 deletions(-) rename {base => drape}/visual_scale.hpp (74%) diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index d77c29803f..539dbb6477 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -14,6 +14,7 @@ #include "drape_frontend/visual_params.hpp" #include "drape_frontend/user_event_stream.hpp" #include "drape/pointers.hpp" +#include "drape/visual_scale.hpp" #include "coding/file_container.hpp" #include "coding/file_name_utils.hpp" @@ -31,7 +32,6 @@ #include "base/math.hpp" #include "base/logging.hpp" -#include "base/visual_scale.hpp" android::Framework * g_framework = 0; @@ -119,7 +119,7 @@ bool Framework::CreateDrapeEngine(JNIEnv * env, jobject jSurface, int densityDpi ::Framework::DrapeCreationParams p; p.m_surfaceWidth = factory->GetWidth(); p.m_surfaceHeight = factory->GetHeight(); - p.m_visualScale = VisualScale(densityDpi); + p.m_visualScale = dp::VisualScale(densityDpi); p.m_hasMyPositionState = m_isCurrentModeInitialized; p.m_initialMyPositionState = m_currentMode; ASSERT(!m_guiPositions.empty(), ("GUI elements must be set-up before engine is created")); diff --git a/base/base.pro b/base/base.pro index b08a697600..68df155c41 100644 --- a/base/base.pro +++ b/base/base.pro @@ -83,5 +83,4 @@ HEADERS += \ threaded_priority_queue.hpp \ timegm.hpp \ timer.hpp \ - visual_scale.hpp \ worker_thread.hpp \ diff --git a/drape/drape_common.pri b/drape/drape_common.pri index 9d2ef86767..694ec54e78 100644 --- a/drape/drape_common.pri +++ b/drape/drape_common.pri @@ -104,6 +104,7 @@ HEADERS += \ $$DRAPE_DIR/utils/projection.hpp \ $$DRAPE_DIR/utils/vertex_decl.hpp \ $$DRAPE_DIR/vertex_array_buffer.hpp \ + $$DRAPE_DIR/visual_scale.hpp \ iphone*{ HEADERS += $$DRAPE_DIR/hw_texture_ios.hpp diff --git a/base/visual_scale.hpp b/drape/visual_scale.hpp similarity index 74% rename from base/visual_scale.hpp rename to drape/visual_scale.hpp index fba0fa91de..46b3041e0a 100644 --- a/base/visual_scale.hpp +++ b/drape/visual_scale.hpp @@ -1,9 +1,12 @@ #pragma once -inline double VisualScale(double exactDensityDPI) +namespace dp +{ +inline double VisualScale(double exactDensityDPI) noexcept { double constexpr kMdpiDensityDPI = 160.; // For some old devices (for example iPad 2) the density could be less than 160 DPI. // Returns one in that case to keep readable text on the map. return max(1., exactDensityDPI / kMdpiDensityDPI); } +} // namespace dp diff --git a/iphone/Maps/Classes/EAGLView.mm b/iphone/Maps/Classes/EAGLView.mm index e687087229..a8165fc11f 100644 --- a/iphone/Maps/Classes/EAGLView.mm +++ b/iphone/Maps/Classes/EAGLView.mm @@ -9,7 +9,7 @@ #include "platform/platform.hpp" -#include "../../base/visual_scale.hpp" +#include "drape/visual_scale.hpp" #include "std/bind.hpp" #include "std/limits.hpp" @@ -89,7 +89,7 @@ double getExactDPI(double contentScaleFactor) Framework::DrapeCreationParams p; p.m_surfaceWidth = width; p.m_surfaceHeight = height; - p.m_visualScale = VisualScale(getExactDPI(self.contentScaleFactor)); + p.m_visualScale = dp::VisualScale(getExactDPI(self.contentScaleFactor)); [self.widgetsManager setupWidgets:p]; GetFramework().CreateDrapeEngine(make_ref(m_factory), move(p));