forked from organicmaps/organicmaps
fixed hasRoom for solid line style.
This commit is contained in:
parent
2dda2005f5
commit
0919989bf1
3 changed files with 24 additions and 5 deletions
21
yg/skin.cpp
21
yg/skin.cpp
|
@ -30,12 +30,26 @@ namespace yg
|
|||
m_resourceManager(resourceManager)
|
||||
{
|
||||
m_startTextPage = m_currentTextPage = m_pages.size();
|
||||
addDynamicPages(m_textPagesCount);
|
||||
addTextPages(m_textPagesCount);
|
||||
|
||||
m_startDynamicPage = m_currentDynamicPage = m_pages.size();
|
||||
addDynamicPages(m_dynamicPagesCount);
|
||||
}
|
||||
|
||||
void Skin::addTextPages(int count)
|
||||
{
|
||||
m_pages.reserve(m_pages.size() + count);
|
||||
|
||||
addClearPageFn(bind(&Skin::clearPageHandles, this, _1), 0);
|
||||
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
uint8_t pageID = (uint8_t)m_pages.size();
|
||||
m_pages.push_back(make_shared_ptr(new SkinPage(m_resourceManager, pageID)));
|
||||
m_pages.back()->addOverflowFn(bind(&Skin::changeCurrentTextPage, this), 0);
|
||||
}
|
||||
}
|
||||
|
||||
void Skin::addDynamicPages(int count)
|
||||
{
|
||||
m_pages.reserve(m_pages.size() + count);
|
||||
|
@ -46,7 +60,7 @@ namespace yg
|
|||
{
|
||||
uint8_t pageID = (uint8_t)m_pages.size();
|
||||
m_pages.push_back(make_shared_ptr(new SkinPage(m_resourceManager, pageID)));
|
||||
m_pages.back()->addOverflowFn(bind(&Skin::onOverflow, this, pageID), 0);
|
||||
m_pages.back()->addOverflowFn(bind(&Skin::changeCurrentDynamicPage, this), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,11 +194,12 @@ namespace yg
|
|||
/// Called from the skin page on handles overflow.
|
||||
/// Never called on texture overflow, as this situation
|
||||
/// are explicitly checked in the mapXXX() functions.
|
||||
void Skin::onOverflow(uint8_t pageID)
|
||||
/* void Skin::onOverflow(uint8_t pageID)
|
||||
{
|
||||
LOG(LINFO, ("Called from SkinPage as a reaction on handles overflow for pageID=", (uint32_t)pageID));
|
||||
changeCurrentDynamicPage();
|
||||
}
|
||||
*/
|
||||
|
||||
void Skin::changeCurrentDynamicPage()
|
||||
{
|
||||
|
|
|
@ -70,6 +70,7 @@ namespace yg
|
|||
friend class SkinLoader;
|
||||
|
||||
void addDynamicPages(int count);
|
||||
void addTextPages(int count);
|
||||
|
||||
typedef pair<uint8_t, uint32_t> id_pair_t;
|
||||
id_pair_t unpackID(uint32_t id) const;
|
||||
|
@ -92,7 +93,7 @@ namespace yg
|
|||
void callOverflowFns(uint8_t pageID);
|
||||
|
||||
void clearPageHandles(uint8_t pageID);
|
||||
void onOverflow(uint8_t pageID);
|
||||
// void onOverflow(uint8_t pageID);
|
||||
|
||||
void changeCurrentDynamicPage();
|
||||
void changeCurrentTextPage();
|
||||
|
|
|
@ -315,7 +315,10 @@ namespace yg
|
|||
bool SkinPage::hasRoom(const PenInfo &penInfo) const
|
||||
{
|
||||
if (penInfo.m_isSolid)
|
||||
return hasRoom(penInfo.m_color);
|
||||
{
|
||||
return m_packer.hasRoom(penInfo.m_w + 4, penInfo.m_w + 4);
|
||||
// return hasRoom(penInfo.m_color);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t len = static_cast<uint32_t>(accumulate(penInfo.m_pat.begin(), penInfo.m_pat.end(), 0.0));
|
||||
|
|
Loading…
Add table
Reference in a new issue