renamed StylesCache into ResourceStylesCache and moved corresponding files.

This commit is contained in:
rachytski 2012-03-10 20:49:05 +04:00 committed by Alex Zolotarev
parent 51ddc0f2fb
commit d09204fdef
24 changed files with 95 additions and 89 deletions

View file

@ -30,11 +30,11 @@ CoverageGenerator::CoverageGenerator(
m_resourceManager = rm;
m_renderContext = primaryRC->createShared();
m_currentStylesCache.reset(new yg::StylesCache(rm,
m_currentStylesCache.reset(new yg::ResourceStyleCache(rm,
rm->cacheThreadGlyphCacheID(),
glQueue));
m_workStylesCache.reset(new yg::StylesCache(rm,
m_workStylesCache.reset(new yg::ResourceStyleCache(rm,
rm->cacheThreadGlyphCacheID(),
glQueue));
@ -128,7 +128,7 @@ void CoverageGenerator::CoverScreen(ScreenBase const & screen, int sequenceID)
m_workCoverage = m_currentCoverage->Clone();
m_workCoverage->SetSequenceID(sequenceID);
m_workCoverage->SetStylesCache(m_workStylesCache.get());
m_workCoverage->SetResourceStyleCache(m_workStylesCache.get());
m_workCoverage->SetScreen(screen);
m_workCoverage->CacheInfoLayer();
@ -143,7 +143,7 @@ void CoverageGenerator::CoverScreen(ScreenBase const & screen, int sequenceID)
swap(m_currentCoverage, m_workCoverage);
swap(m_currentStylesCache, m_workStylesCache);
ASSERT(m_currentCoverage->GetStylesCache() == m_currentStylesCache.get(), ());
ASSERT(m_currentCoverage->GetResourceStyleCache() == m_currentStylesCache.get(), ());
}
delete m_workCoverage;
@ -169,7 +169,7 @@ void CoverageGenerator::MergeTile(Tiler::RectInfo const & rectInfo, int sequence
m_workCoverage = m_currentCoverage->Clone();
m_workCoverage->SetSequenceID(sequenceID);
m_workCoverage->SetStylesCache(m_workStylesCache.get());
m_workCoverage->SetResourceStyleCache(m_workStylesCache.get());
m_workCoverage->Merge(rectInfo);
m_workCoverage->CacheInfoLayer();
@ -184,7 +184,7 @@ void CoverageGenerator::MergeTile(Tiler::RectInfo const & rectInfo, int sequence
swap(m_currentCoverage, m_workCoverage);
swap(m_currentStylesCache, m_workStylesCache);
ASSERT(m_currentCoverage->GetStylesCache() == m_currentStylesCache.get(), ());
ASSERT(m_currentCoverage->GetResourceStyleCache() == m_currentStylesCache.get(), ());
}
/// we should delete workCoverage

View file

@ -21,6 +21,11 @@ class TileRenderer;
class TileCache;
class ScreenCoverage;
namespace yg
{
class ResourceStyleCache;
}
class CoverageGenerator
{
private:
@ -35,8 +40,8 @@ private:
ScreenCoverage * m_workCoverage;
ScreenCoverage * m_currentCoverage;
shared_ptr<yg::StylesCache> m_workStylesCache;
shared_ptr<yg::StylesCache> m_currentStylesCache;
shared_ptr<yg::ResourceStyleCache> m_workStylesCache;
shared_ptr<yg::ResourceStyleCache> m_currentStylesCache;
ScreenBase m_currentScreen;
int m_sequenceID;

View file

@ -304,16 +304,16 @@ void Ruler::draw(yg::gl::OverlayRenderer * s, math::Matrix<double, 3, 3> const &
}
}
void Ruler::map(yg::StylesCache * stylesCache) const
void Ruler::map(yg::ResourceStyleCache * stylesCache) const
{
}
bool Ruler::find(yg::StylesCache * stylesCache) const
bool Ruler::find(yg::ResourceStyleCache * stylesCache) const
{
return true;
}
void Ruler::getNonPackedRects(yg::StylesCache * stylesCache, vector<m2::PointU> & v) const
void Ruler::getNonPackedRects(yg::ResourceStyleCache * stylesCache, vector<m2::PointU> & v) const
{
}

View file

@ -8,7 +8,7 @@
namespace yg
{
class StylesCache;
class ResourceStyleCache;
namespace gl
{
@ -73,9 +73,9 @@ public:
void draw(yg::gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
void map(yg::StylesCache * stylesCache) const;
bool find(yg::StylesCache * stylesCache) const;
void getNonPackedRects(yg::StylesCache * stylesCache, vector<m2::PointU> & v) const;
void map(yg::ResourceStyleCache * stylesCache) const;
bool find(yg::ResourceStyleCache * stylesCache) const;
void getNonPackedRects(yg::ResourceStyleCache * stylesCache, vector<m2::PointU> & v) const;
int visualRank() const;
yg::OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const;

View file

@ -73,12 +73,12 @@ ScreenCoverage * ScreenCoverage::Clone()
return res;
}
void ScreenCoverage::SetStylesCache(yg::StylesCache * stylesCache)
void ScreenCoverage::SetResourceStyleCache(yg::ResourceStyleCache * stylesCache)
{
m_stylesCache = stylesCache;
}
yg::StylesCache * ScreenCoverage::GetStylesCache() const
yg::ResourceStyleCache * ScreenCoverage::GetResourceStyleCache() const
{
return m_stylesCache;
}

View file

@ -5,7 +5,7 @@
#include "../geometry/screenbase.hpp"
#include "../yg/info_layer.hpp"
#include "../yg/styles_cache.hpp"
#include "../yg/resource_style_cache.hpp"
#include "tile.hpp"
#include "tiler.hpp"
@ -59,7 +59,7 @@ private:
int m_leavesCount;
CoverageGenerator * m_coverageGenerator;
yg::StylesCache * m_stylesCache;
yg::ResourceStyleCache * m_stylesCache;
ScreenCoverage(ScreenCoverage const & src);
ScreenCoverage const & operator=(ScreenCoverage const & src);
@ -84,8 +84,8 @@ public:
/// Is this screen coverage contains only empty tiles
bool IsEmptyDrawingCoverage() const;
/// Setters/Getters for current stylesCache
void SetStylesCache(yg::StylesCache * stylesCache);
yg::StylesCache * GetStylesCache() const;
void SetResourceStyleCache(yg::ResourceStyleCache * stylesCache);
yg::ResourceStyleCache * GetResourceStyleCache() const;
/// Getter for InfoLayer
yg::InfoLayer * GetInfoLayer() const;
/// Cache info layer on current style cache

View file

@ -1,6 +1,6 @@
#include "circle_element.hpp"
#include "styles_cache.hpp"
#include "resource_style_cache.hpp"
#include "overlay_renderer.hpp"
#include "resource_style.hpp"
#include "skin.hpp"
@ -69,7 +69,7 @@ namespace yg
return 500;
}
void CircleElement::map(StylesCache * stylesCache) const
void CircleElement::map(ResourceStyleCache * stylesCache) const
{
shared_ptr<SkinPage> const & skinPage = stylesCache->cachePage();
@ -78,14 +78,14 @@ namespace yg
skinPage->mapCircleInfo(m_ci);
}
bool CircleElement::find(StylesCache * stylesCache) const
bool CircleElement::find(ResourceStyleCache * stylesCache) const
{
shared_ptr<SkinPage> const & skinPage = stylesCache->cachePage();
return skinPage->findCircleInfo(m_ci) != 0x00FFFFFF;
}
void CircleElement::getNonPackedRects(StylesCache * stylesCache, vector<m2::PointU> & v) const
void CircleElement::getNonPackedRects(ResourceStyleCache * stylesCache, vector<m2::PointU> & v) const
{
shared_ptr<SkinPage> const & skinPage = stylesCache->cachePage();

View file

@ -31,9 +31,9 @@ namespace yg
void draw(gl::OverlayRenderer * s, math::Matrix<double, 3, 3> const & m) const;
void map(StylesCache * stylesCache) const;
void getNonPackedRects(StylesCache * stylesCache, vector<m2::PointU> & v) const;
bool find(StylesCache * stylesCache) const;
void map(ResourceStyleCache * stylesCache) const;
void getNonPackedRects(ResourceStyleCache * stylesCache, vector<m2::PointU> & v) const;
bool find(ResourceStyleCache * stylesCache) const;
int visualRank() const;

View file

@ -48,19 +48,19 @@ namespace yg
m_elements[i]->draw(r, m);
}
void CompositeOverlayElement::map(StylesCache * stylesCache) const
void CompositeOverlayElement::map(ResourceStyleCache * stylesCache) const
{
for (unsigned i = 0; i < m_elements.size(); ++i)
m_elements[i]->map(stylesCache);
}
void CompositeOverlayElement::getNonPackedRects(StylesCache * stylesCache, vector<m2::PointU> & v) const
void CompositeOverlayElement::getNonPackedRects(ResourceStyleCache * stylesCache, vector<m2::PointU> & v) const
{
for (unsigned i = 0; i < m_elements.size(); ++i)
m_elements[i]->getNonPackedRects(stylesCache, v);
}
bool CompositeOverlayElement::find(StylesCache * stylesCache) const
bool CompositeOverlayElement::find(ResourceStyleCache * stylesCache) const
{
for (unsigned i = 0; i < m_elements.size(); ++i)
if (!m_elements[i]->find(stylesCache))

View file

@ -26,9 +26,9 @@ namespace yg
void draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
void map(StylesCache * stylesCache) const;
bool find(StylesCache * stylesCache) const;
void getNonPackedRects(StylesCache * stylesCache, vector<m2::PointU> & v) const;
void map(ResourceStyleCache * stylesCache) const;
bool find(ResourceStyleCache * stylesCache) const;
void getNonPackedRects(ResourceStyleCache * stylesCache, vector<m2::PointU> & v) const;
int visualRank() const;

View file

@ -2,7 +2,7 @@
#include "info_layer.hpp"
#include "text_element.hpp"
#include "styles_cache.hpp"
#include "resource_style_cache.hpp"
#include "../base/logging.hpp"
#include "../base/stl_add.hpp"
@ -225,7 +225,7 @@ namespace yg
return l->visualRank() > r->visualRank();
}
void InfoLayer::cache(StylesCache * stylesCache)
void InfoLayer::cache(ResourceStyleCache * stylesCache)
{
/// collecting elements into vector sorted by visualPriority
@ -358,7 +358,7 @@ namespace yg
return !res.empty();
}
bool InfoLayer::checkCached(StylesCache * s) const
bool InfoLayer::checkCached(ResourceStyleCache * s) const
{
vector<shared_ptr<OverlayElement> > v;
m_tree.ForEach(MakeBackInsertFunctor(v));

View file

@ -14,7 +14,7 @@
namespace yg
{
class StylesCache;
class ResourceStyleCache;
struct OverlayElementTraits
{
@ -47,7 +47,7 @@ namespace yg
void clear();
void cache(StylesCache * cache);
void cache(ResourceStyleCache * cache);
void setCouldOverlap(bool flag);
@ -56,7 +56,7 @@ namespace yg
void clip(m2::RectI const & r);
bool checkHasEquals(InfoLayer const * l) const;
bool checkCached(StylesCache * s) const;
bool checkCached(ResourceStyleCache * s) const;
InfoLayer * clone() const;
};

View file

@ -13,7 +13,7 @@ namespace yg
class OverlayRenderer;
}
class StylesCache;
class ResourceStyleCache;
class OverlayElement
{
@ -57,9 +57,9 @@ namespace yg
/// caching-related functions.
/// @{
virtual void getNonPackedRects(StylesCache * stylesCache, vector<m2::PointU> & sizes) const = 0;
virtual bool find(StylesCache * stylesCache) const = 0;
virtual void map(StylesCache * stylesCache) const = 0;
virtual void getNonPackedRects(ResourceStyleCache * stylesCache, vector<m2::PointU> & sizes) const = 0;
virtual bool find(ResourceStyleCache * stylesCache) const = 0;
virtual void map(ResourceStyleCache * stylesCache) const = 0;
/// @}
m2::PointD const & pivot() const;

View file

@ -86,7 +86,7 @@ namespace yg
m_glyphLayout.setPivot(pivot());
}
bool PathTextElement::find(StylesCache * stylesCache) const
bool PathTextElement::find(ResourceStyleCache * stylesCache) const
{
yg::FontDesc desc = m_fontDesc;
if (desc.m_isMasked)
@ -99,7 +99,7 @@ namespace yg
return TextElement::find(m_glyphLayout, stylesCache, desc);
}
void PathTextElement::getNonPackedRects(StylesCache * stylesCache, vector<m2::PointU> & v) const
void PathTextElement::getNonPackedRects(ResourceStyleCache * stylesCache, vector<m2::PointU> & v) const
{
yg::FontDesc desc = m_fontDesc;
if (desc.m_isMasked)
@ -111,7 +111,7 @@ namespace yg
TextElement::getNonPackedRects(m_glyphLayout, desc, stylesCache, v);
}
void PathTextElement::map(StylesCache * stylesCache) const
void PathTextElement::map(ResourceStyleCache * stylesCache) const
{
yg::FontDesc desc = m_fontDesc;

View file

@ -27,9 +27,9 @@ namespace yg
void draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
void getNonPackedRects(StylesCache * stylesCache, vector<m2::PointU> & v) const;
bool find(StylesCache * stylesCache) const;
void map(StylesCache * stylesCache) const;
void getNonPackedRects(ResourceStyleCache * stylesCache, vector<m2::PointU> & v) const;
bool find(ResourceStyleCache * stylesCache) const;
void map(ResourceStyleCache * stylesCache) const;
int visualRank() const;

View file

@ -1,6 +1,6 @@
#include "../base/SRC_FIRST.hpp"
#include "styles_cache.hpp"
#include "resource_style_cache.hpp"
#include "text_element.hpp"
#include "glyph_cache.hpp"
#include "skin_page.hpp"
@ -14,9 +14,9 @@
namespace yg
{
StylesCache::StylesCache(shared_ptr<ResourceManager> const & rm,
int glyphCacheID,
yg::gl::PacketsQueue * glQueue)
ResourceStyleCache::ResourceStyleCache(shared_ptr<ResourceManager> const & rm,
int glyphCacheID,
yg::gl::PacketsQueue * glQueue)
: m_rm(rm),
m_glQueue(glQueue)
{
@ -25,32 +25,32 @@ namespace yg
m_cachePage->setTexture(m_rm->styleCacheTextures()->Reserve());
}
StylesCache::~StylesCache()
ResourceStyleCache::~ResourceStyleCache()
{
m_rm->styleCacheTextures()->Free(m_cachePage->texture());
}
shared_ptr<SkinPage> const & StylesCache::cachePage()
shared_ptr<SkinPage> const & ResourceStyleCache::cachePage()
{
return m_cachePage;
}
shared_ptr<ResourceManager> const & StylesCache::resourceManager()
shared_ptr<ResourceManager> const & ResourceStyleCache::resourceManager()
{
return m_rm;
}
GlyphCache * StylesCache::glyphCache()
GlyphCache * ResourceStyleCache::glyphCache()
{
return m_glyphCache;
}
void StylesCache::clear()
void ResourceStyleCache::clear()
{
m_cachePage->clear();
}
void StylesCache::upload()
void ResourceStyleCache::upload()
{
m_cachePage->uploadData(m_glQueue);
@ -64,7 +64,7 @@ namespace yg
OGLCHECK(glFinish());
}
bool StylesCache::hasRoom(m2::PointU const * sizes, size_t cnt) const
bool ResourceStyleCache::hasRoom(m2::PointU const * sizes, size_t cnt) const
{
return m_cachePage->hasRoom(sizes, cnt);
}

View file

@ -19,7 +19,7 @@ namespace yg
/// - cache of potentially all yg::ResourceStyle's
/// - cache is build on the separate thread (CoverageGenerator thread)
/// - it is used to remove texture uploading code from the GUI-thread
class StylesCache
class ResourceStyleCache
{
private:
@ -31,11 +31,12 @@ namespace yg
public:
StylesCache(shared_ptr<ResourceManager> const & rm,
int glyphCacheID,
yg::gl::PacketsQueue * glQueue);
~StylesCache();
ResourceStyleCache(shared_ptr<ResourceManager> const & rm,
int glyphCacheID,
yg::gl::PacketsQueue * glQueue);
~ResourceStyleCache();
shared_ptr<SkinPage> const & cachePage();

View file

@ -287,7 +287,7 @@ namespace yg
m_glyphLayouts[i].setPivot(m_glyphLayouts[i].pivot() + offs);
}
void StraightTextElement::map(StylesCache * stylesCache) const
void StraightTextElement::map(ResourceStyleCache * stylesCache) const
{
for (unsigned i = 0; i < m_glyphLayouts.size(); ++i)
{
@ -303,7 +303,7 @@ namespace yg
}
}
bool StraightTextElement::find(StylesCache * stylesCache) const
bool StraightTextElement::find(ResourceStyleCache * stylesCache) const
{
for (unsigned i = 0; i < m_glyphLayouts.size(); ++i)
{
@ -323,7 +323,7 @@ namespace yg
return true;
}
void StraightTextElement::getNonPackedRects(StylesCache * stylesCache, vector<m2::PointU> & v) const
void StraightTextElement::getNonPackedRects(ResourceStyleCache * stylesCache, vector<m2::PointU> & v) const
{
for (unsigned i = 0; i < m_glyphLayouts.size(); ++i)
{

View file

@ -33,9 +33,9 @@ namespace yg
void draw(gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
void getNonPackedRects(StylesCache * stylesCache, vector<m2::PointU> & v) const;
bool find(StylesCache * stylesCache) const;
void map(StylesCache * stylesCache) const;
void getNonPackedRects(ResourceStyleCache * stylesCache, vector<m2::PointU> & v) const;
bool find(ResourceStyleCache * stylesCache) const;
void map(ResourceStyleCache * stylesCache) const;
int visualRank() const;

View file

@ -1,7 +1,7 @@
#include "../base/logging.hpp"
#include "symbol_element.hpp"
#include "styles_cache.hpp"
#include "resource_style_cache.hpp"
#include "resource_style.hpp"
#include "overlay_renderer.hpp"
#include "skin.hpp"
@ -86,16 +86,16 @@ namespace yg
style->m_pipelineID);
}
void SymbolElement::map(StylesCache * stylesCache) const
void SymbolElement::map(ResourceStyleCache * stylesCache) const
{
}
bool SymbolElement::find(StylesCache * stylesCache) const
bool SymbolElement::find(ResourceStyleCache * stylesCache) const
{
return true;
}
void SymbolElement::getNonPackedRects(StylesCache * stylesCache, vector<m2::PointU> & v) const
void SymbolElement::getNonPackedRects(ResourceStyleCache * stylesCache, vector<m2::PointU> & v) const
{
}

View file

@ -6,7 +6,7 @@ namespace yg
{
struct ResourceStyle;
class Skin;
class StylesCache;
class ResourceStyleCache;
class SymbolElement : public OverlayElement
{
@ -35,9 +35,9 @@ namespace yg
vector<m2::AnyRectD> const & boundRects() const;
void draw(gl::OverlayRenderer * s, math::Matrix<double, 3, 3> const & m) const;
void map(StylesCache * stylesCache) const;
void getNonPackedRects(StylesCache * stylesCache, vector<m2::PointU> & v) const;
bool find(StylesCache * stylesCache) const;
void map(ResourceStyleCache * stylesCache) const;
void getNonPackedRects(ResourceStyleCache * stylesCache, vector<m2::PointU> & v) const;
bool find(ResourceStyleCache * stylesCache) const;
uint32_t styleID() const;

View file

@ -2,7 +2,7 @@
#include "screen.hpp"
#include "skin.hpp"
#include "skin_page.hpp"
#include "styles_cache.hpp"
#include "resource_style_cache.hpp"
#include "resource_manager.hpp"
#include "overlay_renderer.hpp"
#include "resource_style.hpp"
@ -127,7 +127,7 @@ namespace yg
}
void TextElement::map(GlyphLayout const & layout,
StylesCache * stylesCache,
ResourceStyleCache * stylesCache,
FontDesc const & desc) const
{
if (!desc.IsValid())
@ -160,7 +160,7 @@ namespace yg
}
}
bool TextElement::find(GlyphLayout const & layout, StylesCache * stylesCache, FontDesc const & desc) const
bool TextElement::find(GlyphLayout const & layout, ResourceStyleCache * stylesCache, FontDesc const & desc) const
{
if (!desc.IsValid())
return false;
@ -185,7 +185,7 @@ namespace yg
void TextElement::getNonPackedRects(GlyphLayout const & layout,
FontDesc const & desc,
StylesCache * stylesCache,
ResourceStyleCache * stylesCache,
vector<m2::PointU> & v) const
{
if (!desc.IsValid())

View file

@ -51,16 +51,16 @@ namespace yg
using OverlayElement::getNonPackedRects;
void map(GlyphLayout const & layout,
StylesCache * stylesCache,
ResourceStyleCache * stylesCache,
FontDesc const & desc) const;
bool find(GlyphLayout const & layout,
StylesCache * stylesCache,
ResourceStyleCache * stylesCache,
FontDesc const & desc) const;
void getNonPackedRects(GlyphLayout const & layout,
FontDesc const & desc,
StylesCache * stylesCache,
ResourceStyleCache * stylesCache,
vector<m2::PointU> & v) const;
public:

View file

@ -53,7 +53,7 @@ SOURCES += \
symbol_element.cpp \
overlay_renderer.cpp \
render_state_updater.cpp \
styles_cache.cpp \
resource_style_cache.cpp \
composite_overlay_element.cpp \
path_text_element.cpp \
straight_text_element.cpp \
@ -112,7 +112,7 @@ HEADERS += \
symbol_element.hpp \
overlay_renderer.hpp \
render_state_updater.hpp \
styles_cache.hpp \
resource_style_cache.hpp \
composite_overlay_element.hpp \
path_text_element.hpp \
straight_text_element.hpp \