From 5f60abdaec80a202f15b645d62f0e435d96435f7 Mon Sep 17 00:00:00 2001 From: ExMix Date: Tue, 17 Dec 2013 16:05:29 +0300 Subject: [PATCH] [drape] transfer interface from ReadMWMTask threads to backend renderer thread --- drape_frontend/engine_context.cpp | 26 +++++++++++++++++++++++++- drape_frontend/engine_context.hpp | 21 +++++++++++++-------- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/drape_frontend/engine_context.cpp b/drape_frontend/engine_context.cpp index 4c41d00a21..bab60ef2d6 100644 --- a/drape_frontend/engine_context.cpp +++ b/drape_frontend/engine_context.cpp @@ -1,8 +1,32 @@ #include "engine_context.hpp" +#include "message_subclasses.hpp" +#include "map_shape.hpp" + namespace df { - EngineContext::EngineContext() + EngineContext::EngineContext(ThreadsCommutator * commutator) + : m_commutator(commutator) { } + + void EngineContext::BeginReadTile(TileKey const & key) + { + PostMessage(new TileReadStartMessage(key)); + } + + void EngineContext::InsertShape(TileKey const & key, MapShape const * shape) + { + PostMessage(new MapShapeReadedMessage(key, shape)); + } + + void EngineContext::EndReadTile(TileKey const & key) + { + PostMessage(new TileReadEndMessage(key)); + } + + void EngineContext::PostMessage(Message * message) + { + m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread, message); + } } diff --git a/drape_frontend/engine_context.hpp b/drape_frontend/engine_context.hpp index 4c10ef46e4..d90cfae06e 100644 --- a/drape_frontend/engine_context.hpp +++ b/drape_frontend/engine_context.hpp @@ -1,23 +1,28 @@ #pragma once #include "tile_info.hpp" +#include "threads_commutator.hpp" namespace df { - class MapShape - { - public: - virtual ~MapShape(){} - virtual void Draw() const = 0; - }; + class Message; + class MapShape; class EngineContext { public: - EngineContext(); + EngineContext(ThreadsCommutator * commutator); + void BeginReadTile(TileKey const & key); /// If you call this method, you may forget about shape. /// It will be proccessed and delete later - void InsertShape(df::TileKey const & key, MapShape * shape) {} + void InsertShape(TileKey const & key, MapShape const * shape); + void EndReadTile(TileKey const & key); + + private: + void PostMessage(Message * message); + + private: + ThreadsCommutator * m_commutator; }; }