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-02-11 18:40:30 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:49:47 +0300
commit7fdac1d3bd3c2858c1025c25d96ef832e2b5b241 (patch)
treeb7b0055ffcbc4750169b90ab80af1641f8e05174 /gui
parentaca14466854d86c2890d1ed4f24bbb84b85b6b63 (diff)
added graphics::EDensity and resources naming system similar to Android.
Diffstat (limited to 'gui')
-rw-r--r--gui/controller.cpp18
-rw-r--r--gui/controller.hpp10
-rw-r--r--gui/gui_tests/gui_tests.cpp4
3 files changed, 22 insertions, 10 deletions
diff --git a/gui/controller.cpp b/gui/controller.cpp
index 35f2a2aff2..d24681894e 100644
--- a/gui/controller.cpp
+++ b/gui/controller.cpp
@@ -10,18 +10,18 @@
namespace gui
{
Controller::RenderParams::RenderParams()
- : m_VisualScale(0), m_GlyphCache(0)
+ : m_Density(graphics::EDensityMDPI), m_GlyphCache(0)
{}
Controller::Controller()
- : m_VisualScale(0), m_GlyphCache(0)
+ : m_Density(graphics::EDensityMDPI), m_GlyphCache(0)
{}
- Controller::RenderParams::RenderParams(double visualScale,
+ Controller::RenderParams::RenderParams(graphics::EDensity density,
TInvalidateFn invalidateFn,
graphics::GlyphCache * glyphCache,
graphics::Screen * cacheScreen)
- : m_VisualScale(visualScale),
+ : m_Density(density),
m_InvalidateFn(invalidateFn),
m_GlyphCache(glyphCache),
m_CacheScreen(cacheScreen)
@@ -140,11 +140,17 @@ namespace gui
return m_VisualScale;
}
+ graphics::EDensity Controller::GetDensity() const
+ {
+ return m_Density;
+ }
+
void Controller::SetRenderParams(RenderParams const & p)
{
m_GlyphCache = p.m_GlyphCache;
m_InvalidateFn = p.m_InvalidateFn;
- m_VisualScale = p.m_VisualScale;
+ m_Density = p.m_Density;
+ m_VisualScale = graphics::visualScale(p.m_Density);
m_CacheScreen = p.m_CacheScreen;
LayoutElements();
@@ -153,7 +159,7 @@ namespace gui
void Controller::ResetRenderParams()
{
m_GlyphCache = 0;
- m_VisualScale = 0;
+ m_Density = graphics::EDensityLDPI;
m_InvalidateFn.clear();
m_CacheScreen = 0;
diff --git a/gui/controller.hpp b/gui/controller.hpp
index 212b6ba8f7..468cfc56ab 100644
--- a/gui/controller.hpp
+++ b/gui/controller.hpp
@@ -5,6 +5,7 @@
#include "../std/list.hpp"
#include "../geometry/point2d.hpp"
+#include "../graphics/defines.hpp"
#include "../base/strings_bundle.hpp"
@@ -44,6 +45,9 @@ namespace gui
/// Invalidate GUI function
TInvalidateFn m_InvalidateFn;
+ /// Screen density
+ graphics::EDensity m_Density;
+
/// VisualScale to multiply all Device-Independent-Pixels dimensions.
double m_VisualScale;
@@ -77,12 +81,12 @@ namespace gui
struct RenderParams
{
- double m_VisualScale;
+ graphics::EDensity m_Density;
TInvalidateFn m_InvalidateFn;
graphics::GlyphCache * m_GlyphCache;
graphics::Screen * m_CacheScreen;
RenderParams();
- RenderParams(double visualScale,
+ RenderParams(graphics::EDensity density,
TInvalidateFn invalidateFn,
graphics::GlyphCache * glyphCache,
graphics::Screen * cacheScreen);
@@ -102,6 +106,8 @@ namespace gui
void AddElement(shared_ptr<Element> const & e);
/// Get VisualScale parameter
double GetVisualScale() const;
+ /// Get Density parameter
+ graphics::EDensity GetDensity() const;
/// Get localized strings bundle
StringsBundle const * GetStringsBundle() const;
/// Get GlyphCache
diff --git a/gui/gui_tests/gui_tests.cpp b/gui/gui_tests/gui_tests.cpp
index 5457a10709..c552e8a795 100644
--- a/gui/gui_tests/gui_tests.cpp
+++ b/gui/gui_tests/gui_tests.cpp
@@ -31,7 +31,7 @@ struct BalloonTest
bp.m_imageMarginBottom = 5;
bp.m_text = "Active";
- bp.m_image = graphics::Image::Info("testing/images/arrow.png");
+ bp.m_image = graphics::Image::Info("arrow.png", graphics::EDensityMDPI);
m_balloon.reset(new gui::Balloon(bp));
m_balloon->setIsVisible(true);
@@ -132,7 +132,7 @@ struct ImageViewTest
ip.m_pivot = m_pivot;
ip.m_position = graphics::EPosUnder;
- ip.m_image = graphics::Image::Info("testing/images/arrow.png");
+ ip.m_image = graphics::Image::Info("arrow.png", graphics::EDensityMDPI);
m_imageView.reset(new gui::ImageView(ip));