diff --git a/android/jni/Android.mk b/android/jni/Android.mk index c28c17b29e..8d39dec575 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -94,7 +94,7 @@ LOCAL_SRC_FILES := \ com/mapswithme/platform/Language.cpp \ com/mapswithme/platform/MethodRef.cpp \ com/mapswithme/platform/PThreadImpl.cpp \ - com/mapswithme/utils/StringUtils.cpp \ + com/mapswithme/util/StringUtils.cpp \ com/mapswithme/util/Config.cpp \ com/mapswithme/opengl/android_gl_utils.cpp \ com/mapswithme/opengl/androidoglcontext.cpp \ diff --git a/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp b/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp index 08d15d6457..9406a39ba3 100644 --- a/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp +++ b/android/jni/com/mapswithme/maps/DownloadResourcesActivity.cpp @@ -55,9 +55,9 @@ extern "C" { switch (pl.GetWritableStorageStatus(fileSize)) { - case Platform::STORAGE_DISCONNECTED: return ERR_STORAGE_DISCONNECTED; - case Platform::NOT_ENOUGH_SPACE: return ERR_NOT_ENOUGH_FREE_SPACE; - default: return fileSize; + case Platform::STORAGE_DISCONNECTED: return ERR_STORAGE_DISCONNECTED; + case Platform::NOT_ENOUGH_SPACE: return ERR_NOT_ENOUGH_FREE_SPACE; + default: return fileSize; } } diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index a0b27cbb1c..7481c266f5 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -211,6 +211,11 @@ void Framework::SetMapStyle(MapStyle mapStyle) m_work.SetMapStyle(mapStyle); } +MapStyle Framework::GetMapStyle() const +{ + return m_work.GetMapStyle(); +} + Storage & Framework::Storage() { return m_work.Storage(); diff --git a/android/jni/com/mapswithme/maps/SearchEngine.cpp b/android/jni/com/mapswithme/maps/SearchEngine.cpp index 10708c3af6..63e23d0aa6 100644 --- a/android/jni/com/mapswithme/maps/SearchEngine.cpp +++ b/android/jni/com/mapswithme/maps/SearchEngine.cpp @@ -212,7 +212,8 @@ extern "C" Java_com_mapswithme_maps_search_SearchEngine_nativeShowAllResults(JNIEnv * env, jclass clazz) { lock_guard guard(g_resultsMutex); - g_framework->PostDrapeTask([results = g_results]() + auto results = g_results; + g_framework->PostDrapeTask([results]() { g_framework->NativeFramework()->ShowAllSearchResults(results); }); @@ -221,7 +222,7 @@ extern "C" JNIEXPORT void JNICALL Java_com_mapswithme_maps_search_SearchEngine_nativeCancelInteractiveSearch(JNIEnv * env, jclass clazz) { - android::Platform::RunOnGuiThreadImpl([]() + GetPlatform().RunOnGuiThread([]() { g_framework->NativeFramework()->CancelInteractiveSearch(); }); diff --git a/android/jni/opengl/android_gl_utils.h b/android/jni/opengl/android_gl_utils.h deleted file mode 100644 index df743426b2..0000000000 --- a/android/jni/opengl/android_gl_utils.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include -#include - -class ConfigComparator -{ -public: - ConfigComparator(EGLDisplay display) - : m_display(display) - {} - - int operator()(EGLConfig const & l, EGLConfig const & r) const - { - return configWeight(l) - configWeight(r); - } - - int configWeight(EGLConfig const & config) const - { - int val = -1; - eglGetConfigAttrib(m_display, config, EGL_CONFIG_CAVEAT, &val); - - switch (val) - { - case EGL_NONE: - return 0; - case EGL_SLOW_CONFIG: - return 1; - case EGL_NON_CONFORMANT_CONFIG: - return 2; - default: - return 0; - } - } - -private: - EGLDisplay m_display; -}; - diff --git a/android/jni/opengl/androidoglcontext.cpp b/android/jni/opengl/androidoglcontext.cpp deleted file mode 100644 index 9928be8887..0000000000 --- a/android/jni/opengl/androidoglcontext.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "androidoglcontext.hpp" -#include "base/assert.hpp" -#include "base/logging.hpp" - - - -static EGLint * getContextAttributesList() -{ - static EGLint contextAttrList[] = { - EGL_CONTEXT_CLIENT_VERSION, 2, - EGL_NONE - }; - return contextAttrList; -} - -AndroidOGLContext::AndroidOGLContext(EGLDisplay display, EGLSurface surface, EGLConfig config, AndroidOGLContext * contextToShareWith) - : m_nativeContext(EGL_NO_CONTEXT) - , m_surface(surface) - , m_display(display) -{ - ASSERT(m_surface != EGL_NO_SURFACE, ()); - ASSERT(m_display != EGL_NO_DISPLAY, ()); - - EGLContext sharedContext = (contextToShareWith == NULL) ? EGL_NO_CONTEXT : contextToShareWith->m_nativeContext; - m_nativeContext = eglCreateContext(m_display, config, sharedContext, getContextAttributesList()); - - CHECK(m_nativeContext != EGL_NO_CONTEXT, ()); -} - -AndroidOGLContext::~AndroidOGLContext() -{ - // Native context must exist - eglDestroyContext(m_display, m_nativeContext); -} - -void AndroidOGLContext::setDefaultFramebuffer() -{ - glBindFramebuffer(GL_FRAMEBUFFER, 0); -} - -void AndroidOGLContext::makeCurrent() -{ - if (eglMakeCurrent(m_display, m_surface, m_surface, m_nativeContext) != EGL_TRUE) - LOG(LINFO, ("Failed to set current context:", eglGetError())); -} - -void AndroidOGLContext::present() -{ - if(eglSwapBuffers(m_display, m_surface) != EGL_TRUE) - LOG(LINFO, ("Failed to swap buffers:", eglGetError())); -} diff --git a/android/jni/opengl/androidoglcontext.hpp b/android/jni/opengl/androidoglcontext.hpp deleted file mode 100644 index a7dc49ac03..0000000000 --- a/android/jni/opengl/androidoglcontext.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include "drape/oglcontext.hpp" - -#include -#include -#include - - -class AndroidOGLContext : public OGLContext -{ -public: - AndroidOGLContext(EGLDisplay display, EGLSurface surface, EGLConfig config, AndroidOGLContext * contextToShareWith); - ~AndroidOGLContext(); - - virtual void makeCurrent(); - virtual void present(); - virtual void setDefaultFramebuffer(); - -private: - // {@ Owned by Context - EGLContext m_nativeContext; - // @} - - // {@ Owned by Factory - EGLSurface m_surface; - EGLDisplay m_display; - // @} -}; - diff --git a/android/jni/opengl/androidoglcontextfactory.cpp b/android/jni/opengl/androidoglcontextfactory.cpp deleted file mode 100644 index 23fffa3160..0000000000 --- a/android/jni/opengl/androidoglcontextfactory.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include "androidoglcontextfactory.h" -#include "android_gl_utils.h" - -#include "base/assert.hpp" - -#include "std/algorithm.hpp" - -static EGLint * getConfigAttributesList() -{ - static EGLint attr_list[] = { - EGL_RED_SIZE, 5, - EGL_GREEN_SIZE, 6, - EGL_BLUE_SIZE, 5, - EGL_STENCIL_SIZE, 0, - EGL_DEPTH_SIZE, 16, - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, - EGL_SURFACE_TYPE, EGL_PBUFFER_BIT | EGL_WINDOW_BIT, - EGL_NONE - }; - return attr_list; -} - -AndroidOGLContextFactory::AndroidOGLContextFactory(JNIEnv * env, jobject jsurface) - : m_drawContext(NULL) - , m_uploadContext(NULL) - , m_windowSurface(EGL_NO_SURFACE) - , m_pixelbufferSurface(EGL_NO_SURFACE) - , m_config(NULL) - , m_nativeWindow(NULL) - , m_display(EGL_NO_DISPLAY) -{ - CHECK(jsurface, ()); - - m_nativeWindow = ANativeWindow_fromSurface(env, jsurface); - ASSERT(m_nativeWindow, ()); - - m_display = eglGetDisplay(EGL_DEFAULT_DISPLAY); - ASSERT(m_display != EGL_NO_DISPLAY, ()); - - EGLint version[2] = {0}; - VERIFY(eglInitialize(m_display, &version[0], &version[1]), ()); - - createWindowSurface(); - createPixelbufferSurface(); -} - -AndroidOGLContextFactory::~AndroidOGLContextFactory() -{ - delete m_drawContext; - delete m_uploadContext; - - eglDestroySurface(m_display, m_windowSurface); - eglDestroySurface(m_display, m_pixelbufferSurface); - eglTerminate(m_display); - - ANativeWindow_release(m_nativeWindow); -} - -OGLContext * AndroidOGLContextFactory::getDrawContext() -{ - ASSERT(m_windowSurface != EGL_NO_SURFACE, ()); - if (m_drawContext == NULL) - m_drawContext = new AndroidOGLContext(m_display, m_windowSurface, m_config, m_uploadContext); - return m_drawContext; -} - -OGLContext * AndroidOGLContextFactory::getResourcesUploadContext() -{ - ASSERT(m_pixelbufferSurface != EGL_NO_SURFACE, ()); - if (m_uploadContext == NULL) - m_uploadContext = new AndroidOGLContext(m_display, m_pixelbufferSurface, m_config, m_drawContext); - return m_uploadContext; -} - -void AndroidOGLContextFactory::createWindowSurface() -{ - EGLConfig configs[40]; - int count = 0; - VERIFY(eglChooseConfig(m_display, getConfigAttributesList(), configs, 40, &count) == EGL_TRUE, ()); - ASSERT(count > 0, ("Didn't find any configs.")); - - sort(&configs[0], &configs[count], ConfigComparator(m_display)); - for (int i = 0; i < count; ++i) - { - EGLConfig currentConfig = configs[i]; - - m_windowSurface = eglCreateWindowSurface(m_display, currentConfig, m_nativeWindow, EGL_BACK_BUFFER); - if (m_windowSurface == EGL_NO_SURFACE) - continue; - else - m_config = currentConfig; - - EGLint configId = 0; - eglGetConfigAttrib(m_display, m_config, EGL_CONFIG_ID, &configId); - LOG(LINFO, ("Choosen config id:", configId)); - - break; - } - - CHECK(m_config != NULL, ()); - CHECK(m_windowSurface != EGL_NO_SURFACE, ()); -} - -void AndroidOGLContextFactory::createPixelbufferSurface() -{ - ASSERT(m_config != NULL, ()); - - const GLuint size = 1; // yes, 1 is the correct size, we dont really draw on it - static EGLint surfaceConfig[] = { - EGL_WIDTH, size, EGL_HEIGHT, size, EGL_NONE - }; - m_pixelbufferSurface = eglCreatePbufferSurface(m_display, m_config, surfaceConfig); - - CHECK(m_pixelbufferSurface != EGL_NO_SURFACE, ()); -} - - diff --git a/android/jni/opengl/androidoglcontextfactory.h b/android/jni/opengl/androidoglcontextfactory.h deleted file mode 100644 index 42d50b0bb2..0000000000 --- a/android/jni/opengl/androidoglcontextfactory.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include "androidoglcontext.hpp" -#include "drape/oglcontextfactory.hpp" - - -class AndroidOGLContextFactory : public OGLContextFactory -{ -public: - AndroidOGLContextFactory(JNIEnv * env, jobject jsurface); - ~AndroidOGLContextFactory(); - - virtual OGLContext * getDrawContext(); - virtual OGLContext * getResourcesUploadContext(); - -private: - void createWindowSurface(); - void createPixelbufferSurface(); - - - AndroidOGLContext * m_drawContext; - AndroidOGLContext * m_uploadContext; - - EGLSurface m_windowSurface; - EGLSurface m_pixelbufferSurface; - EGLConfig m_config; - - ANativeWindow * m_nativeWindow; - EGLDisplay m_display; -}; diff --git a/drape/hw_texture_ios.mm b/drape/hw_texture_ios.mm index f3d1b57086..63ca499cc9 100644 --- a/drape/hw_texture_ios.mm +++ b/drape/hw_texture_ios.mm @@ -9,6 +9,7 @@ #import #import +#include #include #include diff --git a/iphone/Maps/Classes/MWMPlacePageViewManager.mm b/iphone/Maps/Classes/MWMPlacePageViewManager.mm index 58a69af1a2..c4c59f768f 100644 --- a/iphone/Maps/Classes/MWMPlacePageViewManager.mm +++ b/iphone/Maps/Classes/MWMPlacePageViewManager.mm @@ -257,8 +257,9 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState) - (void)changeBookmarkCategory:(BookmarkAndCategory)bac; { - BookmarkCategory const * category = GetFramework().GetBmCategory(bac.first); - Bookmark const * bookmark = category->GetBookmark(bac.second); + BookmarkCategory * category = GetFramework().GetBmCategory(bac.first); + BookmarkCategory::Guard guard(*category); + UserMark const * bookmark = guard.m_controller.GetUserMark(bac.second); m_userMark.reset(new UserMarkCopy(bookmark, false)); } @@ -344,7 +345,7 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState) return @""; string distance; CLLocationCoordinate2D const coord = location.coordinate; - ms::LatLon const target = MercatorBounds::ToLatLon(m_userMark->GetUserMark()->GetOrg()); + ms::LatLon const target = MercatorBounds::ToLatLon(m_userMark->GetUserMark()->GetPivot()); MeasurementUtils::FormatDistance(ms::DistanceOnEarth(coord.latitude, coord.longitude, target.lat, target.lon), distance); return @(distance.c_str()); diff --git a/map/style_tests/style_symbols_consistency_test.cpp b/map/style_tests/style_symbols_consistency_test.cpp index 3f8871ae07..3baad03e17 100644 --- a/map/style_tests/style_symbols_consistency_test.cpp +++ b/map/style_tests/style_symbols_consistency_test.cpp @@ -5,8 +5,6 @@ #include "indexer/drules_include.hpp" #include "indexer/map_style_reader.hpp" -#include "graphics/defines.hpp" - #include "base/logging.hpp" #include "coding/parse_xml.hpp" @@ -15,6 +13,7 @@ #include "std/algorithm.hpp" #include "std/set.hpp" #include "std/string.hpp" +#include "std/vector.hpp" namespace { @@ -69,6 +68,8 @@ UNIT_TEST(Test_SymbolsConsistency) bool res = true; + vector densities = { "ldpi", "mdpi", "hdpi", "xhdpi", "xxhdpi", "6plus" }; + for (size_t s = 0; s < MapStyleCount; ++s) { MapStyle const mapStyle = static_cast(s); @@ -78,11 +79,9 @@ UNIT_TEST(Test_SymbolsConsistency) set const drawingRuleSymbols = GetSymbolsSetFromDrawingRule(); - for (size_t d = 0; d < graphics::EDensityCount; ++d) + for (size_t d = 0; d < densities.size(); ++d) { - string const density = graphics::convert(static_cast(d)); - - set const resourceStyles = GetSymbolsSetFromResourcesFile(density); + set const resourceStyles = GetSymbolsSetFromResourcesFile(densities[d]); vector missed; set_difference(drawingRuleSymbols.begin(), drawingRuleSymbols.end(), @@ -93,7 +92,7 @@ UNIT_TEST(Test_SymbolsConsistency) { // We are interested in all set of bugs, therefore we do not stop test here but // continue it just keeping in res that test failed. - LOG(LINFO, ("Symbols mismatch: style", mapStyle, ", density", density, ", missed", missed)); + LOG(LINFO, ("Symbols mismatch: style", mapStyle, ", density", densities[d], ", missed", missed)); res = false; } } diff --git a/map/style_tests/style_tests.pro b/map/style_tests/style_tests.pro index 4199a4376d..25763f9b5b 100644 --- a/map/style_tests/style_tests.pro +++ b/map/style_tests/style_tests.pro @@ -6,7 +6,7 @@ TEMPLATE = app INCLUDEPATH += ../../3party/protobuf/src ROOT_DIR = ../.. -DEPENDENCIES = map indexer graphics platform geometry coding base expat protobuf +DEPENDENCIES = map indexer platform geometry coding base expat protobuf macx-*: LIBS *= "-framework IOKit"