diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-11-02 15:18:09 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-11-02 15:18:34 +0100 |
commit | 861b28b88909ec39fc83fccc0ab23d288128aa0e (patch) | |
tree | 352a84c4144892f0cd07cbee7f00d172ce4906ae /libreofficekit/qa | |
parent | 901fa421e1d446408116d1fe2eb6f070b5946dc9 (diff) |
sc lok: fix rounding errors with non-100% zoom
There were two problems here:
1) ScTabView::getRowColumnHeaders() did not expose twip values directly,
but used ScRow/ColBar::GetEntrySize(), which does a twip -> pixel
conversion, and then converted it back to twip. Avoid this unnecessary
roundtrip.
2) ScViewData::ToPixel() trunaces the resulting float to an integer, so
if the result is e.g. 67.7 pixels, then Calc handled that as 67, but
gtktiledviewer rounded that up to 68, resulting in non-matching headers
for the rendered tiles.
Change-Id: Ie6ed1ea923a423d1526eeb235b7b87106fd2f20b
Diffstat (limited to 'libreofficekit/qa')
-rw-r--r-- | libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index c8395a3938a3..3d6577d0aa6e 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -256,7 +256,7 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi rWindow.m_pRowBar->m_aHeaders.clear(); for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows")) { - int nSize = std::round(lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get<std::string>("size").c_str()))); + int nSize = lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get<std::string>("size").c_str())); Header aHeader(nSize, rValue.second.get<std::string>("text")); rWindow.m_pRowBar->m_aHeaders.push_back(aHeader); } @@ -266,7 +266,7 @@ gboolean TiledRowColumnBar::docConfigureEvent(GtkWidget* pDocView, GdkEventConfi rWindow.m_pColumnBar->m_aHeaders.clear(); for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("columns")) { - int nSize = std::round(lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get<std::string>("size").c_str()))); + int nSize = lok_doc_view_twip_to_pixel(LOK_DOC_VIEW(pDocView), std::atof(rValue.second.get<std::string>("size").c_str())); Header aHeader(nSize, rValue.second.get<std::string>("text")); rWindow.m_pColumnBar->m_aHeaders.push_back(aHeader); } |