diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-07-06 16:11:25 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-07-06 16:18:11 +0200 |
commit | 3c6bc3cb6a673c552e2839e421656341151bf12e (patch) | |
tree | 04c82385de415f16b1468fc5d7dc2683f5f1be18 /svtools | |
parent | 190ca072fc1c8679c586867582c816d98016f343 (diff) |
BorderWidthImpl: let's try if this is a better way to convert to int
Change-Id: Ib374998199afff347786764716646e73dd12de2a
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 7dff33ddd20b..47d455334c2c 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -326,7 +326,8 @@ long BorderWidthImpl::GetLine1( long nWidth ) const long const nConstant2 = (m_nFlags & CHANGE_LINE2) ? 0 : m_nRate2; long const nConstantD = (m_nFlags & CHANGE_DIST ) ? 0 : m_nRateGap; result = std::max<long>(0, - static_cast<long>(m_nRate1 * nWidth) - (nConstant2 + nConstantD)); + static_cast<long>((m_nRate1 * nWidth) + 0.5) + - (nConstant2 + nConstantD)); } return result; } @@ -339,7 +340,8 @@ long BorderWidthImpl::GetLine2( long nWidth ) const long const nConstant1 = (m_nFlags & CHANGE_LINE1) ? 0 : m_nRate1; long const nConstantD = (m_nFlags & CHANGE_DIST ) ? 0 : m_nRateGap; result = std::max<long>(0, - static_cast<long>(m_nRate2 * nWidth) - (nConstant1 + nConstantD)); + static_cast<long>((m_nRate2 * nWidth) + 0.5) + - (nConstant1 + nConstantD)); } return result; } @@ -352,7 +354,8 @@ long BorderWidthImpl::GetGap( long nWidth ) const long const nConstant1 = (m_nFlags & CHANGE_LINE1) ? 0 : m_nRate1; long const nConstant2 = (m_nFlags & CHANGE_LINE2) ? 0 : m_nRate2; result = std::max<long>(0, - static_cast<long>(m_nRateGap * nWidth) - (nConstant1 + nConstant2)); + static_cast<long>((m_nRateGap * nWidth) + 0.5) + - (nConstant1 + nConstant2)); } // Avoid having too small distances (less than 0.1pt) |