BorderWidthImpl: let's try if this is a better way to convert to int

Change-Id: Ib374998199afff347786764716646e73dd12de2a
This commit is contained in:
Michael Stahl 2012-07-06 16:11:25 +02:00
parent 190ca072fc
commit 3c6bc3cb6a

View file

@ -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)