From 26dffbd99e9e98f633184c0e0754d0fac4acf914 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sat, 2 Jan 2016 11:18:15 -1000 Subject: [PATCH] More portable and reliable rectangle initialization --- specter/lib/Table.cpp | 4 ++-- specter/lib/TextField.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/specter/lib/Table.cpp b/specter/lib/Table.cpp index b021ad351..96dbd2ca0 100644 --- a/specter/lib/Table.cpp +++ b/specter/lib/Table.cpp @@ -597,8 +597,8 @@ std::vector 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; } diff --git a/specter/lib/TextField.cpp b/specter/lib/TextField.cpp index 56d047b5b..e4df5d643 100644 --- a/specter/lib/TextField.cpp +++ b/specter/lib/TextField.cpp @@ -577,7 +577,7 @@ boo::SWindowRect TextField::rectForCharacterRange(const std::pair& rang { const std::vector& 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& rang const std::vector& 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()