mirror of https://github.com/AxioDL/metaforce.git
More portable and reliable rectangle initialization
This commit is contained in:
parent
5306e48481
commit
26dffbd99e
|
@ -597,8 +597,8 @@ std::vector<boo::SWindowRect> Table::getCellRects(const boo::SWindowRect& sub) c
|
|||
{
|
||||
float nextSplit = (i==m_columns-1) ? 1.0 : splits[i+1];
|
||||
int x = nextSplit * sub.size[0];
|
||||
ret.push_back({{sub.location[0] + lastX, sub.location[1]},
|
||||
{x - lastX, int(ROW_HEIGHT * pf)}});
|
||||
ret.push_back({sub.location[0] + lastX, sub.location[1],
|
||||
x - lastX, int(ROW_HEIGHT * pf)});
|
||||
lastX = x;
|
||||
}
|
||||
|
||||
|
|
|
@ -577,7 +577,7 @@ boo::SWindowRect TextField::rectForCharacterRange(const std::pair<int,int>& rang
|
|||
{
|
||||
const std::vector<TextView::RenderGlyph>& glyphs = m_text->accessGlyphs();
|
||||
const TextView::RenderGlyph& g = glyphs.back();
|
||||
return {{subRect().location[0] + int(g.m_pos[3][0]), subRect().location[1] + int(g.m_pos[3][1])}};
|
||||
return {subRect().location[0] + int(g.m_pos[3][0]), subRect().location[1] + int(g.m_pos[3][1]), 0, 0};
|
||||
}
|
||||
begin += range.first;
|
||||
size_t endIdx = std::min(size_t(range.first + range.second), curLen);
|
||||
|
@ -588,8 +588,8 @@ boo::SWindowRect TextField::rectForCharacterRange(const std::pair<int,int>& rang
|
|||
const std::vector<TextView::RenderGlyph>& glyphs = m_text->accessGlyphs();
|
||||
const TextView::RenderGlyph& g1 = glyphs[range.first];
|
||||
const TextView::RenderGlyph& g2 = glyphs[endIdx];
|
||||
return {{subRect().location[0] + int(g1.m_pos[1][0]), subRect().location[1] + int(g1.m_pos[1][1])},
|
||||
{int(g2.m_pos[3][0]-g1.m_pos[1][0]), int(g2.m_pos[0][1]-g1.m_pos[1][1])}};
|
||||
return {subRect().location[0] + int(g1.m_pos[1][0]), subRect().location[1] + int(g1.m_pos[1][1]),
|
||||
int(g2.m_pos[3][0]-g1.m_pos[1][0]), int(g2.m_pos[0][1]-g1.m_pos[1][1])};
|
||||
}
|
||||
|
||||
void TextField::think()
|
||||
|
|
Loading…
Reference in New Issue