From 669a418f75c05d4a39e2bcaff2b7b93dec1c5764 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 3 Apr 2017 14:51:45 -0400 Subject: Drop FXSYS_ from math methods This Cl drops the FXSYS_ from math methods which are the same on all platforms. Bug: pdfium:694 Change-Id: I85c9ff841fd9095b1434f67319847ba0cd9df7ac Reviewed-on: https://pdfium-review.googlesource.com/3598 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fxfa/app/cxfa_textlayout.cpp | 4 ++-- xfa/fxfa/cxfa_ffwidget.cpp | 8 +++---- xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 36 ++++++++++++++----------------- xfa/fxfa/parser/cxfa_stroke.cpp | 4 ++-- xfa/fxfa/parser/cxfa_timezoneprovider.cpp | 4 ++-- 5 files changed, 26 insertions(+), 30 deletions(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp index f16fd8c1a9..9f4962e458 100644 --- a/xfa/fxfa/app/cxfa_textlayout.cpp +++ b/xfa/fxfa/app/cxfa_textlayout.cpp @@ -273,8 +273,8 @@ float CXFA_TextLayout::StartLayout(float fWidth) { if (!m_pLoader) m_pLoader = pdfium::MakeUnique(); - if (fWidth < 0 || (m_pLoader->m_fWidth > -1 && - FXSYS_fabs(fWidth - m_pLoader->m_fWidth) > 0)) { + if (fWidth < 0 || + (m_pLoader->m_fWidth > -1 && fabs(fWidth - m_pLoader->m_fWidth) > 0)) { m_pLoader->m_lineHeights.clear(); m_Blocks.clear(); Unload(); diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index e6f30c0467..1ebc6da353 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -640,8 +640,8 @@ bool CXFA_ImageRenderer::StartDIBSource() { FX_RECT image_rect = image_rect_f.GetOuterRect(); int dest_width = image_rect.Width(); int dest_height = image_rect.Height(); - if ((FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) || - (FXSYS_fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) { + if ((fabs(m_ImageMatrix.b) >= 0.5f || m_ImageMatrix.a == 0) || + (fabs(m_ImageMatrix.c) >= 0.5f || m_ImageMatrix.d == 0)) { if (m_bPrint && !(m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE)) { m_Result = false; return false; @@ -1550,8 +1550,8 @@ static void XFA_BOX_Fill_Radial(CXFA_Box box, crStart = temp; } CFX_Shading shading(rtFill.Center(), rtFill.Center(), 0, - FXSYS_sqrt(rtFill.Width() * rtFill.Width() + - rtFill.Height() * rtFill.Height()) / + sqrt(rtFill.Width() * rtFill.Width() + + rtFill.Height() * rtFill.Height()) / 2, true, true, crStart, crEnd); CFX_Color cr(&shading); diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index b95a6d3aab..d38a6715e8 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -615,8 +615,7 @@ void CXFA_FM2JSContext::Ceil(CFXJSE_Value* pThis, return; } - args.GetReturnValue()->SetFloat( - FXSYS_ceil(ValueToFloat(pThis, argValue.get()))); + args.GetReturnValue()->SetFloat(ceil(ValueToFloat(pThis, argValue.get()))); } // static @@ -688,8 +687,7 @@ void CXFA_FM2JSContext::Floor(CFXJSE_Value* pThis, return; } - args.GetReturnValue()->SetFloat( - FXSYS_floor(ValueToFloat(pThis, argValue.get()))); + args.GetReturnValue()->SetFloat(floor(ValueToFloat(pThis, argValue.get()))); } // static @@ -1419,7 +1417,7 @@ void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis, return; } int32_t iTime = (int32_t)ValueToFloat(pThis, timeValue.get()); - if (FXSYS_abs(iTime) < 1.0) { + if (abs(iTime) < 1.0) { args.GetReturnValue()->SetNull(); return; } @@ -1466,7 +1464,7 @@ void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, return; } float fTime = ValueToFloat(pThis, timeValue.get()); - if (FXSYS_fabs(fTime) < 1.0) { + if (fabs(fTime) < 1.0) { args.GetReturnValue()->SetNull(); return; } @@ -2407,9 +2405,8 @@ void CXFA_FM2JSContext::CTerm(CFXJSE_Value* pThis, return; } - args.GetReturnValue()->SetFloat( - FXSYS_log((float)(nFutureValue / nInitAmount)) / - FXSYS_log((float)(1 + nRate))); + args.GetReturnValue()->SetFloat(log((float)(nFutureValue / nInitAmount)) / + log((float)(1 + nRate))); } // static @@ -2487,10 +2484,10 @@ void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis, } float nRateOfMonth = nRate / 12; - int32_t iNums = (int32_t)( - (FXSYS_log10((float)(nPayment / nPrincipalAmount)) - - FXSYS_log10((float)(nPayment / nPrincipalAmount - nRateOfMonth))) / - FXSYS_log10((float)(1 + nRateOfMonth))); + int32_t iNums = + (int32_t)((log10((float)(nPayment / nPrincipalAmount)) - + log10((float)(nPayment / nPrincipalAmount - nRateOfMonth))) / + log10((float)(1 + nRateOfMonth))); int32_t iEnd = std::min((int32_t)(nFirstMonth + nNumberOfMonths - 1), iNums); if (nPayment < nPrincipalAmount * nRateOfMonth) { @@ -2622,10 +2619,10 @@ void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis, } float nRateOfMonth = nRate / 12; - int32_t iNums = (int32_t)( - (FXSYS_log10((float)(nPayment / nPrincipalAmount)) - - FXSYS_log10((float)(nPayment / nPrincipalAmount - nRateOfMonth))) / - FXSYS_log10((float)(1 + nRateOfMonth))); + int32_t iNums = + (int32_t)((log10((float)(nPayment / nPrincipalAmount)) - + log10((float)(nPayment / nPrincipalAmount - nRateOfMonth))) / + log10((float)(1 + nRateOfMonth))); int32_t iEnd = std::min((int32_t)(nFirstMonth + nNumberOfMonths - 1), iNums); if (nPayment < nPrincipalAmount * nRateOfMonth) { pContext->ThrowArgumentMismatchException(); @@ -2739,9 +2736,8 @@ void CXFA_FM2JSContext::Term(CFXJSE_Value* pThis, return; } - args.GetReturnValue()->SetFloat( - FXSYS_log((float)(nFuture / nMount * nRate) + 1) / - FXSYS_log((float)(1 + nRate))); + args.GetReturnValue()->SetFloat(log((float)(nFuture / nMount * nRate) + 1) / + log((float)(1 + nRate))); } // static diff --git a/xfa/fxfa/parser/cxfa_stroke.cpp b/xfa/fxfa/parser/cxfa_stroke.cpp index 2e1ef12ce5..df11cbee00 100644 --- a/xfa/fxfa/parser/cxfa_stroke.cpp +++ b/xfa/fxfa/parser/cxfa_stroke.cpp @@ -89,7 +89,7 @@ float CXFA_Stroke::GetRadius() const { bool CXFA_Stroke::SameStyles(CXFA_Stroke stroke, uint32_t dwFlags) const { if (m_pNode == stroke.GetNode()) return true; - if (FXSYS_fabs(GetThickness() - stroke.GetThickness()) >= 0.01f) + if (fabs(GetThickness() - stroke.GetThickness()) >= 0.01f) return false; if ((dwFlags & XFA_STROKE_SAMESTYLE_NoPresence) == 0 && IsVisible() != stroke.IsVisible()) { @@ -100,7 +100,7 @@ bool CXFA_Stroke::SameStyles(CXFA_Stroke stroke, uint32_t dwFlags) const { if (GetColor() != stroke.GetColor()) return false; if ((dwFlags & XFA_STROKE_SAMESTYLE_Corner) != 0 && - FXSYS_fabs(GetRadius() - stroke.GetRadius()) >= 0.01f) { + fabs(GetRadius() - stroke.GetRadius()) >= 0.01f) { return false; } return true; diff --git a/xfa/fxfa/parser/cxfa_timezoneprovider.cpp b/xfa/fxfa/parser/cxfa_timezoneprovider.cpp index ae31977e6d..022b9225b4 100644 --- a/xfa/fxfa/parser/cxfa_timezoneprovider.cpp +++ b/xfa/fxfa/parser/cxfa_timezoneprovider.cpp @@ -17,7 +17,7 @@ CXFA_TimeZoneProvider::CXFA_TimeZoneProvider() { _tzset(); } m_tz.tzHour = static_cast(_timezone / 3600 * -1); - m_tz.tzMinute = static_cast((FXSYS_abs(_timezone) % 3600) / 60); + m_tz.tzMinute = static_cast((abs(_timezone) % 3600) / 60); #else if (!g_bProviderTimeZoneSet) { g_bProviderTimeZoneSet = true; @@ -25,7 +25,7 @@ CXFA_TimeZoneProvider::CXFA_TimeZoneProvider() { } m_tz.tzHour = static_cast(timezone / 3600 * -1); m_tz.tzMinute = - static_cast((FXSYS_abs(static_cast(timezone)) % 3600) / 60); + static_cast((abs(static_cast(timezone)) % 3600) / 60); #endif } -- cgit v1.2.3