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:25:54 +0200 |
commit | cae7775794f87a3b179451cedc584958c6215432 (patch) | |
tree | 0415ac35c02ccf59b44225ec3a80fdaad5916f8e /svtools | |
parent | a8651a4bf3031bdf16a84ddf774eaf699a617426 (diff) |
BorderWidthImpl: let's try if this is a better way to convert to int
Change-Id: Ib374998199afff347786764716646e73dd12de2a
(cherry picked from commit 3c6bc3cb6a673c552e2839e421656341151bf12e)
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 a1d8906c0919..56658586d9cc 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -325,7 +325,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; } @@ -338,7 +339,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; } @@ -351,7 +353,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) |