Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorrachytski <siarhei.rachytski@gmail.com>2013-03-30 00:22:50 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:52:39 +0300
commitbcda0a2661e9b399b7fa9c5522b5e2f0fb5fe775 (patch)
tree9f2a8233a2fd5d5a7cb8425ef855598598a18552 /gui
parentdba1e020edbd7e17d75d32af6bd3648fa894832e (diff)
added DisplayListCache to gui::Controller for usage in gui::Element's
Diffstat (limited to 'gui')
-rw-r--r--gui/controller.cpp10
-rw-r--r--gui/controller.hpp34
2 files changed, 31 insertions, 13 deletions
diff --git a/gui/controller.cpp b/gui/controller.cpp
index d24681894e..c9d228eeab 100644
--- a/gui/controller.cpp
+++ b/gui/controller.cpp
@@ -1,5 +1,6 @@
#include "controller.hpp"
#include "element.hpp"
+#include "display_list_cache.hpp"
#include "../map/drawer.hpp"
@@ -153,6 +154,8 @@ namespace gui
m_VisualScale = graphics::visualScale(p.m_Density);
m_CacheScreen = p.m_CacheScreen;
+ m_DisplayListCache.reset(new DisplayListCache(m_CacheScreen, m_GlyphCache));
+
LayoutElements();
}
@@ -164,6 +167,8 @@ namespace gui
m_CacheScreen = 0;
PurgeElements();
+
+ m_DisplayListCache.reset();
}
void Controller::DrawFrame(graphics::Screen * screen)
@@ -204,6 +209,11 @@ namespace gui
return m_CacheScreen;
}
+ DisplayListCache * Controller::GetDisplayListCache() const
+ {
+ return m_DisplayListCache.get();
+ }
+
void Controller::UpdateElements()
{
for_each(m_Elements.begin(), m_Elements.end(), bind(&Element::update, _1));
diff --git a/gui/controller.hpp b/gui/controller.hpp
index 468cfc56ab..f3d288d5f3 100644
--- a/gui/controller.hpp
+++ b/gui/controller.hpp
@@ -1,6 +1,9 @@
#pragma once
+#include "display_list_cache.hpp"
+
#include "../std/shared_ptr.hpp"
+#include "../std/scoped_ptr.hpp"
#include "../std/function.hpp"
#include "../std/list.hpp"
@@ -29,6 +32,19 @@ namespace gui
/// Invalidate functor type
typedef function<void()> TInvalidateFn;
+ struct RenderParams
+ {
+ graphics::EDensity m_Density;
+ TInvalidateFn m_InvalidateFn;
+ graphics::GlyphCache * m_GlyphCache;
+ graphics::Screen * m_CacheScreen;
+ RenderParams();
+ RenderParams(graphics::EDensity density,
+ TInvalidateFn invalidateFn,
+ graphics::GlyphCache * glyphCache,
+ graphics::Screen * cacheScreen);
+ };
+
private:
/// element that has focus.
@@ -54,6 +70,9 @@ namespace gui
/// GlyphCache for text rendering by GUI elements.
graphics::GlyphCache * m_GlyphCache;
+ /// Cache for display lists for fast rendering on GUI thread
+ scoped_ptr<DisplayListCache> m_DisplayListCache;
+
/// Localized strings for GUI.
StringsBundle const * m_bundle;
@@ -79,19 +98,6 @@ namespace gui
bool OnTapCancelled(m2::PointD const & pt);
/// @}
- struct RenderParams
- {
- graphics::EDensity m_Density;
- TInvalidateFn m_InvalidateFn;
- graphics::GlyphCache * m_GlyphCache;
- graphics::Screen * m_CacheScreen;
- RenderParams();
- RenderParams(graphics::EDensity density,
- TInvalidateFn invalidateFn,
- graphics::GlyphCache * glyphCache,
- graphics::Screen * cacheScreen);
- };
-
/// Attach GUI Controller to the renderer
void SetRenderParams(RenderParams const & p);
/// Set the bundle with localized strings
@@ -115,6 +121,8 @@ namespace gui
/// Get graphics::Screen, which is used to cache gui::Element's
/// into display lists.
graphics::Screen * GetCacheScreen() const;
+ /// Get display list cache
+ DisplayListCache * GetDisplayListCache() const;
/// Redraw GUI
void DrawFrame(graphics::Screen * screen);
/// Calling gui::Element::update for every element.