From f01e4a5ec03c6b232d41dc878a3640924150f2a7 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 20 Aug 2018 17:14:26 +0000 Subject: Use more consts in CFX_Break. Change-Id: I57cd74581849a8f434f64c4ec3c4ad3ce1f92546 Reviewed-on: https://pdfium-review.googlesource.com/40630 Reviewed-by: Henrique Nakashima Commit-Queue: Lei Zhang --- xfa/fgas/layout/cfx_break.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'xfa/fgas/layout/cfx_break.cpp') diff --git a/xfa/fgas/layout/cfx_break.cpp b/xfa/fgas/layout/cfx_break.cpp index 43ef9a3833..35c637a51f 100644 --- a/xfa/fgas/layout/cfx_break.cpp +++ b/xfa/fgas/layout/cfx_break.cpp @@ -12,11 +12,8 @@ #include "third_party/base/stl_util.h" #include "xfa/fgas/font/cfgas_gefont.h" -namespace { - -const int kMinimumTabWidth = 160000; - -} // namespace +const float CFX_Break::kConversionFactor = 20000.0f; +const int CFX_Break::kMinimumTabWidth = 160000; CFX_Break::CFX_Break(uint32_t dwLayoutStyles) : m_dwLayoutStyles(dwLayoutStyles) { @@ -102,7 +99,8 @@ void CFX_Break::SetTabWidth(float fTabWidth) { // Note, the use of max here was only done in the TxtBreak code. Leaving this // in for the RTFBreak code for consistency. If we see issues with tab widths // we may need to fix this. - m_iTabWidth = std::max(FXSYS_round(fTabWidth * 20000.0f), kMinimumTabWidth); + m_iTabWidth = + std::max(FXSYS_round(fTabWidth * kConversionFactor), kMinimumTabWidth); } void CFX_Break::SetDefaultChar(wchar_t wch) { @@ -125,19 +123,19 @@ void CFX_Break::SetParagraphBreakChar(wchar_t wch) { } void CFX_Break::SetLineBreakTolerance(float fTolerance) { - m_iTolerance = FXSYS_round(fTolerance * 20000.0f); + m_iTolerance = FXSYS_round(fTolerance * kConversionFactor); } void CFX_Break::SetCharSpace(float fCharSpace) { - m_iCharSpace = FXSYS_round(fCharSpace * 20000.0f); + m_iCharSpace = FXSYS_round(fCharSpace * kConversionFactor); } void CFX_Break::SetLineBoundary(float fLineStart, float fLineEnd) { if (fLineStart > fLineEnd) return; - m_iLineStart = FXSYS_round(fLineStart * 20000.0f); - m_iLineWidth = FXSYS_round(fLineEnd * 20000.0f); + m_iLineStart = FXSYS_round(fLineStart * kConversionFactor); + m_iLineWidth = FXSYS_round(fLineEnd * kConversionFactor); m_pCurLine->m_iStart = std::min(m_pCurLine->m_iStart, m_iLineWidth); m_pCurLine->m_iStart = std::max(m_pCurLine->m_iStart, m_iLineStart); } -- cgit v1.2.3