forked from organicmaps/organicmaps
[ANDROID] compilation fixes.
This commit is contained in:
parent
e7130dc4ac
commit
c08d41d8a9
7 changed files with 63 additions and 35 deletions
|
@ -13,12 +13,6 @@
|
|||
#include "../../std/shared_ptr.hpp"
|
||||
#include "../../std/bind.hpp"
|
||||
|
||||
|
||||
void AndroidFramework::ViewHandle::invalidateImpl()
|
||||
{
|
||||
m_parent->CallRepaint();
|
||||
}
|
||||
|
||||
void AndroidFramework::CallRepaint()
|
||||
{
|
||||
// Always get current env pointer, it's different for each thread
|
||||
|
@ -28,7 +22,9 @@ void AndroidFramework::CallRepaint()
|
|||
}
|
||||
|
||||
AndroidFramework::AndroidFramework(JavaVM * jvm)
|
||||
: m_jvm(jvm), m_view(new ViewHandle(this)), m_work(m_view, 0)
|
||||
: m_jvm(jvm),
|
||||
m_handle(new WindowHandle()),
|
||||
m_work(m_handle, 0)
|
||||
{
|
||||
m_work.InitStorage(m_storage);
|
||||
// @TODO refactor storage
|
||||
|
@ -50,7 +46,7 @@ namespace
|
|||
: m_threadCount(threadCount)
|
||||
{}
|
||||
|
||||
void operator() (int, int, drule::BaseRule * p)
|
||||
void operator() (int, int, int, drule::BaseRule * p)
|
||||
{
|
||||
for (size_t threadID = 0; threadID < m_threadCount; ++threadID)
|
||||
{
|
||||
|
@ -67,10 +63,10 @@ void AndroidFramework::InitRenderer()
|
|||
drule::rules().ForEachRule(make_all_invalid(GetPlatform().CpuCores() + 1));
|
||||
|
||||
// temporary workaround
|
||||
m_work.SetRenderPolicy(shared_ptr<RenderPolicy>(new RenderPolicyST(m_view, bind(&Framework<model::FeaturesFetcher>::DrawModel, &m_work, _1, _2, _3, _4))));
|
||||
m_work.SetRenderPolicy(shared_ptr<RenderPolicy>(new RenderPolicyST(m_handle, bind(&Framework<model::FeaturesFetcher>::DrawModel, &m_work, _1, _2, _3, _4, _5, false))));
|
||||
|
||||
m_view->setRenderContext(shared_ptr<yg::gl::RenderContext>());
|
||||
m_view->setDrawer(shared_ptr<DrawerYG>());
|
||||
// m_view->setRenderContext(shared_ptr<yg::gl::RenderContext>());
|
||||
// m_view->setDrawer(shared_ptr<DrawerYG>());
|
||||
|
||||
shared_ptr<yg::gl::RenderContext> pRC = CreateRenderContext();
|
||||
|
||||
|
@ -78,11 +74,11 @@ void AndroidFramework::InitRenderer()
|
|||
shared_ptr<yg::ResourceManager> pRM = CreateResourceManager();
|
||||
|
||||
LOG(LDEBUG, ("AF::InitRenderer 3"));
|
||||
m_view->setRenderContext(pRC);
|
||||
m_view->setDrawer(CreateDrawer(pRM));
|
||||
//m_view->setRenderContext(pRC);
|
||||
m_drawer = CreateDrawer(pRM);
|
||||
|
||||
LOG(LDEBUG, ("AF::InitRenderer 4"));
|
||||
m_work.initializeGL(pRC, pRM);
|
||||
m_work.InitializeGL(pRC, pRM);
|
||||
|
||||
LOG(LDEBUG, ("AF::InitRenderer 5"));
|
||||
|
||||
|
@ -93,13 +89,23 @@ void AndroidFramework::InitRenderer()
|
|||
|
||||
void AndroidFramework::Resize(int w, int h)
|
||||
{
|
||||
m_view->drawer()->onSize(w, h);
|
||||
m_drawer->onSize(w, h);
|
||||
m_work.OnSize(w, h);
|
||||
}
|
||||
|
||||
void AndroidFramework::DrawFrame()
|
||||
{
|
||||
m_work.Paint(make_shared_ptr(new PaintEvent(m_view->drawer())));
|
||||
if (m_work.NeedRedraw())
|
||||
{
|
||||
m_work.SetNeedRedraw(false);
|
||||
|
||||
shared_ptr<PaintEvent> paintEvent(new PaintEvent(m_drawer.get()));
|
||||
|
||||
m_work.BeginPaint(paintEvent);
|
||||
m_work.DoPaint(paintEvent);
|
||||
|
||||
m_work.EndPaint(paintEvent);
|
||||
}
|
||||
}
|
||||
|
||||
void AndroidFramework::Move(int mode, double x, double y)
|
||||
|
|
|
@ -1,27 +1,21 @@
|
|||
#pragma once
|
||||
|
||||
#include "../../map/framework.hpp"
|
||||
#include "../../map/feature_vec_model.hpp"
|
||||
#include "../../map/drawer_yg.hpp"
|
||||
#include "../../map/window_handle.hpp"
|
||||
#include "../../map/feature_vec_model.hpp"
|
||||
|
||||
#include "../../storage/storage.hpp"
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
|
||||
class AndroidFramework
|
||||
{
|
||||
public:
|
||||
class ViewHandle : public WindowHandle
|
||||
{
|
||||
AndroidFramework * m_parent;
|
||||
public:
|
||||
ViewHandle(AndroidFramework * parent) : m_parent(parent) {}
|
||||
virtual void invalidateImpl();
|
||||
};
|
||||
|
||||
private:
|
||||
shared_ptr<ViewHandle> m_view;
|
||||
shared_ptr<DrawerYG> m_drawer;
|
||||
shared_ptr<WindowHandle> m_handle;
|
||||
|
||||
Framework<model::FeaturesFetcher> m_work;
|
||||
storage::Storage m_storage;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ void AndroidLogMessage(LogLevel l, SrcPoint const & src, string const & s)
|
|||
case LCRITICAL: pr = ANDROID_LOG_FATAL; break;
|
||||
}
|
||||
|
||||
string const out = debug_print(src) + " " + s;
|
||||
string const out = DebugPrint(src) + " " + s;
|
||||
__android_log_print(pr, "MapsWithMe_JNI", out.c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -26,11 +26,10 @@ shared_ptr<yg::ResourceManager> CreateResourceManager()
|
|||
blitVBSize, blitIBSize, 10,
|
||||
512, 256, 6,
|
||||
512, 256, 4,
|
||||
pl.TileSize(), pl.TileSize(), pl.MaxTilesCount(),
|
||||
"unicode_blocks.txt",
|
||||
"fonts_whitelist.txt",
|
||||
"fonts_blacklist.txt",
|
||||
1.5 * 1024 * 1024,
|
||||
2 * 1024 * 1024,
|
||||
GetPlatform().CpuCores() + 1,
|
||||
yg::Rt8Bpp,
|
||||
false);
|
||||
|
@ -50,9 +49,9 @@ shared_ptr<DrawerYG> CreateDrawer(shared_ptr<yg::ResourceManager> pRM)
|
|||
p.m_resourceManager = pRM;
|
||||
p.m_glyphCacheID = pRM->guiThreadGlyphCacheID();
|
||||
p.m_frameBuffer = make_shared_ptr(new yg::gl::FrameBuffer(true));
|
||||
p.m_useOverlay = true;
|
||||
p.m_skinName = pl.SkinName();
|
||||
|
||||
return make_shared_ptr(new DrawerYG(pl.SkinName(), p));
|
||||
return make_shared_ptr(new DrawerYG(p));
|
||||
}
|
||||
|
||||
namespace
|
||||
|
|
|
@ -95,8 +95,8 @@ Framework<TModel>::Framework(shared_ptr<WindowHandle> windowHandle,
|
|||
#else
|
||||
m_minRulerWidth(48),
|
||||
#endif
|
||||
m_centeringMode(EDoNothing),
|
||||
m_tileSize(GetPlatform().TileSize())
|
||||
m_centeringMode(EDoNothing)
|
||||
// m_tileSize(GetPlatform().TileSize())
|
||||
{
|
||||
// on Android policy is created in AndroidFramework
|
||||
#ifndef OMIM_OS_ANDROID
|
||||
|
|
|
@ -123,7 +123,7 @@ protected:
|
|||
|
||||
mutable threads::Mutex m_modelSyn;
|
||||
|
||||
int m_tileSize;
|
||||
// int m_tileSize;
|
||||
|
||||
my::Timer m_timer;
|
||||
|
||||
|
|
|
@ -19,6 +19,12 @@ static string ReadPathForFile(string const & writableDir,
|
|||
return fullPath;
|
||||
}
|
||||
|
||||
Platform::Platform()
|
||||
{}
|
||||
|
||||
Platform::~Platform()
|
||||
{}
|
||||
|
||||
ModelReader * Platform::GetReader(string const & file) const
|
||||
{
|
||||
if (IsFileExists(m_writableDir + file))
|
||||
|
@ -101,3 +107,26 @@ string Platform::SkinName() const
|
|||
return "basic.skn";
|
||||
}
|
||||
|
||||
void Platform::GetFontNames(FilesList & res) const
|
||||
{
|
||||
GetFilesInDir(ResourcesDir(), "*.ttf", res);
|
||||
sort(res.begin(), res.end());
|
||||
}
|
||||
|
||||
int Platform::ScaleEtalonSize() const
|
||||
{
|
||||
return 512 + 256;
|
||||
}
|
||||
|
||||
bool Platform::GetFileSize(string const & file, uint64_t & size) const
|
||||
{
|
||||
try
|
||||
{
|
||||
size = ReaderPtr<Reader>(GetReader(file)).Size();
|
||||
return true;
|
||||
}
|
||||
catch (RootException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue