diff options
author | rachytski <siarhei.rachytski@gmail.com> | 2011-11-11 16:55:50 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:27:40 +0300 |
commit | f79d2a3d588c87ae1cda987032eb94655df0312e (patch) | |
tree | f48b2dff6ab1fd8465b6758cc514af92828c59b5 | |
parent | 0cb0a3a23b09e05c17830db637b54b88ee817c1a (diff) |
[Android] Fixed compilation after RenderPolicy initialization refactoring.
-rw-r--r-- | android/jni/com/mapswithme/maps/Framework.cpp | 83 | ||||
-rw-r--r-- | android/jni/com/mapswithme/maps/Framework.hpp | 10 | ||||
-rw-r--r-- | android/jni/com/mapswithme/maps/MWMActivity.cpp | 2 | ||||
-rw-r--r-- | android/jni/com/mapswithme/maps/MainGLView.cpp | 2 | ||||
-rw-r--r-- | platform/platform_android.cpp | 10 |
5 files changed, 31 insertions, 76 deletions
diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index be24f74118..c1c9349f8f 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -13,8 +13,7 @@ #include "../../../../../indexer/drawing_rules.hpp" -#include "../../../../../map/render_policy_st.hpp" -#include "../../../../../map/tiling_render_policy_st.hpp" +#include "../../../../../map/partial_render_policy.hpp" #include "../../../../../map/framework.hpp" #include "../../../../../std/shared_ptr.hpp" @@ -42,16 +41,22 @@ namespace android Framework::Framework(JavaVM * jvm) : m_jvm(jvm), - m_handle(new WindowHandle()), - m_work(m_handle, 0) + m_work() { ASSERT(g_framework == 0, ()); g_framework = this; + m_videoTimer = new VideoTimer(jvm, bind(&Framework::CallRepaint, this)); + // @TODO refactor storage m_work.Storage().ReInitCountries(false); } + Framework::~Framework() + { + delete m_videoTimer; + } + void Framework::SetParentView(jobject view) { m_mainGLView = view; @@ -78,79 +83,22 @@ namespace android }; } - void Framework::CreateDrawer() - { - Platform & pl = GetPlatform(); - - DrawerYG::params_t p; - p.m_resourceManager = m_rm; - p.m_glyphCacheID = m_rm->guiThreadGlyphCacheID(); - p.m_frameBuffer = make_shared_ptr(new yg::gl::FrameBuffer(true)); - p.m_skinName = pl.SkinName(); - p.m_useTinyStorage = true; - - m_drawer = make_shared_ptr(new DrawerYG(p)); - } - - void Framework::CreateResourceManager() - { - int bigVBSize = pow(2, ceil(log(1500.0 * sizeof(yg::gl::Vertex)) / log(2))); - int bigIBSize = pow(2, ceil(log(3000.0 * sizeof(unsigned short)) / log(2))); - - int smallVBSize = pow(2, ceil(log(1500.0 * sizeof(yg::gl::Vertex)) / log(2))); - int smallIBSize = pow(2, ceil(log(3000.0 * sizeof(unsigned short)) / log(2))); - - int blitVBSize = pow(2, ceil(log(10.0 * sizeof(yg::gl::AuxVertex)) / log(2))); - int blitIBSize = pow(2, ceil(log(10.0 * sizeof(unsigned short)) / log(2))); - - Platform & pl = GetPlatform(); - m_rm = make_shared_ptr(new yg::ResourceManager( - bigVBSize, bigIBSize, 100, - smallVBSize, smallIBSize, 100, - blitVBSize, blitIBSize, 10, - 512, 256, 6, - 512, 256, 4, - "unicode_blocks.txt", - "fonts_whitelist.txt", - "fonts_blacklist.txt", - 2 * 1024 * 1024, - 3, - yg::Rt8Bpp, - true)); - - m_rm->initTinyStorage(300 * sizeof(yg::gl::Vertex), 600 * sizeof(unsigned short), 30); - - Platform::FilesList fonts; - pl.GetFontNames(fonts); - m_rm->addFonts(fonts); - } - - void Framework::InitRenderer() + void Framework::InitRenderPolicy() { LOG(LDEBUG, ("AF::InitRenderer 1")); drule::rules().ForEachRule(make_all_invalid(GetPlatform().CpuCores() + 1)); - // temporary workaround - m_work.SetRenderPolicy(shared_ptr<RenderPolicy>(new PartialRenderPolicy(m_handle, bind(&::Framework<model::FeaturesFetcher>::DrawModel, &m_work, _1, _2, _3, _4, _5, false)))); + DrawerYG::Params params; + params.m_frameBuffer = make_shared_ptr(new yg::gl::FrameBuffer(true)); - m_rc = make_shared_ptr(new android::RenderContext()); + m_work.SetRenderPolicy(new PartialRenderPolicy(m_videoTimer, params, make_shared_ptr(new android::RenderContext()))); LOG(LDEBUG, ("AF::InitRenderer 2")); - CreateResourceManager(); - - LOG(LDEBUG, ("AF::InitRenderer 3")); - //m_view->setRenderContext(pRC); - CreateDrawer(); - - LOG(LDEBUG, ("AF::InitRenderer 4")); - m_work.InitializeGL(m_rc, m_rm); - - LOG(LDEBUG, ("AF::InitRenderer 5")); m_work.ShowAll(); - LOG(LDEBUG, ("AF::InitRenderer 6")); + LOG(LDEBUG, ("AF::InitRenderer 3")); } storage::Storage & Framework::Storage() @@ -160,7 +108,6 @@ namespace android void Framework::Resize(int w, int h) { - m_drawer->onSize(w, h); m_work.OnSize(w, h); } @@ -170,7 +117,7 @@ namespace android { m_work.SetNeedRedraw(false); - shared_ptr<PaintEvent> paintEvent(new PaintEvent(m_drawer.get())); + shared_ptr<PaintEvent> paintEvent(new PaintEvent(m_work.GetRenderPolicy()->GetDrawer().get())); m_work.BeginPaint(paintEvent); m_work.DoPaint(paintEvent); diff --git a/android/jni/com/mapswithme/maps/Framework.hpp b/android/jni/com/mapswithme/maps/Framework.hpp index 90f235b474..51b764d348 100644 --- a/android/jni/com/mapswithme/maps/Framework.hpp +++ b/android/jni/com/mapswithme/maps/Framework.hpp @@ -22,13 +22,10 @@ namespace android JavaVM * m_jvm; jobject m_mainGLView; - shared_ptr<DrawerYG> m_drawer; - shared_ptr<WindowHandle> m_handle; - shared_ptr<yg::ResourceManager> m_rm; - shared_ptr<yg::gl::RenderContext> m_rc; - ::Framework<model::FeaturesFetcher> m_work; + VideoTimer * m_videoTimer; + void CallRepaint(); void CreateDrawer(); @@ -38,12 +35,13 @@ namespace android public: Framework(JavaVM * jvm); + ~Framework(); storage::Storage & Storage(); void SetParentView(jobject view); - void InitRenderer(); + void InitRenderPolicy(); void Resize(int w, int h); diff --git a/android/jni/com/mapswithme/maps/MWMActivity.cpp b/android/jni/com/mapswithme/maps/MWMActivity.cpp index 9ce7d7979c..423a26acb8 100644 --- a/android/jni/com/mapswithme/maps/MWMActivity.cpp +++ b/android/jni/com/mapswithme/maps/MWMActivity.cpp @@ -14,7 +14,7 @@ #include "../core/logging.hpp" #include "Framework.hpp" -#include "Platform.hpp" +#include "../platform/Platform.hpp" JavaVM * g_jvm; diff --git a/android/jni/com/mapswithme/maps/MainGLView.cpp b/android/jni/com/mapswithme/maps/MainGLView.cpp index 3b56d68ece..8f4d097d30 100644 --- a/android/jni/com/mapswithme/maps/MainGLView.cpp +++ b/android/jni/com/mapswithme/maps/MainGLView.cpp @@ -29,7 +29,7 @@ extern "C" Java_com_mapswithme_maps_MainRenderer_nativeInit(JNIEnv * env, jobject thiz) { ASSERT ( g_framework, () ); - g_framework->InitRenderer(); + g_framework->InitRenderPolicy(); } JNIEXPORT void JNICALL diff --git a/platform/platform_android.cpp b/platform/platform_android.cpp index adbbb5c12e..6b3becabb9 100644 --- a/platform/platform_android.cpp +++ b/platform/platform_android.cpp @@ -113,6 +113,16 @@ int Platform::ScaleEtalonSize() const return 512 + 256; } +int Platform::TileSize() const +{ + return 256; +} + +int Platform::MaxTilesCount() const +{ + return 120; +} + bool Platform::GetFileSize(string const & file, uint64_t & size) const { try |