Minor code cleanup for better “graphics” dependency understanding.

This commit is contained in:
vng 2014-08-27 12:18:58 +03:00 committed by Alex Zolotarev
parent f89d0b7a8c
commit 5495d7cbbd
19 changed files with 42 additions and 86 deletions

View file

@ -23,13 +23,6 @@ namespace graphics
m_color()
{}
uint32_t GlyphKey::toUInt32() const
{
return static_cast<uint32_t>(m_symbolCode) << 16
| static_cast<uint32_t>(m_fontSize) << 8
| static_cast<uint32_t>(m_isMask);
}
bool operator<(GlyphKey const & l, GlyphKey const & r)
{
if (l.m_symbolCode != r.m_symbolCode)

View file

@ -40,9 +40,7 @@ namespace graphics
int m_fontSize;
bool m_isMask;
graphics::Color m_color;
/// as it's used for fixed fonts only, the color doesn't matter
/// @TODO REMOVE IT!!! All chars are already 32bit
uint32_t toUInt32() const;
GlyphKey(strings::UniChar symbolCode,
int fontSize,
bool isMask,

View file

@ -1,14 +1,9 @@
#include "glyph_layout.hpp"
#include "font_desc.hpp"
#include "resource.hpp"
#include "../base/logging.hpp"
#include "../base/math.hpp"
#include "../std/sstream.hpp"
#include "../geometry/angles.hpp"
#include "../geometry/any_rect2d.hpp"
#include "../base/thread.hpp"
namespace graphics
{

View file

@ -1,26 +1,21 @@
#pragma once
#include "glyph_cache.hpp"
#include "defines.hpp"
#include "../base/string_utils.hpp"
#include "text_path.hpp"
#include "font_desc.hpp"
#include "../geometry/rect2d.hpp"
#include "../geometry/point2d.hpp"
#include "../geometry/any_rect2d.hpp"
#include "../geometry/angles.hpp"
#include "../std/vector.hpp"
#include "../std/string.hpp"
#include "../std/shared_ptr.hpp"
#include "../base/string_utils.hpp"
#include "glyph_cache.hpp"
#include "text_path.hpp"
#include "font_desc.hpp"
namespace graphics
{
class GlyphCache;
struct FontDesc;
struct GlyphLayoutElem
{

View file

@ -1,8 +1,5 @@
#include "../base/SRC_FIRST.hpp"
#include "overlay.hpp"
#include "overlay_renderer.hpp"
#include "text_element.hpp"
#include "../base/logging.hpp"
#include "../base/stl_add.hpp"
@ -16,11 +13,11 @@ namespace graphics
bool betterOverlayElement(shared_ptr<OverlayElement> const & l,
shared_ptr<OverlayElement> const & r)
{
/// "frozen" object shouldn't be popped out.
// "frozen" object shouldn't be popped out.
if (r->isFrozen())
return false;
/// for the composite elements, collected in OverlayRenderer to replace the part elements
// for the composite elements, collected in OverlayRenderer to replace the part elements
return l->priority() > r->priority();
}
@ -360,24 +357,4 @@ namespace graphics
// LOG(LINFO, ("clipped out", clippedCnt, "elements,", elemCnt, "elements total"));
}
bool Overlay::checkHasEquals(Overlay const * l) const
{
vector<shared_ptr<OverlayElement> > v0;
m_tree.ForEach(MakeBackInsertFunctor(v0));
sort(v0.begin(), v0.end());
vector<shared_ptr<OverlayElement> > v1;
l->m_tree.ForEach(MakeBackInsertFunctor(v1));
sort(v1.begin(), v1.end());
vector<shared_ptr<OverlayElement> > res;
set_intersection(v0.begin(), v0.end(), v1.begin(), v1.end(), back_inserter(res));
return !res.empty();
}
}

View file

@ -1,8 +1,5 @@
#pragma once
#include "text_element.hpp"
#include "symbol_element.hpp"
#include "../geometry/rect2d.hpp"
#include "../geometry/point2d.hpp"
#include "../geometry/tree4d.hpp"
@ -10,11 +7,15 @@
#include "../base/matrix.hpp"
#include "../base/mutex.hpp"
#include "../std/map.hpp"
#include "../std/list.hpp"
#include "../std/shared_ptr.hpp"
namespace graphics
{
class OverlayRenderer;
class OverlayElement;
struct OverlayElementTraits
{
static m2::RectD const LimitRect(shared_ptr<OverlayElement> const & elem);
@ -65,8 +66,6 @@ namespace graphics
void clip(m2::RectI const & r);
bool checkHasEquals(Overlay const * l) const;
template <typename Fn>
void forEach(Fn fn)
{

View file

@ -1,6 +1,6 @@
#include "../base/SRC_FIRST.hpp"
#include "overlay_element.hpp"
namespace graphics
{
OverlayElement::~OverlayElement()

View file

@ -1,11 +1,15 @@
#pragma once
#include "defines.hpp"
#include "../geometry/point2d.hpp"
#include "../geometry/any_rect2d.hpp"
#include "../base/matrix.hpp"
#include "defines.hpp"
#include "../std/vector.hpp"
namespace graphics
{
class OverlayRenderer;

View file

@ -1,5 +1,3 @@
#include "../base/SRC_FIRST.hpp"
#include "overlay_renderer.hpp"
#include "straight_text_element.hpp"
#include "path_text_element.hpp"
@ -9,6 +7,7 @@
#include "overlay.hpp"
#include "resource_manager.hpp"
namespace graphics
{
OverlayRenderer::Params::Params()

View file

@ -1,13 +1,15 @@
#pragma once
#include "../std/shared_ptr.hpp"
#include "../std/map.hpp"
#include "text_renderer.hpp"
#include "overlay.hpp"
#include "circle_element.hpp"
#include "symbol_element.hpp"
#include "straight_text_element.hpp"
#include "../std/shared_ptr.hpp"
#include "../std/map.hpp"
namespace graphics
{
class OverlayRenderer : public TextRenderer

View file

@ -1,7 +1,7 @@
#include "../base/SRC_FIRST.hpp"
#include "path_text_element.hpp"
#include "overlay_renderer.hpp"
namespace graphics
{
PathTextElement::Params::Params()

View file

@ -1,6 +1,8 @@
#pragma once
#include "text_element.hpp"
#include "glyph_layout.hpp"
namespace graphics
{

View file

@ -2,7 +2,6 @@
#include "../geometry/rect2d.hpp"
#include "../std/shared_ptr.hpp"
namespace graphics
{

View file

@ -1,5 +1,3 @@
#include "../base/SRC_FIRST.hpp"
#include "straight_text_element.hpp"
#include "overlay_renderer.hpp"

View file

@ -1,6 +1,8 @@
#pragma once
#include "text_element.hpp"
#include "glyph_layout.hpp"
namespace graphics
{

View file

@ -1,13 +1,11 @@
#include "text_element.hpp"
#include "screen.hpp"
#include "resource_cache.hpp"
#include "resource_manager.hpp"
#include "overlay_renderer.hpp"
#include "glyph.hpp"
#include "resource.hpp"
#include "glyph_layout.hpp"
#include "../base/logging.hpp"
namespace graphics
{
TextElement::TextElement(Params const & p)

View file

@ -1,22 +1,15 @@
#pragma once
#include "../base/string_utils.hpp"
#include "overlay_element.hpp"
#include "font_desc.hpp"
#include "../base/matrix.hpp"
#include "../base/string_utils.hpp"
#include "../geometry/any_rect2d.hpp"
#include "../std/shared_ptr.hpp"
#include "font_desc.hpp"
#include "glyph_layout.hpp"
#include "overlay_element.hpp"
namespace graphics
{
class ResourceManager;
class Skin;
class ResourceCache;
class GlyphLayout;
class GlyphCache;
class OverlayRenderer;
class TextElement : public OverlayElement

View file

@ -1,9 +1,9 @@
#include "../base/SRC_FIRST.hpp"
#include "text_path.hpp"
#include "glyph_cache.hpp"
#include "../geometry/angles.hpp"
namespace graphics
{
TextPath::TextPath()

View file

@ -1,13 +1,15 @@
#pragma once
#include "path_view.hpp"
#include "../base/matrix.hpp"
#include "../base/buffer_vector.hpp"
#include "glyph_cache.hpp"
#include "path_view.hpp"
namespace graphics
{
struct GlyphMetrics;
class TextPath
{
private: