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 --- core/fpdfapi/page/cpdf_colorspace.cpp | 2 +- core/fpdfapi/page/cpdf_textstate.cpp | 8 +-- core/fpdfapi/page/cpdf_tilingpattern.cpp | 4 +- core/fpdfapi/page/fpdf_page_func.cpp | 18 +++---- core/fpdfapi/render/cpdf_devicebuffer.cpp | 2 +- core/fpdfapi/render/cpdf_imagerenderer.cpp | 7 ++- core/fpdfapi/render/cpdf_renderstatus.cpp | 81 ++++++++++++++---------------- core/fpdfapi/render/cpdf_type3cache.cpp | 4 +- core/fpdfapi/render/cpdf_type3glyphs.cpp | 2 +- core/fpdftext/cpdf_textpage.cpp | 62 +++++++++++------------ core/fxcodec/codec/fx_codec_flate.cpp | 6 +-- core/fxcodec/codec/fx_codec_progress.cpp | 30 +++++------ core/fxcrt/cfx_decimal.cpp | 4 +- core/fxcrt/fx_basic_coords.cpp | 55 ++++++++++---------- core/fxcrt/fx_coordinates.h | 6 +-- core/fxcrt/fx_ext.h | 1 - core/fxcrt/fx_extension.cpp | 7 +-- core/fxcrt/fx_system.h | 14 +----- core/fxge/agg/fx_agg_driver.cpp | 3 +- core/fxge/dib/cfx_dibsource.cpp | 2 +- core/fxge/dib/cfx_imagerenderer.cpp | 10 ++-- core/fxge/dib/cfx_imagetransformer.cpp | 21 ++++---- core/fxge/dib/fx_dib_engine.cpp | 39 +++++++------- core/fxge/ge/cfx_facecache.cpp | 10 ++-- core/fxge/ge/cfx_fontmapper.cpp | 2 +- core/fxge/ge/cfx_pathdata.cpp | 19 ++++--- core/fxge/ge/cfx_renderdevice.cpp | 22 ++++---- core/fxge/win32/cfx_psrenderer.cpp | 16 +++--- core/fxge/win32/fx_win32_device.cpp | 7 ++- core/fxge/win32/fx_win32_print.cpp | 6 +-- fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp | 2 +- fpdfsdk/javascript/JS_Value.cpp | 11 ++-- fpdfsdk/pdfwindow/PWL_ScrollBar.cpp | 4 +- fxbarcode/oned/BC_OneDimWriter.cpp | 3 +- third_party/agg23/0000-bug-466.patch | 10 ++-- third_party/agg23/agg_curves.cpp | 15 +++--- third_party/agg23/agg_math.h | 4 +- third_party/agg23/agg_math_stroke.h | 34 ++++++------- third_party/agg23/agg_vcgen_dash.cpp | 2 +- xfa/fde/cfde_path.cpp | 25 +++++---- xfa/fde/cfde_renderdevice.cpp | 7 ++- xfa/fde/cfde_txtedtengine.cpp | 3 +- xfa/fde/css/cfde_cssnumbervalue.cpp | 2 +- xfa/fgas/crt/cfgas_formatstring.cpp | 4 +- xfa/fgas/layout/fgas_rtfbreak.cpp | 2 +- xfa/fgas/layout/fgas_textbreak.cpp | 2 +- xfa/fwl/cfwl_edit.cpp | 2 +- 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 +- xfa/fxgraphics/cfx_graphics.cpp | 2 +- xfa/fxgraphics/cfx_path.cpp | 16 +++--- 54 files changed, 315 insertions(+), 361 deletions(-) diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp index 3244319cc2..913c9c728d 100644 --- a/core/fpdfapi/page/cpdf_colorspace.cpp +++ b/core/fpdfapi/page/cpdf_colorspace.cpp @@ -265,7 +265,7 @@ class Matrix_3by3 { Matrix_3by3 Inverse() { float det = a * (e * i - f * h) - b * (i * d - f * g) + c * (d * h - e * g); - if (FXSYS_fabs(det) < std::numeric_limits::epsilon()) + if (fabs(det) < std::numeric_limits::epsilon()) return Matrix_3by3(); return Matrix_3by3( diff --git a/core/fpdfapi/page/cpdf_textstate.cpp b/core/fpdfapi/page/cpdf_textstate.cpp index 520cb7365b..ed90bd310d 100644 --- a/core/fpdfapi/page/cpdf_textstate.cpp +++ b/core/fpdfapi/page/cpdf_textstate.cpp @@ -139,19 +139,19 @@ void CPDF_TextState::TextData::SetFont(CPDF_Font* pFont) { } float CPDF_TextState::TextData::GetFontSizeV() const { - return FXSYS_fabs(FXSYS_sqrt2(m_Matrix[1], m_Matrix[3]) * m_FontSize); + return fabs(FXSYS_sqrt2(m_Matrix[1], m_Matrix[3]) * m_FontSize); } float CPDF_TextState::TextData::GetFontSizeH() const { - return FXSYS_fabs(FXSYS_sqrt2(m_Matrix[0], m_Matrix[2]) * m_FontSize); + return fabs(FXSYS_sqrt2(m_Matrix[0], m_Matrix[2]) * m_FontSize); } float CPDF_TextState::TextData::GetBaselineAngle() const { - return FXSYS_atan2(m_Matrix[2], m_Matrix[0]); + return atan2(m_Matrix[2], m_Matrix[0]); } float CPDF_TextState::TextData::GetShearAngle() const { - return GetBaselineAngle() + FXSYS_atan2(m_Matrix[1], m_Matrix[3]); + return GetBaselineAngle() + atan2(m_Matrix[1], m_Matrix[3]); } bool SetTextRenderingModeFromInt(int iMode, TextRenderingMode* mode) { diff --git a/core/fpdfapi/page/cpdf_tilingpattern.cpp b/core/fpdfapi/page/cpdf_tilingpattern.cpp index fb46dd2b3e..a68b4423e5 100644 --- a/core/fpdfapi/page/cpdf_tilingpattern.cpp +++ b/core/fpdfapi/page/cpdf_tilingpattern.cpp @@ -41,8 +41,8 @@ bool CPDF_TilingPattern::Load() { return false; m_bColored = pDict->GetIntegerFor("PaintType") == 1; - m_XStep = (float)FXSYS_fabs(pDict->GetNumberFor("XStep")); - m_YStep = (float)FXSYS_fabs(pDict->GetNumberFor("YStep")); + m_XStep = (float)fabs(pDict->GetNumberFor("XStep")); + m_YStep = (float)fabs(pDict->GetNumberFor("YStep")); CPDF_Stream* pStream = m_pPatternObj->AsStream(); if (!pStream) diff --git a/core/fpdfapi/page/fpdf_page_func.cpp b/core/fpdfapi/page/fpdf_page_func.cpp index 30f3b895d4..8ea4194eaa 100644 --- a/core/fpdfapi/page/fpdf_page_func.cpp +++ b/core/fpdfapi/page/fpdf_page_func.cpp @@ -289,15 +289,15 @@ bool CPDF_PSEngine::DoOperator(PDF_PSOP op) { break; case PSOP_ABS: d1 = Pop(); - Push((float)FXSYS_fabs(d1)); + Push((float)fabs(d1)); break; case PSOP_CEILING: d1 = Pop(); - Push((float)FXSYS_ceil(d1)); + Push((float)ceil(d1)); break; case PSOP_FLOOR: d1 = Pop(); - Push((float)FXSYS_floor(d1)); + Push((float)floor(d1)); break; case PSOP_ROUND: d1 = Pop(); @@ -309,20 +309,20 @@ bool CPDF_PSEngine::DoOperator(PDF_PSOP op) { break; case PSOP_SQRT: d1 = Pop(); - Push((float)FXSYS_sqrt(d1)); + Push((float)sqrt(d1)); break; case PSOP_SIN: d1 = Pop(); - Push((float)FXSYS_sin(d1 * FX_PI / 180.0f)); + Push((float)sin(d1 * FX_PI / 180.0f)); break; case PSOP_COS: d1 = Pop(); - Push((float)FXSYS_cos(d1 * FX_PI / 180.0f)); + Push((float)cos(d1 * FX_PI / 180.0f)); break; case PSOP_ATAN: d2 = Pop(); d1 = Pop(); - d1 = (float)(FXSYS_atan2(d1, d2) * 180.0 / FX_PI); + d1 = (float)(atan2(d1, d2) * 180.0 / FX_PI); if (d1 < 0) { d1 += 360; } @@ -335,11 +335,11 @@ bool CPDF_PSEngine::DoOperator(PDF_PSOP op) { break; case PSOP_LN: d1 = Pop(); - Push((float)FXSYS_log(d1)); + Push((float)log(d1)); break; case PSOP_LOG: d1 = Pop(); - Push((float)FXSYS_log10(d1)); + Push((float)log10(d1)); break; case PSOP_CVI: i1 = (int)Pop(); diff --git a/core/fpdfapi/render/cpdf_devicebuffer.cpp b/core/fpdfapi/render/cpdf_devicebuffer.cpp index 67641676ae..605e09bb5b 100644 --- a/core/fpdfapi/render/cpdf_devicebuffer.cpp +++ b/core/fpdfapi/render/cpdf_devicebuffer.cpp @@ -44,7 +44,7 @@ bool CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, } #endif CFX_Matrix ctm = m_pDevice->GetCTM(); - m_Matrix.Concat(CFX_Matrix(FXSYS_fabs(ctm.a), 0, 0, FXSYS_fabs(ctm.d), 0, 0)); + m_Matrix.Concat(CFX_Matrix(fabs(ctm.a), 0, 0, fabs(ctm.d), 0, 0)); CFX_FloatRect rect(*pRect); m_Matrix.TransformRect(rect); diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp index 858b3c83c6..c42c781dc2 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.cpp +++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp @@ -433,8 +433,8 @@ bool CPDF_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 (NotDrawing()) { m_Result = false; return false; @@ -510,8 +510,7 @@ bool CPDF_ImageRenderer::StartBitmapAlpha() { else pAlphaMask = m_pDIBSource->CloneAlphaMask(); - if (FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || - FXSYS_fabs(m_ImageMatrix.c) >= 0.5f) { + if (fabs(m_ImageMatrix.b) >= 0.5f || fabs(m_ImageMatrix.c) >= 0.5f) { int left; int top; CFX_RetainPtr pTransformed = diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 5320422b41..f2d888bdeb 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -248,8 +248,8 @@ void DrawRadialShading(const CFX_RetainPtr& pBitmap, int pitch = pBitmap->GetPitch(); bool bDecreasing = false; if (start_r > end_r) { - int length = (int)FXSYS_sqrt((((start_x - end_x) * (start_x - end_x)) + - ((start_y - end_y) * (start_y - end_y)))); + int length = (int)sqrt((((start_x - end_x) * (start_x - end_x)) + + ((start_y - end_y) * (start_y - end_y)))); if (length < start_r - end_r) { bDecreasing = true; } @@ -272,7 +272,7 @@ void DrawRadialShading(const CFX_RetainPtr& pBitmap, if (b2_4ac < 0) { continue; } - float root = FXSYS_sqrt(b2_4ac); + float root = sqrt(b2_4ac); float s1, s2; if (a > 0) { s1 = (-b - root) / (2 * a); @@ -403,8 +403,8 @@ void DrawGouraud(const CFX_RetainPtr& pBitmap, if (min_y == max_y) return; - int min_yi = std::max(static_cast(FXSYS_floor(min_y)), 0); - int max_yi = static_cast(FXSYS_ceil(max_y)); + int min_yi = std::max(static_cast(floor(min_y)), 0); + int max_yi = static_cast(ceil(max_y)); if (max_yi >= pBitmap->GetHeight()) max_yi = pBitmap->GetHeight() - 1; @@ -436,13 +436,13 @@ void DrawGouraud(const CFX_RetainPtr& pBitmap, int min_x, max_x, start_index, end_index; if (inter_x[0] < inter_x[1]) { - min_x = (int)FXSYS_floor(inter_x[0]); - max_x = (int)FXSYS_ceil(inter_x[1]); + min_x = (int)floor(inter_x[0]); + max_x = (int)ceil(inter_x[1]); start_index = 0; end_index = 1; } else { - min_x = (int)FXSYS_floor(inter_x[1]); - max_x = (int)FXSYS_ceil(inter_x[0]); + min_x = (int)floor(inter_x[1]); + max_x = (int)ceil(inter_x[0]); start_index = 1; end_index = 0; } @@ -701,9 +701,8 @@ struct Coon_Color { } int Distance(Coon_Color& o) { - return std::max({FXSYS_abs(comp[0] - o.comp[0]), - FXSYS_abs(comp[1] - o.comp[1]), - FXSYS_abs(comp[2] - o.comp[2])}); + return std::max({abs(comp[0] - o.comp[0]), abs(comp[1] - o.comp[1]), + abs(comp[2] - o.comp[2])}); } }; @@ -1130,15 +1129,13 @@ bool CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, FX_RECT rtClip = m_pDevice->GetClipBox(); if (!bLogical) { CFX_Matrix dCTM = m_pDevice->GetCTM(); - float a = FXSYS_fabs(dCTM.a); - float d = FXSYS_fabs(dCTM.d); + float a = fabs(dCTM.a); + float d = fabs(dCTM.d); if (a != 1.0f || d != 1.0f) { - rect.right = rect.left + (int32_t)FXSYS_ceil((float)rect.Width() * a); - rect.bottom = rect.top + (int32_t)FXSYS_ceil((float)rect.Height() * d); - rtClip.right = - rtClip.left + (int32_t)FXSYS_ceil((float)rtClip.Width() * a); - rtClip.bottom = - rtClip.top + (int32_t)FXSYS_ceil((float)rtClip.Height() * d); + rect.right = rect.left + (int32_t)ceil((float)rect.Width() * a); + rect.bottom = rect.top + (int32_t)ceil((float)rect.Height() * d); + rtClip.right = rtClip.left + (int32_t)ceil((float)rtClip.Width() * a); + rtClip.bottom = rtClip.top + (int32_t)ceil((float)rtClip.Height() * d); } } rect.Intersect(rtClip); @@ -1196,8 +1193,8 @@ bool CPDF_RenderStatus::DrawObjWithBlend(CPDF_PageObject* pObj, void CPDF_RenderStatus::GetScaledMatrix(CFX_Matrix& matrix) const { CFX_Matrix dCTM = m_pDevice->GetCTM(); - matrix.a *= FXSYS_fabs(dCTM.a); - matrix.d *= FXSYS_fabs(dCTM.d); + matrix.a *= fabs(dCTM.a); + matrix.d *= fabs(dCTM.d); } void CPDF_RenderStatus::DrawObjWithBackground(CPDF_PageObject* pObj, @@ -1534,8 +1531,8 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, return true; CFX_Matrix deviceCTM = m_pDevice->GetCTM(); - float scaleX = FXSYS_fabs(deviceCTM.a); - float scaleY = FXSYS_fabs(deviceCTM.d); + float scaleX = fabs(deviceCTM.a); + float scaleY = fabs(deviceCTM.d); int width = FXSYS_round((float)rect.Width() * scaleX); int height = FXSYS_round((float)rect.Height() * scaleY); CFX_FxgeDevice bitmap_device; @@ -1631,8 +1628,8 @@ CFX_RetainPtr CPDF_RenderStatus::GetBackdrop( left = bbox.left; top = bbox.top; CFX_Matrix deviceCTM = m_pDevice->GetCTM(); - float scaleX = FXSYS_fabs(deviceCTM.a); - float scaleY = FXSYS_fabs(deviceCTM.d); + float scaleX = fabs(deviceCTM.a); + float scaleY = fabs(deviceCTM.d); int width = FXSYS_round(bbox.Width() * scaleX); int height = FXSYS_round(bbox.Height() * scaleY); auto pBackdrop = pdfium::MakeRetain(); @@ -1813,8 +1810,8 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, return true; CFX_Matrix dCTM = m_pDevice->GetCTM(); - float sa = FXSYS_fabs(dCTM.a); - float sd = FXSYS_fabs(dCTM.d); + float sa = fabs(dCTM.a); + float sd = fabs(dCTM.d); CFX_Matrix text_matrix = textobj->GetTextMatrix(); CFX_Matrix char_matrix = pType3Font->GetFontMatrix(); float font_size = textobj->m_TextState.GetFontSize(); @@ -2196,10 +2193,10 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, return; } CFX_Matrix dCTM = m_pDevice->GetCTM(); - float sa = FXSYS_fabs(dCTM.a); - float sd = FXSYS_fabs(dCTM.d); - clip_box.right = clip_box.left + (int32_t)FXSYS_ceil(clip_box.Width() * sa); - clip_box.bottom = clip_box.top + (int32_t)FXSYS_ceil(clip_box.Height() * sd); + float sa = fabs(dCTM.a); + float sd = fabs(dCTM.d); + clip_box.right = clip_box.left + (int32_t)ceil(clip_box.Width() * sa); + clip_box.bottom = clip_box.top + (int32_t)ceil(clip_box.Height() * sd); CFX_Matrix mtPattern2Device = *pPattern->pattern_to_form(); mtPattern2Device.Concat(*pObj2Device); GetScaledMatrix(mtPattern2Device); @@ -2212,8 +2209,8 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, } CFX_FloatRect cell_bbox = pPattern->bbox(); mtPattern2Device.TransformRect(cell_bbox); - int width = (int)FXSYS_ceil(cell_bbox.Width()); - int height = (int)FXSYS_ceil(cell_bbox.Height()); + int width = (int)ceil(cell_bbox.Width()); + int height = (int)ceil(cell_bbox.Height()); if (width == 0) { width = 1; } @@ -2227,14 +2224,14 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, CFX_FloatRect clip_box_p(clip_box); mtDevice2Pattern.TransformRect(clip_box_p); - min_col = (int)FXSYS_ceil((clip_box_p.left - pPattern->bbox().right) / - pPattern->x_step()); - max_col = (int)FXSYS_floor((clip_box_p.right - pPattern->bbox().left) / - pPattern->x_step()); - min_row = (int)FXSYS_ceil((clip_box_p.bottom - pPattern->bbox().top) / - pPattern->y_step()); - max_row = (int)FXSYS_floor((clip_box_p.top - pPattern->bbox().bottom) / - pPattern->y_step()); + min_col = (int)ceil((clip_box_p.left - pPattern->bbox().right) / + pPattern->x_step()); + max_col = (int)floor((clip_box_p.right - pPattern->bbox().left) / + pPattern->x_step()); + min_row = (int)ceil((clip_box_p.bottom - pPattern->bbox().top) / + pPattern->y_step()); + max_row = (int)floor((clip_box_p.top - pPattern->bbox().bottom) / + pPattern->y_step()); if (width > clip_box.Width() || height > clip_box.Height() || width * height > clip_box.Width() * clip_box.Height()) { diff --git a/core/fpdfapi/render/cpdf_type3cache.cpp b/core/fpdfapi/render/cpdf_type3cache.cpp index 1ba9f66203..d11103d014 100644 --- a/core/fpdfapi/render/cpdf_type3cache.cpp +++ b/core/fpdfapi/render/cpdf_type3cache.cpp @@ -131,8 +131,8 @@ CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, CFX_RetainPtr pResBitmap; int left = 0; int top = 0; - if (FXSYS_fabs(image_matrix.b) < FXSYS_fabs(image_matrix.a) / 100 && - FXSYS_fabs(image_matrix.c) < FXSYS_fabs(image_matrix.d) / 100) { + if (fabs(image_matrix.b) < fabs(image_matrix.a) / 100 && + fabs(image_matrix.c) < fabs(image_matrix.d) / 100) { int top_line = DetectFirstLastScan(pBitmap, true); int bottom_line = DetectFirstLastScan(pBitmap, false); if (top_line == 0 && bottom_line == pBitmap->GetHeight() - 1) { diff --git a/core/fpdfapi/render/cpdf_type3glyphs.cpp b/core/fpdfapi/render/cpdf_type3glyphs.cpp index 33d8ef1253..5fce32ce93 100644 --- a/core/fpdfapi/render/cpdf_type3glyphs.cpp +++ b/core/fpdfapi/render/cpdf_type3glyphs.cpp @@ -22,7 +22,7 @@ static int _AdjustBlue(float pos, int& count, int blues[]) { float min_distance = 1000000.0f; int closest_pos = -1; for (int i = 0; i < count; i++) { - float distance = FXSYS_fabs(pos - static_cast(blues[i])); + float distance = fabs(pos - static_cast(blues[i])); if (distance < 1.0f * 80.0f / 100.0f && distance < min_distance) { min_distance = distance; closest_pos = i; diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index 1eab19f4f1..09e086f856 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -323,14 +323,12 @@ int CPDF_TextPage::GetIndexAtPos(const CFX_PointF& point, charRectExt.bottom = charrect.bottom - tolerance.height / 2; if (charRectExt.Contains(point)) { double curXdif, curYdif; - curXdif = FXSYS_fabs(point.x - charrect.left) < - FXSYS_fabs(point.x - charrect.right) - ? FXSYS_fabs(point.x - charrect.left) - : FXSYS_fabs(point.x - charrect.right); - curYdif = FXSYS_fabs(point.y - charrect.bottom) < - FXSYS_fabs(point.y - charrect.top) - ? FXSYS_fabs(point.y - charrect.bottom) - : FXSYS_fabs(point.y - charrect.top); + curXdif = fabs(point.x - charrect.left) < fabs(point.x - charrect.right) + ? fabs(point.x - charrect.left) + : fabs(point.x - charrect.right); + curYdif = fabs(point.y - charrect.bottom) < fabs(point.y - charrect.top) + ? fabs(point.y - charrect.bottom) + : fabs(point.y - charrect.top); if (curYdif + curXdif < xdif + ydif) { ydif = curYdif; xdif = curXdif; @@ -353,7 +351,7 @@ CFX_WideString CPDF_TextPage::GetTextByRect(const CFX_FloatRect& rect) const { CFX_WideString strText; for (const auto& charinfo : m_CharList) { if (IsRectIntersect(rect, charinfo.m_CharBox)) { - if (FXSYS_fabs(posy - charinfo.m_Origin.y) > 0 && !IsContainPreChar && + if (fabs(posy - charinfo.m_Origin.y) > 0 && !IsContainPreChar && IsAddLineFeed) { posy = charinfo.m_Origin.y; if (!strText.IsEmpty()) @@ -738,7 +736,7 @@ void CPDF_TextPage::ProcessTextObject( const CFX_Matrix& formMatrix, const CPDF_PageObjectList* pObjList, CPDF_PageObjectList::const_iterator ObjPos) { - if (FXSYS_fabs(pTextObj->m_Right - pTextObj->m_Left) < 0.01f) + if (fabs(pTextObj->m_Right - pTextObj->m_Left) < 0.01f) return; size_t count = m_LineObj.size(); @@ -761,16 +759,16 @@ void CPDF_TextPage::ProcessTextObject( prev_Obj.m_pTextObj->GetFontSize() / 1000; CFX_Matrix prev_matrix = prev_Obj.m_pTextObj->GetTextMatrix(); - prev_width = FXSYS_fabs(prev_width); + prev_width = fabs(prev_width); prev_matrix.Concat(prev_Obj.m_formMatrix); prev_width = prev_matrix.TransformDistance(prev_width); pTextObj->GetItemInfo(0, &item); float this_width = GetCharWidth(item.m_CharCode, pTextObj->GetFont()) * pTextObj->GetFontSize() / 1000; - this_width = FXSYS_fabs(this_width); + this_width = fabs(this_width); CFX_Matrix this_matrix = pTextObj->GetTextMatrix(); - this_width = FXSYS_fabs(this_width); + this_width = fabs(this_width); this_matrix.Concat(formMatrix); this_width = this_matrix.TransformDistance(this_width); @@ -779,7 +777,7 @@ void CPDF_TextPage::ProcessTextObject( prev_Obj.m_formMatrix.Transform(prev_Obj.m_pTextObj->GetPos())); CFX_PointF this_pos = m_DisplayMatrix.Transform(formMatrix.Transform(pTextObj->GetPos())); - if (FXSYS_fabs(this_pos.y - prev_pos.y) > threshold * 2) { + if (fabs(this_pos.y - prev_pos.y) > threshold * 2) { for (size_t i = 0; i < count; i++) ProcessTextObject(m_LineObj[i]); m_LineObj.clear(); @@ -955,7 +953,7 @@ bool CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj, void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { CPDF_TextObject* pTextObj = Obj.m_pTextObj; - if (FXSYS_fabs(pTextObj->m_Right - pTextObj->m_Left) < 0.01f) + if (fabs(pTextObj->m_Right - pTextObj->m_Left) < 0.01f) return; CFX_Matrix formMatrix = Obj.m_formMatrix; CPDF_Font* pFont = pTextObj->GetFont(); @@ -1063,7 +1061,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { if (charSpace > 0.001) spacing += matrix.TransformDistance(charSpace); else if (charSpace < -0.001) - spacing -= matrix.TransformDistance(FXSYS_fabs(charSpace)); + spacing -= matrix.TransformDistance(fabs(charSpace)); spacing -= baseSpace; if (spacing && i > 0) { int last_width = 0; @@ -1078,7 +1076,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { threshold /= 2; if (threshold == 0) { threshold = fontsize_h; - int this_width = FXSYS_abs(GetCharWidth(item.m_CharCode, pFont)); + int this_width = abs(GetCharWidth(item.m_CharCode, pFont)); threshold = this_width > last_width ? (float)this_width : (float)last_width; threshold = NormalizeThreshold(threshold); @@ -1156,7 +1154,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) { CFX_PointF diff = charinfo1.m_Origin - charinfo.m_Origin; if (charinfo1.m_CharCode == charinfo.m_CharCode && charinfo1.m_pTextObj->GetFont() == charinfo.m_pTextObj->GetFont() && - FXSYS_fabs(diff.x) < threshold && FXSYS_fabs(diff.y) < threshold) { + fabs(diff.x) < threshold && fabs(diff.y) < threshold) { bDel = true; break; } @@ -1200,8 +1198,8 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::GetTextObjectWritingMode( first.m_Origin = textMatrix.Transform(first.m_Origin); last.m_Origin = textMatrix.Transform(last.m_Origin); - float dX = FXSYS_fabs(last.m_Origin.x - first.m_Origin.x); - float dY = FXSYS_fabs(last.m_Origin.y - first.m_Origin.y); + float dX = fabs(last.m_Origin.x - first.m_Origin.x); + float dY = fabs(last.m_Origin.y - first.m_Origin.y); if (dX <= 0.0001f && dY <= 0.0001f) return TextOrientation::Unknown; @@ -1297,10 +1295,10 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject( float last_pos = PrevItem.m_Origin.x; int nLastWidth = GetCharWidth(PrevItem.m_CharCode, m_pPreTextObj->GetFont()); float last_width = nLastWidth * m_pPreTextObj->GetFontSize() / 1000; - last_width = FXSYS_fabs(last_width); + last_width = fabs(last_width); int nThisWidth = GetCharWidth(item.m_CharCode, pObj->GetFont()); float this_width = nThisWidth * pObj->GetFontSize() / 1000; - this_width = FXSYS_fabs(this_width); + this_width = fabs(this_width); float threshold = last_width > this_width ? last_width / 4 : this_width / 4; CFX_Matrix prev_matrix = m_pPreTextObj->GetTextMatrix(); @@ -1322,8 +1320,7 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject( rect1.Intersect(rect2); if ((rect1.IsEmpty() && rect2.Height() > 5 && rect3.Height() > 5) || ((pos.y > threshold * 2 || pos.y < threshold * -3) && - (FXSYS_fabs(pos.y) < 1 ? FXSYS_fabs(pos.x) < FXSYS_fabs(pos.y) - : true))) { + (fabs(pos.y) < 1 ? fabs(pos.x) < fabs(pos.y) : true))) { bNewline = true; if (nItem > 1) { CPDF_TextObjectItem tempItem; @@ -1369,9 +1366,9 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject( : (threshold > 800 ? threshold / 6 : threshold / 5)) : (threshold / 2); if (nLastWidth >= nThisWidth) { - threshold *= FXSYS_fabs(m_pPreTextObj->GetFontSize()); + threshold *= fabs(m_pPreTextObj->GetFontSize()); } else { - threshold *= FXSYS_fabs(pObj->GetFontSize()); + threshold *= fabs(pObj->GetFontSize()); threshold = matrix.TransformDistance(threshold); threshold = prev_reverse.TransformDistance(threshold); } @@ -1380,8 +1377,8 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject( (threshold < 1.39001 && threshold > 1.38999)) { threshold *= 1.5; } - if (FXSYS_fabs(last_pos + last_width - pos.x) > threshold && - curChar != L' ' && preChar != L' ') { + if (fabs(last_pos + last_width - pos.x) > threshold && curChar != L' ' && + preChar != L' ') { if (curChar != L' ' && preChar != L' ') { if ((pos.x - last_pos - last_width) > threshold || (last_pos - pos.x - last_width) > threshold) { @@ -1406,7 +1403,7 @@ bool CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1, CFX_FloatRect rcPreObj = pTextObj2->GetRect(); CFX_FloatRect rcCurObj = pTextObj1->GetRect(); if (rcPreObj.IsEmpty() && rcCurObj.IsEmpty()) { - float dbXdif = FXSYS_fabs(rcPreObj.left - rcCurObj.left); + float dbXdif = fabs(rcPreObj.left - rcCurObj.left); size_t nCount = m_CharList.size(); if (nCount >= 2) { PAGECHAR_INFO perCharTemp = m_CharList[nCount - 2]; @@ -1419,8 +1416,7 @@ bool CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1, rcPreObj.Intersect(rcCurObj); if (rcPreObj.IsEmpty()) return false; - if (FXSYS_fabs(rcPreObj.Width() - rcCurObj.Width()) > - rcCurObj.Width() / 2) { + if (fabs(rcPreObj.Width() - rcCurObj.Width()) > rcCurObj.Width() / 2) { return false; } if (pTextObj2->GetFontSize() != pTextObj1->GetFontSize()) @@ -1448,8 +1444,8 @@ bool CPDF_TextPage::IsSameTextObject(CPDF_TextObject* pTextObj1, float char_size = GetCharWidth(itemPer.m_CharCode, pTextObj2->GetFont()); float max_pre_size = std::max(std::max(rcPreObj.Height(), rcPreObj.Width()), font_size); - if (FXSYS_fabs(diff.x) > char_size * font_size / 1000 * 0.9 || - FXSYS_fabs(diff.y) > max_pre_size / 8) { + if (fabs(diff.x) > char_size * font_size / 1000 * 0.9 || + fabs(diff.y) > max_pre_size / 8) { return false; } return true; diff --git a/core/fxcodec/codec/fx_codec_flate.cpp b/core/fxcodec/codec/fx_codec_flate.cpp index c73703fba5..dd9c4c9fa6 100644 --- a/core/fxcodec/codec/fx_codec_flate.cpp +++ b/core/fxcodec/codec/fx_codec_flate.cpp @@ -244,9 +244,9 @@ int CLZWDecoder::Decode(uint8_t* dest_buf, uint8_t PathPredictor(int a, int b, int c) { int p = a + b - c; - int pa = FXSYS_abs(p - a); - int pb = FXSYS_abs(p - b); - int pc = FXSYS_abs(p - c); + int pa = abs(p - a); + int pb = abs(p - b); + int pc = abs(p - c); if (pa <= pb && pa <= pc) return (uint8_t)a; if (pb <= pc) diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp index bd890f89ff..e06c592cdc 100644 --- a/core/fxcodec/codec/fx_codec_progress.cpp +++ b/core/fxcodec/codec/fx_codec_progress.cpp @@ -57,17 +57,17 @@ void CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len, } else { base = 0.0f; } - m_ItemSize = (int)(sizeof(int) * 2 + - sizeof(int) * (FXSYS_ceil(FXSYS_fabs((float)scale)) + 1)); + m_ItemSize = + (int)(sizeof(int) * 2 + sizeof(int) * (ceil(fabs((float)scale)) + 1)); m_DestMin = dest_min; m_pWeightTables.resize((dest_max - dest_min) * m_ItemSize + 4); - if (FXSYS_fabs((float)scale) < 1.0f) { + if (fabs((float)scale) < 1.0f) { for (int dest_pixel = dest_min; dest_pixel < dest_max; dest_pixel++) { PixelWeight& pixel_weights = *GetPixelWeight(dest_pixel); double src_pos = dest_pixel * scale + scale / 2 + base; if (bInterpol) { - pixel_weights.m_SrcStart = (int)FXSYS_floor((float)src_pos - 1.0f / 2); - pixel_weights.m_SrcEnd = (int)FXSYS_floor((float)src_pos + 1.0f / 2); + pixel_weights.m_SrcStart = (int)floor((float)src_pos - 1.0f / 2); + pixel_weights.m_SrcEnd = (int)floor((float)src_pos + 1.0f / 2); if (pixel_weights.m_SrcStart < src_min) { pixel_weights.m_SrcStart = src_min; } @@ -83,7 +83,7 @@ void CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len, } } else { pixel_weights.m_SrcStart = pixel_weights.m_SrcEnd = - (int)FXSYS_floor((float)src_pos); + (int)floor((float)src_pos); pixel_weights.m_Weights[0] = 65536; } } @@ -95,11 +95,11 @@ void CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len, double src_end = src_start + scale; int start_i, end_i; if (src_start < src_end) { - start_i = (int)FXSYS_floor((float)src_start); - end_i = (int)FXSYS_ceil((float)src_end); + start_i = (int)floor((float)src_start); + end_i = (int)ceil((float)src_end); } else { - start_i = (int)FXSYS_floor((float)src_end); - end_i = (int)FXSYS_ceil((float)src_start); + start_i = (int)floor((float)src_end); + end_i = (int)ceil((float)src_start); } if (start_i < src_min) { start_i = src_min; @@ -1744,7 +1744,7 @@ void CCodec_ProgressiveDecoder::ResampleVert( } return; } - int multiple = (int)FXSYS_ceil((float)scale_y - 1); + int multiple = (int)ceil((float)scale_y - 1); if (multiple > 0) { uint8_t* scan_src = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet; @@ -1874,19 +1874,19 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode( if (start_x < 0 || out_range_x > 0) { float scaleX = (float)m_clipBox.Width() / (float)size_x; if (start_x < 0) { - m_clipBox.left -= (int32_t)FXSYS_ceil((float)start_x * scaleX); + m_clipBox.left -= (int32_t)ceil((float)start_x * scaleX); } if (out_range_x > 0) { - m_clipBox.right -= (int32_t)FXSYS_floor((float)out_range_x * scaleX); + m_clipBox.right -= (int32_t)floor((float)out_range_x * scaleX); } } if (start_y < 0 || out_range_y > 0) { float scaleY = (float)m_clipBox.Height() / (float)size_y; if (start_y < 0) { - m_clipBox.top -= (int32_t)FXSYS_ceil((float)start_y * scaleY); + m_clipBox.top -= (int32_t)ceil((float)start_y * scaleY); } if (out_range_y > 0) { - m_clipBox.bottom -= (int32_t)FXSYS_floor((float)out_range_y * scaleY); + m_clipBox.bottom -= (int32_t)floor((float)out_range_y * scaleY); } } if (m_clipBox.IsEmpty()) { diff --git a/core/fxcrt/cfx_decimal.cpp b/core/fxcrt/cfx_decimal.cpp index 1baa6896a3..095978cd43 100644 --- a/core/fxcrt/cfx_decimal.cpp +++ b/core/fxcrt/cfx_decimal.cpp @@ -276,12 +276,12 @@ CFX_Decimal::CFX_Decimal(float val, uint8_t scale) { plo = static_cast(newval); pmid = static_cast(newval / 1e32); phi = static_cast(newval / 1e64); - newval = FXSYS_fmod(newval, 1.0f); + newval = fmod(newval, 1.0f); for (uint8_t iter = 0; iter < scale; iter++) { decimal_helper_mul10(phi, pmid, plo); newval *= 10; plo += static_cast(newval); - newval = FXSYS_fmod(newval, 1.0f); + newval = fmod(newval, 1.0f); } plo += FXSYS_round(newval); diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_basic_coords.cpp index a1b403820e..71a15c0cec 100644 --- a/core/fxcrt/fx_basic_coords.cpp +++ b/core/fxcrt/fx_basic_coords.cpp @@ -13,11 +13,11 @@ namespace { void MatchFloatRange(float f1, float f2, int* i1, int* i2) { - int length = static_cast(FXSYS_ceil(f2 - f1)); - int i1_1 = static_cast(FXSYS_floor(f1)); - int i1_2 = static_cast(FXSYS_ceil(f1)); - float error1 = f1 - i1_1 + (float)FXSYS_fabs(f2 - i1_1 - length); - float error2 = i1_2 - f1 + (float)FXSYS_fabs(f2 - i1_2 - length); + int length = static_cast(ceil(f2 - f1)); + int i1_1 = static_cast(floor(f1)); + int i1_2 = static_cast(ceil(f1)); + float error1 = f1 - i1_1 + (float)fabs(f2 - i1_1 - length); + float error2 = i1_2 - f1 + (float)fabs(f2 - i1_2 - length); *i1 = (error1 > error2) ? i1_2 : i1_1; *i2 = *i1 + length; @@ -160,10 +160,10 @@ int CFX_FloatRect::Substract4(CFX_FloatRect& s, CFX_FloatRect* pRects) { FX_RECT CFX_FloatRect::GetOuterRect() const { CFX_FloatRect rect1 = *this; FX_RECT rect; - rect.left = (int)FXSYS_floor(rect1.left); - rect.right = (int)FXSYS_ceil(rect1.right); - rect.top = (int)FXSYS_floor(rect1.bottom); - rect.bottom = (int)FXSYS_ceil(rect1.top); + rect.left = (int)floor(rect1.left); + rect.right = (int)ceil(rect1.right); + rect.top = (int)floor(rect1.bottom); + rect.bottom = (int)ceil(rect1.top); rect.Normalize(); return rect; } @@ -171,10 +171,10 @@ FX_RECT CFX_FloatRect::GetOuterRect() const { FX_RECT CFX_FloatRect::GetInnerRect() const { CFX_FloatRect rect1 = *this; FX_RECT rect; - rect.left = (int)FXSYS_ceil(rect1.left); - rect.right = (int)FXSYS_floor(rect1.right); - rect.top = (int)FXSYS_ceil(rect1.bottom); - rect.bottom = (int)FXSYS_floor(rect1.top); + rect.left = (int)ceil(rect1.left); + rect.right = (int)floor(rect1.right); + rect.top = (int)ceil(rect1.bottom); + rect.bottom = (int)floor(rect1.top); rect.Normalize(); return rect; } @@ -230,7 +230,7 @@ CFX_FloatRect CFX_FloatRect::GetBBox(const CFX_PointF* pPoints, int nPoints) { void CFX_Matrix::SetReverse(const CFX_Matrix& m) { float i = m.a * m.d - m.b * m.c; - if (FXSYS_fabs(i) <= std::numeric_limits::epsilon()) + if (fabs(i) <= std::numeric_limits::epsilon()) return; float j = -i; @@ -253,13 +253,11 @@ void CFX_Matrix::ConcatInverse(const CFX_Matrix& src, bool bPrepended) { } bool CFX_Matrix::Is90Rotated() const { - return FXSYS_fabs(a * 1000) < FXSYS_fabs(b) && - FXSYS_fabs(d * 1000) < FXSYS_fabs(c); + return fabs(a * 1000) < fabs(b) && fabs(d * 1000) < fabs(c); } bool CFX_Matrix::IsScaled() const { - return FXSYS_fabs(b * 1000) < FXSYS_fabs(a) && - FXSYS_fabs(c * 1000) < FXSYS_fabs(d); + return fabs(b * 1000) < fabs(a) && fabs(c * 1000) < fabs(d); } void CFX_Matrix::Translate(float x, float y, bool bPrepended) { @@ -288,8 +286,8 @@ void CFX_Matrix::Scale(float sx, float sy, bool bPrepended) { } void CFX_Matrix::Rotate(float fRadian, bool bPrepended) { - float cosValue = FXSYS_cos(fRadian); - float sinValue = FXSYS_sin(fRadian); + float cosValue = cos(fRadian); + float sinValue = sin(fRadian); ConcatInternal(CFX_Matrix(cosValue, sinValue, -sinValue, cosValue, 0, 0), bPrepended); } @@ -301,18 +299,17 @@ void CFX_Matrix::RotateAt(float fRadian, float dx, float dy, bool bPrepended) { } void CFX_Matrix::Shear(float fAlphaRadian, float fBetaRadian, bool bPrepended) { - ConcatInternal( - CFX_Matrix(1, FXSYS_tan(fAlphaRadian), FXSYS_tan(fBetaRadian), 1, 0, 0), - bPrepended); + ConcatInternal(CFX_Matrix(1, tan(fAlphaRadian), tan(fBetaRadian), 1, 0, 0), + bPrepended); } void CFX_Matrix::MatchRect(const CFX_FloatRect& dest, const CFX_FloatRect& src) { float fDiff = src.left - src.right; - a = FXSYS_fabs(fDiff) < 0.001f ? 1 : (dest.left - dest.right) / fDiff; + a = fabs(fDiff) < 0.001f ? 1 : (dest.left - dest.right) / fDiff; fDiff = src.bottom - src.top; - d = FXSYS_fabs(fDiff) < 0.001f ? 1 : (dest.bottom - dest.top) / fDiff; + d = fabs(fDiff) < 0.001f ? 1 : (dest.bottom - dest.top) / fDiff; e = dest.left - src.left * a; f = dest.bottom - src.bottom * d; b = 0; @@ -324,7 +321,7 @@ float CFX_Matrix::GetXUnit() const { return (a > 0 ? a : -a); if (a == 0) return (b > 0 ? b : -b); - return FXSYS_sqrt(a * a + b * b); + return sqrt(a * a + b * b); } float CFX_Matrix::GetYUnit() const { @@ -332,7 +329,7 @@ float CFX_Matrix::GetYUnit() const { return (d > 0 ? d : -d); if (d == 0) return (c > 0 ? c : -c); - return FXSYS_sqrt(c * c + d * d); + return sqrt(c * c + d * d); } CFX_FloatRect CFX_Matrix::GetUnitRect() const { @@ -344,13 +341,13 @@ CFX_FloatRect CFX_Matrix::GetUnitRect() const { float CFX_Matrix::TransformXDistance(float dx) const { float fx = a * dx; float fy = b * dx; - return FXSYS_sqrt(fx * fx + fy * fy); + return sqrt(fx * fx + fy * fy); } float CFX_Matrix::TransformDistance(float dx, float dy) const { float fx = a * dx + c * dy; float fy = b * dx + d * dy; - return FXSYS_sqrt(fx * fx + fy * fy); + return sqrt(fx * fx + fy * fy); } float CFX_Matrix::TransformDistance(float distance) const { diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h index 5ccaf3d229..0262268f49 100644 --- a/core/fxcrt/fx_coordinates.h +++ b/core/fxcrt/fx_coordinates.h @@ -162,7 +162,7 @@ class CFX_VTemplate : public CFX_PTemplate { const CFX_PTemplate& point2) : CFX_PTemplate(point2.x - point1.x, point2.y - point1.y) {} - float Length() const { return FXSYS_sqrt(x * x + y * y); } + float Length() const { return sqrt(x * x + y * y); } void Normalize() { float fLen = Length(); if (fLen < 0.0001f) @@ -180,8 +180,8 @@ class CFX_VTemplate : public CFX_PTemplate { y *= sy; } void Rotate(float fRadian) { - float cosValue = FXSYS_cos(fRadian); - float sinValue = FXSYS_sin(fRadian); + float cosValue = cos(fRadian); + float sinValue = sin(fRadian); x = x * cosValue - y * sinValue; y = x * sinValue + y * cosValue; } diff --git a/core/fxcrt/fx_ext.h b/core/fxcrt/fx_ext.h index 2eafe6c7b9..7d42e90ce3 100644 --- a/core/fxcrt/fx_ext.h +++ b/core/fxcrt/fx_ext.h @@ -15,7 +15,6 @@ #define FX_INVALID_OFFSET static_cast(-1) -float FXSYS_tan(float a); float FXSYS_strtof(const char* pcsStr, int32_t iLength = -1, int32_t* pUsedLen = nullptr); diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp index 3fd3a0d500..f8abff376f 100644 --- a/core/fxcrt/fx_extension.cpp +++ b/core/fxcrt/fx_extension.cpp @@ -419,12 +419,6 @@ CFX_RetainPtr IFX_MemoryStream::Create(bool bConsecutive) { return pdfium::MakeRetain(bConsecutive); } -float FXSYS_tan(float a) { - return (float)tan(a); -} -float FXSYS_logb(float b, float x) { - return FXSYS_log(x) / FXSYS_log(b); -} float FXSYS_strtof(const char* pcsStr, int32_t iLength, int32_t* pUsedLen) { ASSERT(pcsStr); if (iLength < 0) { @@ -434,6 +428,7 @@ float FXSYS_strtof(const char* pcsStr, int32_t iLength, int32_t* pUsedLen) { CFX_WideString::FromLocal(CFX_ByteStringC(pcsStr, iLength)); return FXSYS_wcstof(ws.c_str(), iLength, pUsedLen); } + float FXSYS_wcstof(const wchar_t* pwsStr, int32_t iLength, int32_t* pUsedLen) { ASSERT(pwsStr); if (iLength < 0) { diff --git a/core/fxcrt/fx_system.h b/core/fxcrt/fx_system.h index d9a352c1d6..c471085e25 100644 --- a/core/fxcrt/fx_system.h +++ b/core/fxcrt/fx_system.h @@ -252,18 +252,6 @@ wchar_t* FXSYS_wcsupr(wchar_t* str); #define FXSYS_pow(a, b) (float)pow(a, b) #endif // _FXM_PLATFORM == _FXM_PLATFORM_WINDOWS_ -#define FXSYS_sqrt(a) (float)sqrt(a) -#define FXSYS_fabs(a) (float)fabs(a) -#define FXSYS_atan2(a, b) (float)atan2(a, b) -#define FXSYS_ceil(a) (float)ceil(a) -#define FXSYS_floor(a) (float)floor(a) -#define FXSYS_cos(a) (float)cos(a) -#define FXSYS_acos(a) (float)acos(a) -#define FXSYS_sin(a) (float)sin(a) -#define FXSYS_log(a) (float)log(a) -#define FXSYS_log10(a) (float)log10(a) -#define FXSYS_fmod(a, b) (float)fmod(a, b) -#define FXSYS_abs abs #define FXDWORD_GET_LSBFIRST(p) \ ((static_cast(p[3]) << 24) | (static_cast(p[2]) << 16) | \ (static_cast(p[1]) << 8) | (static_cast(p[0]))) @@ -277,7 +265,7 @@ int64_t FXSYS_atoi64(const char* str); int64_t FXSYS_wtoi64(const wchar_t* str); const char* FXSYS_i64toa(int64_t value, char* str, int radix); int FXSYS_round(float f); -#define FXSYS_sqrt2(a, b) (float)FXSYS_sqrt((a) * (a) + (b) * (b)) +#define FXSYS_sqrt2(a, b) (float)sqrt((a) * (a) + (b) * (b)) #ifdef __cplusplus }; // extern C #endif // __cplusplus diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 8cada7cf64..031246b494 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -1449,8 +1449,7 @@ bool CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, CFX_Matrix matrix1; CFX_Matrix matrix2; if (pObject2Device) { - matrix1.a = - std::max(FXSYS_fabs(pObject2Device->a), FXSYS_fabs(pObject2Device->b)); + matrix1.a = std::max(fabs(pObject2Device->a), fabs(pObject2Device->b)); matrix1.d = matrix1.a; matrix2 = CFX_Matrix( pObject2Device->a / matrix1.a, pObject2Device->b / matrix1.a, diff --git a/core/fxge/dib/cfx_dibsource.cpp b/core/fxge/dib/cfx_dibsource.cpp index 4cdedd1051..4b76b02ee7 100644 --- a/core/fxge/dib/cfx_dibsource.cpp +++ b/core/fxge/dib/cfx_dibsource.cpp @@ -513,7 +513,7 @@ CFX_RetainPtr CFX_DIBSource::StretchTo(int dest_width, uint32_t flags, const FX_RECT* pClip) { CFX_RetainPtr holder(this); - FX_RECT clip_rect(0, 0, FXSYS_abs(dest_width), FXSYS_abs(dest_height)); + FX_RECT clip_rect(0, 0, abs(dest_width), abs(dest_height)); if (pClip) clip_rect.Intersect(*pClip); diff --git a/core/fxge/dib/cfx_imagerenderer.cpp b/core/fxge/dib/cfx_imagerenderer.cpp index 776ba92775..89eb48f0cb 100644 --- a/core/fxge/dib/cfx_imagerenderer.cpp +++ b/core/fxge/dib/cfx_imagerenderer.cpp @@ -53,11 +53,11 @@ bool CFX_ImageRenderer::Start(const CFX_RetainPtr& pDevice, m_bRgbByteOrder = bRgbByteOrder; m_BlendType = blend_type; - if ((FXSYS_fabs(m_Matrix.b) >= 0.5f || m_Matrix.a == 0) || - (FXSYS_fabs(m_Matrix.c) >= 0.5f || m_Matrix.d == 0)) { - if (FXSYS_fabs(m_Matrix.a) < FXSYS_fabs(m_Matrix.b) / 20 && - FXSYS_fabs(m_Matrix.d) < FXSYS_fabs(m_Matrix.c) / 20 && - FXSYS_fabs(m_Matrix.a) < 0.5f && FXSYS_fabs(m_Matrix.d) < 0.5f) { + if ((fabs(m_Matrix.b) >= 0.5f || m_Matrix.a == 0) || + (fabs(m_Matrix.c) >= 0.5f || m_Matrix.d == 0)) { + if (fabs(m_Matrix.a) < fabs(m_Matrix.b) / 20 && + fabs(m_Matrix.d) < fabs(m_Matrix.c) / 20 && fabs(m_Matrix.a) < 0.5f && + fabs(m_Matrix.d) < 0.5f) { int dest_width = image_rect.Width(); int dest_height = image_rect.Height(); FX_RECT bitmap_clip = m_ClipBox; diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp index d8159aabb5..65f6bc8ec9 100644 --- a/core/fxge/dib/cfx_imagetransformer.cpp +++ b/core/fxge/dib/cfx_imagetransformer.cpp @@ -168,9 +168,9 @@ bool CFX_ImageTransformer::Start() { return false; m_result = result_clip; - if (FXSYS_fabs(m_pMatrix->a) < FXSYS_fabs(m_pMatrix->b) / 20 && - FXSYS_fabs(m_pMatrix->d) < FXSYS_fabs(m_pMatrix->c) / 20 && - FXSYS_fabs(m_pMatrix->a) < 0.5f && FXSYS_fabs(m_pMatrix->d) < 0.5f) { + if (fabs(m_pMatrix->a) < fabs(m_pMatrix->b) / 20 && + fabs(m_pMatrix->d) < fabs(m_pMatrix->c) / 20 && + fabs(m_pMatrix->a) < 0.5f && fabs(m_pMatrix->d) < 0.5f) { int dest_width = result_rect.Width(); int dest_height = result_rect.Height(); result_clip.Offset(-result_rect.left, -result_rect.top); @@ -182,12 +182,11 @@ bool CFX_ImageTransformer::Start() { m_Status = 1; return true; } - if (FXSYS_fabs(m_pMatrix->b) < FIX16_005 && - FXSYS_fabs(m_pMatrix->c) < FIX16_005) { - int dest_width = m_pMatrix->a > 0 ? (int)FXSYS_ceil(m_pMatrix->a) - : (int)FXSYS_floor(m_pMatrix->a); - int dest_height = m_pMatrix->d > 0 ? (int)-FXSYS_ceil(m_pMatrix->d) - : (int)-FXSYS_floor(m_pMatrix->d); + if (fabs(m_pMatrix->b) < FIX16_005 && fabs(m_pMatrix->c) < FIX16_005) { + int dest_width = + m_pMatrix->a > 0 ? (int)ceil(m_pMatrix->a) : (int)floor(m_pMatrix->a); + int dest_height = + m_pMatrix->d > 0 ? (int)-ceil(m_pMatrix->d) : (int)-floor(m_pMatrix->d); result_clip.Offset(-result_rect.left, -result_rect.top); m_Stretcher = pdfium::MakeUnique( &m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags); @@ -195,8 +194,8 @@ bool CFX_ImageTransformer::Start() { m_Status = 2; return true; } - int stretch_width = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->a, m_pMatrix->b)); - int stretch_height = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->c, m_pMatrix->d)); + int stretch_width = (int)ceil(FXSYS_sqrt2(m_pMatrix->a, m_pMatrix->b)); + int stretch_height = (int)ceil(FXSYS_sqrt2(m_pMatrix->c, m_pMatrix->d)); CFX_Matrix stretch2dest(1.0f, 0.0f, 0.0f, -1.0f, 0.0f, (float)(stretch_height)); stretch2dest.Concat( diff --git a/core/fxge/dib/fx_dib_engine.cpp b/core/fxge/dib/fx_dib_engine.cpp index d304a56600..9a5a7c1351 100644 --- a/core/fxge/dib/fx_dib_engine.cpp +++ b/core/fxge/dib/fx_dib_engine.cpp @@ -40,9 +40,8 @@ bool CWeightTable::Calc(int dest_len, const double scale = (float)src_len / (float)dest_len; const double base = dest_len < 0 ? (float)(src_len) : 0; const int ext_size = flags & FXDIB_BICUBIC_INTERPOL ? 3 : 1; - m_ItemSize = - sizeof(int) * 2 + - (int)(sizeof(int) * (FXSYS_ceil(FXSYS_fabs((float)scale)) + ext_size)); + m_ItemSize = sizeof(int) * 2 + + (int)(sizeof(int) * (ceil(fabs((float)scale)) + ext_size)); m_DestMin = dest_min; if ((dest_max - dest_min) > (int)((1U << 30) - 4) / m_ItemSize) return false; @@ -52,13 +51,13 @@ bool CWeightTable::Calc(int dest_len, if (!m_pWeightTables) return false; - if ((flags & FXDIB_NOSMOOTH) != 0 || FXSYS_fabs((float)scale) < 1.0f) { + if ((flags & FXDIB_NOSMOOTH) != 0 || fabs((float)scale) < 1.0f) { for (int dest_pixel = dest_min; dest_pixel < dest_max; dest_pixel++) { PixelWeight& pixel_weights = *GetPixelWeight(dest_pixel); double src_pos = dest_pixel * scale + scale / 2 + base; if (flags & FXDIB_INTERPOL) { - pixel_weights.m_SrcStart = (int)FXSYS_floor((float)src_pos - 1.0f / 2); - pixel_weights.m_SrcEnd = (int)FXSYS_floor((float)src_pos + 1.0f / 2); + pixel_weights.m_SrcStart = (int)floor((float)src_pos - 1.0f / 2); + pixel_weights.m_SrcEnd = (int)floor((float)src_pos + 1.0f / 2); if (pixel_weights.m_SrcStart < src_min) { pixel_weights.m_SrcStart = src_min; } @@ -73,8 +72,8 @@ bool CWeightTable::Calc(int dest_len, pixel_weights.m_Weights[0] = 65536 - pixel_weights.m_Weights[1]; } } else if (flags & FXDIB_BICUBIC_INTERPOL) { - pixel_weights.m_SrcStart = (int)FXSYS_floor((float)src_pos - 1.0f / 2); - pixel_weights.m_SrcEnd = (int)FXSYS_floor((float)src_pos + 1.0f / 2); + pixel_weights.m_SrcStart = (int)floor((float)src_pos - 1.0f / 2); + pixel_weights.m_SrcEnd = (int)floor((float)src_pos + 1.0f / 2); int start = pixel_weights.m_SrcStart - 1; int end = pixel_weights.m_SrcEnd + 1; if (start < src_min) { @@ -157,7 +156,7 @@ bool CWeightTable::Calc(int dest_len, } } else { pixel_weights.m_SrcStart = pixel_weights.m_SrcEnd = - (int)FXSYS_floor((float)src_pos); + (int)floor((float)src_pos); if (pixel_weights.m_SrcStart < src_min) { pixel_weights.m_SrcStart = src_min; } @@ -176,11 +175,11 @@ bool CWeightTable::Calc(int dest_len, double src_end = src_start + scale; int start_i, end_i; if (src_start < src_end) { - start_i = (int)FXSYS_floor((float)src_start); - end_i = (int)FXSYS_ceil((float)src_end); + start_i = (int)floor((float)src_start); + end_i = (int)ceil((float)src_end); } else { - start_i = (int)FXSYS_floor((float)src_end); - end_i = (int)FXSYS_ceil((float)src_start); + start_i = (int)floor((float)src_end); + end_i = (int)ceil((float)src_start); } if (start_i < src_min) { start_i = src_min; @@ -286,9 +285,9 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, m_SrcPitch = (m_SrcWidth * m_SrcBpp + 31) / 32 * 4; if ((flags & FXDIB_NOSMOOTH) == 0) { bool bInterpol = flags & FXDIB_INTERPOL || flags & FXDIB_BICUBIC_INTERPOL; - if (!bInterpol && FXSYS_abs(dest_width) != 0 && - FXSYS_abs(dest_height) / 8 < static_cast(m_SrcWidth) * - m_SrcHeight / FXSYS_abs(dest_width)) { + if (!bInterpol && abs(dest_width) != 0 && + abs(dest_height) / 8 < static_cast(m_SrcWidth) * + m_SrcHeight / abs(dest_width)) { flags = FXDIB_INTERPOL; } m_Flags = flags; @@ -316,10 +315,10 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, src_top = src_bottom; src_bottom = temp; } - m_SrcClip.left = (int)FXSYS_floor((float)src_left); - m_SrcClip.right = (int)FXSYS_ceil((float)src_right); - m_SrcClip.top = (int)FXSYS_floor((float)src_top); - m_SrcClip.bottom = (int)FXSYS_ceil((float)src_bottom); + m_SrcClip.left = (int)floor((float)src_left); + m_SrcClip.right = (int)ceil((float)src_right); + m_SrcClip.top = (int)floor((float)src_top); + m_SrcClip.bottom = (int)ceil((float)src_bottom); FX_RECT src_rect(0, 0, m_SrcWidth, m_SrcHeight); m_SrcClip.Intersect(src_rect); if (m_SrcBpp == 1) { diff --git a/core/fxge/ge/cfx_facecache.cpp b/core/fxge/ge/cfx_facecache.cpp index 4c44660426..0e9e40135a 100644 --- a/core/fxge/ge/cfx_facecache.cpp +++ b/core/fxge/ge/cfx_facecache.cpp @@ -55,7 +55,7 @@ void ContrastAdjust(uint8_t* pDataIn, } temp = max - min; if (temp == 0 || temp == 255) { - int rowbytes = std::min(FXSYS_abs(nSrcRowBytes), nDstRowBytes); + int rowbytes = std::min(abs(nSrcRowBytes), nDstRowBytes); for (row = 0; row < nHeight; row++) { FXSYS_memcpy(pDataOut + row * nDstRowBytes, pDataIn + row * nSrcRowBytes, rowbytes); @@ -165,8 +165,9 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(const CFX_Font* pFont, else level = CFX_Font::s_WeightPow_11[index]; - level = level * (FXSYS_abs(static_cast(ft_matrix.xx)) + - FXSYS_abs(static_cast(ft_matrix.xy))) / + level = level * + (abs(static_cast(ft_matrix.xx)) + + abs(static_cast(ft_matrix.xy))) / 36655; FXFT_Outline_Embolden(FXFT_Get_Glyph_Outline(m_Face), level.ValueOrDefault(0)); @@ -209,8 +210,7 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(const CFX_Font* pFont, if (anti_alias == FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXFT_Get_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) { - int rowbytes = - FXSYS_abs(src_pitch) > dest_pitch ? dest_pitch : FXSYS_abs(src_pitch); + int rowbytes = abs(src_pitch) > dest_pitch ? dest_pitch : abs(src_pitch); for (int row = 0; row < bmheight; row++) { FXSYS_memcpy(pDestBuf + row * dest_pitch, pSrcBuf + row * src_pitch, rowbytes); diff --git a/core/fxge/ge/cfx_fontmapper.cpp b/core/fxge/ge/cfx_fontmapper.cpp index 622b457396..e04e581434 100644 --- a/core/fxge/ge/cfx_fontmapper.cpp +++ b/core/fxge/ge/cfx_fontmapper.cpp @@ -707,7 +707,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, if (bItalic && !FXFT_Is_Face_Italic(face)) { if (italic_angle == 0) italic_angle = -12; - else if (FXSYS_abs(italic_angle) < 5) + else if (abs(italic_angle) < 5) italic_angle = 0; pSubstFont->m_ItalicAngle = italic_angle; } diff --git a/core/fxge/ge/cfx_pathdata.cpp b/core/fxge/ge/cfx_pathdata.cpp index d4c657c3a4..75e4faf0ef 100644 --- a/core/fxge/ge/cfx_pathdata.cpp +++ b/core/fxge/ge/cfx_pathdata.cpp @@ -71,8 +71,8 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect, float end_dc = 0; float one_twentieth = 1.0f / 20; - bool bStartVert = FXSYS_fabs(start_pos.x - mid_pos.x) < one_twentieth; - bool bEndVert = FXSYS_fabs(mid_pos.x - end_pos.x) < one_twentieth; + bool bStartVert = fabs(start_pos.x - mid_pos.x) < one_twentieth; + bool bEndVert = fabs(mid_pos.x - end_pos.x) < one_twentieth; if (bStartVert && bEndVert) { int start_dir = mid_pos.y > start_pos.y ? 1 : -1; float point_y = mid_pos.y + half_width * start_dir; @@ -87,15 +87,14 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect, start_c = mid_pos.y - (start_k * mid_pos.x); start_len = FXSYS_sqrt2(start_to_mid.x, start_to_mid.y); start_dc = - static_cast(FXSYS_fabs(half_width * start_len / start_to_mid.x)); + static_cast(fabs(half_width * start_len / start_to_mid.x)); } if (!bEndVert) { CFX_PointF end_to_mid = end_pos - mid_pos; end_k = end_to_mid.y / end_to_mid.x; end_c = mid_pos.y - (end_k * mid_pos.x); end_len = FXSYS_sqrt2(end_to_mid.x, end_to_mid.y); - end_dc = - static_cast(FXSYS_fabs(half_width * end_len / end_to_mid.x)); + end_dc = static_cast(fabs(half_width * end_len / end_to_mid.x)); } if (bStartVert) { CFX_PointF outside(start_pos.x, 0); @@ -129,7 +128,7 @@ void UpdateLineJoinPoints(CFX_FloatRect* rect, return; } - if (FXSYS_fabs(start_k - end_k) < one_twentieth) { + if (fabs(start_k - end_k) < one_twentieth) { int start_dir = mid_pos.x > start_pos.x ? 1 : -1; int end_dir = end_pos.x > mid_pos.x ? 1 : -1; if (start_dir == end_dir) @@ -360,8 +359,8 @@ bool CFX_PathData::GetZeroAreaPath(const CFX_Matrix* pMatrix, (m_Points[i].m_Point.y - m_Points[next].m_Point.y) > 0)) { int pre = i; - if (FXSYS_fabs(m_Points[i].m_Point.y - m_Points[i - 1].m_Point.y) < - FXSYS_fabs(m_Points[i].m_Point.y - m_Points[next].m_Point.y)) { + if (fabs(m_Points[i].m_Point.y - m_Points[i - 1].m_Point.y) < + fabs(m_Points[i].m_Point.y - m_Points[next].m_Point.y)) { pre--; next--; } @@ -375,8 +374,8 @@ bool CFX_PathData::GetZeroAreaPath(const CFX_Matrix* pMatrix, (m_Points[i].m_Point.x - m_Points[next].m_Point.x) > 0)) { int pre = i; - if (FXSYS_fabs(m_Points[i].m_Point.x - m_Points[i - 1].m_Point.x) < - FXSYS_fabs(m_Points[i].m_Point.x - m_Points[next].m_Point.x)) { + if (fabs(m_Points[i].m_Point.x - m_Points[i - 1].m_Point.x) < + fabs(m_Points[i].m_Point.x - m_Points[next].m_Point.x)) { pre--; next--; } diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp index 782dbf3e2f..521ba4c65d 100644 --- a/core/fxge/ge/cfx_renderdevice.cpp +++ b/core/fxge/ge/cfx_renderdevice.cpp @@ -43,7 +43,7 @@ void AdjustGlyphSpace(std::vector* pGlyphAndPos) { int space = next_origin - current_origin; float space_f = next_origin_f - current_origin_f; - float error = FXSYS_fabs(space_f) - FXSYS_fabs(static_cast(space)); + float error = fabs(space_f) - fabs(static_cast(space)); if (error > 0.5f) current_origin += space > 0 ? -1 : 1; } @@ -513,13 +513,13 @@ bool CFX_RenderDevice::DrawPathWithBlend(const CFX_PathData* pPathData, if (!rect_i.Valid()) return false; - int width = (int)FXSYS_ceil(rect_f.right - rect_f.left); + int width = (int)ceil(rect_f.right - rect_f.left); if (width < 1) { width = 1; if (rect_i.left == rect_i.right) rect_i.right++; } - int height = (int)FXSYS_ceil(rect_f.top - rect_f.bottom); + int height = (int)ceil(rect_f.top - rect_f.bottom); if (height < 1) { height = 1; if (rect_i.bottom == rect_i.top) @@ -608,8 +608,8 @@ bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData, pObject2Device->TransformRect(bbox); CFX_Matrix ctm = GetCTM(); - float fScaleX = FXSYS_fabs(ctm.a); - float fScaleY = FXSYS_fabs(ctm.d); + float fScaleX = fabs(ctm.a); + float fScaleY = fabs(ctm.d); FX_RECT rect = bbox.GetOuterRect(); auto bitmap = pdfium::MakeRetain(); auto Backdrop = pdfium::MakeRetain(); @@ -719,8 +719,8 @@ bool CFX_RenderDevice::SetDIBitsWithBlend( int blend_mode) { ASSERT(!pBitmap->IsAlphaMask()); CFX_Matrix ctm = GetCTM(); - float fScaleX = FXSYS_fabs(ctm.a); - float fScaleY = FXSYS_fabs(ctm.d); + float fScaleX = fabs(ctm.a); + float fScaleY = fabs(ctm.d); FX_RECT dest_rect(left, top, FXSYS_round(left + pBitmap->GetWidth() / fScaleX), FXSYS_round(top + pBitmap->GetHeight() / fScaleY)); @@ -889,7 +889,7 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, } char2device.Scale(font_size, -font_size); - if (FXSYS_fabs(char2device.a) + FXSYS_fabs(char2device.b) > 50 * 1.0f || + if (fabs(char2device.a) + fabs(char2device.b) > 50 * 1.0f || ((m_DeviceClass == FXDC_PRINTER) && !(text_flags & FXTEXT_PRINTIMAGETEXT))) { if (pFont->GetFace()) { @@ -927,8 +927,8 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, } std::vector glyphs(nChars); CFX_Matrix matrixCTM = GetCTM(); - float scale_x = FXSYS_fabs(matrixCTM.a); - float scale_y = FXSYS_fabs(matrixCTM.d); + float scale_x = fabs(matrixCTM.a); + float scale_y = fabs(matrixCTM.d); CFX_Matrix deviceCtm = char2device; CFX_Matrix m(scale_x, 0, 0, scale_y, 0, 0); deviceCtm.Concat(m); @@ -942,7 +942,7 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, if (anti_alias < FXFT_RENDER_MODE_LCD) glyph.m_Origin.x = FXSYS_round(glyph.m_fOrigin.x); else - glyph.m_Origin.x = static_cast(FXSYS_floor(glyph.m_fOrigin.x)); + glyph.m_Origin.x = static_cast(floor(glyph.m_fOrigin.x)); glyph.m_Origin.y = FXSYS_round(glyph.m_fOrigin.y); if (charpos.m_bGlyphAdjust) { diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index 5dd9079c36..40c643ea14 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -533,14 +533,14 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, pPSFont->m_Glyphs[j].m_GlyphIndex == charpos.m_GlyphIndex && ((!pPSFont->m_Glyphs[j].m_bGlyphAdjust && !charpos.m_bGlyphAdjust) || (pPSFont->m_Glyphs[j].m_bGlyphAdjust && charpos.m_bGlyphAdjust && - (FXSYS_fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[0] - - charpos.m_AdjustMatrix[0]) < 0.01 && - FXSYS_fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[1] - - charpos.m_AdjustMatrix[1]) < 0.01 && - FXSYS_fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[2] - - charpos.m_AdjustMatrix[2]) < 0.01 && - FXSYS_fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[3] - - charpos.m_AdjustMatrix[3]) < 0.01)))) { + (fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[0] - + charpos.m_AdjustMatrix[0]) < 0.01 && + fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[1] - + charpos.m_AdjustMatrix[1]) < 0.01 && + fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[2] - + charpos.m_AdjustMatrix[2]) < 0.01 && + fabs(pPSFont->m_Glyphs[j].m_AdjustMatrix[3] - + charpos.m_AdjustMatrix[3]) < 0.01)))) { *ps_fontnum = i; *ps_glyphindex = j; return; diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index 3b56477e7e..de17c0d0b5 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -95,9 +95,8 @@ HPEN CreatePen(const CFX_GraphStateData* pGraphState, float width; float scale = 1.f; if (pMatrix) - scale = FXSYS_fabs(pMatrix->a) > FXSYS_fabs(pMatrix->b) - ? FXSYS_fabs(pMatrix->a) - : FXSYS_fabs(pMatrix->b); + scale = fabs(pMatrix->a) > fabs(pMatrix->b) ? fabs(pMatrix->a) + : fabs(pMatrix->b); if (pGraphState) { width = scale * pGraphState->m_LineWidth; } else { @@ -151,7 +150,7 @@ HPEN CreatePen(const CFX_GraphStateData* pGraphState, dashes[i] = std::max(dashes[i], 1U); } } - return ExtCreatePen(PenStyle, (DWORD)FXSYS_ceil(width), &lb, + return ExtCreatePen(PenStyle, (DWORD)ceil(width), &lb, pGraphState->m_DashCount, reinterpret_cast(dashes.data())); } diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp index 26ac6605fb..868c113880 100644 --- a/core/fxge/win32/fx_win32_print.cpp +++ b/core/fxge/win32/fx_win32_print.cpp @@ -172,8 +172,8 @@ bool CGdiPrinterDriver::StartDIBits(const CFX_RetainPtr& pSource, } CFX_FloatRect unit_rect = pMatrix->GetUnitRect(); FX_RECT full_rect = unit_rect.GetOuterRect(); - if (FXSYS_fabs(pMatrix->b) < 0.5f && pMatrix->a != 0 && - FXSYS_fabs(pMatrix->c) < 0.5f && pMatrix->d != 0) { + if (fabs(pMatrix->b) < 0.5f && pMatrix->a != 0 && fabs(pMatrix->c) < 0.5f && + pMatrix->d != 0) { bool bFlipX = pMatrix->a < 0; bool bFlipY = pMatrix->d > 0; return StretchDIBits(pSource, color, @@ -183,7 +183,7 @@ bool CGdiPrinterDriver::StartDIBits(const CFX_RetainPtr& pSource, bFlipY ? -full_rect.Height() : full_rect.Height(), nullptr, 0, blend_type); } - if (FXSYS_fabs(pMatrix->a) >= 0.5f || FXSYS_fabs(pMatrix->d) >= 0.5f) + if (fabs(pMatrix->a) >= 0.5f || fabs(pMatrix->d) >= 0.5f) return false; CFX_RetainPtr pTransformed = diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp index 7afd12c707..4c8591e2eb 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp @@ -289,7 +289,7 @@ void CPDFXFA_DocEnvironment::PageViewEvent(CXFA_FFPageView* pPageView, int flag = (nNewCount < m_pContext->GetOriginalPageCount()) ? FXFA_PAGEVIEWEVENT_POSTREMOVED : FXFA_PAGEVIEWEVENT_POSTADDED; - int count = FXSYS_abs(nNewCount - m_pContext->GetOriginalPageCount()); + int count = abs(nNewCount - m_pContext->GetOriginalPageCount()); m_pContext->SetOriginalPageCount(nNewCount); pFormFillEnv->PageEvent(count, flag); } diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp index a0c286f68d..e9fa9a0fbe 100644 --- a/fpdfsdk/javascript/JS_Value.cpp +++ b/fpdfsdk/javascript/JS_Value.cpp @@ -501,7 +501,7 @@ int _isfinite(double v) { } double _toInteger(double n) { - return (n >= 0) ? FXSYS_floor(n) : -FXSYS_floor(-n); + return (n >= 0) ? floor(n) : -floor(-n); } bool _isLeapYear(int year) { @@ -509,9 +509,8 @@ bool _isLeapYear(int year) { } int _DayFromYear(int y) { - return (int)(365 * (y - 1970.0) + FXSYS_floor((y - 1969.0) / 4) - - FXSYS_floor((y - 1901.0) / 100) + - FXSYS_floor((y - 1601.0) / 400)); + return (int)(365 * (y - 1970.0) + floor((y - 1969.0) / 4) - + floor((y - 1901.0) / 100) + floor((y - 1601.0) / 400)); } double _TimeFromYear(int y) { @@ -529,7 +528,7 @@ double _TimeFromYearMonth(int y, int m) { } int _Day(double t) { - return (int)FXSYS_floor(t / 86400000); + return (int)floor(t / 86400000); } int _YearFromTime(double t) { @@ -699,7 +698,7 @@ double JS_MakeDay(int nYear, int nMonth, int nDate) { double y = _toInteger(nYear); double m = _toInteger(nMonth); double dt = _toInteger(nDate); - double ym = y + FXSYS_floor((double)m / 12); + double ym = y + floor((double)m / 12); double mn = _Mod(m, 12); double t = _TimeFromYearMonth((int)ym, (int)mn); diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp index 9289f44aa0..1c3efb1faa 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp @@ -1003,12 +1003,12 @@ void CPWL_ScrollBar::OnPosButtonMouseMove(const CFX_PointF& point) { switch (m_sbType) { case SBT_HSCROLL: - if (FXSYS_fabs(point.x - m_nOldPos) < 1) + if (fabs(point.x - m_nOldPos) < 1) return; fNewPos = FaceToTrue(m_fOldPosButton + point.x - m_nOldPos); break; case SBT_VSCROLL: - if (FXSYS_fabs(point.y - m_nOldPos) < 1) + if (fabs(point.y - m_nOldPos) < 1) return; fNewPos = FaceToTrue(m_fOldPosButton + point.y - m_nOldPos); break; diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp index 7e6483bb95..ecefec2f0a 100644 --- a/fxbarcode/oned/BC_OneDimWriter.cpp +++ b/fxbarcode/oned/BC_OneDimWriter.cpp @@ -173,8 +173,7 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString& text, leftPositon = 0; } float penX = 0.0; - float penY = - (float)FXSYS_abs(cFont->GetDescent()) * (float)fontSize / 1000.0f; + float penY = (float)abs(cFont->GetDescent()) * (float)fontSize / 1000.0f; float left = leftPositon; float top = 0.0; charPos[0].m_Origin = CFX_PointF(penX + left, penY + top); diff --git a/third_party/agg23/0000-bug-466.patch b/third_party/agg23/0000-bug-466.patch index 3217b3838a..e761198a48 100644 --- a/third_party/agg23/0000-bug-466.patch +++ b/third_party/agg23/0000-bug-466.patch @@ -4,7 +4,7 @@ index 6d7ba8a..2b06b1b 100644 +++ b/third_party/agg23/agg_math_stroke.h @@ -60,28 +60,30 @@ void stroke_calc_arc(VertexConsumer& out_vertices, } - da = FXSYS_acos(width / (width + ((1.0f / 8) / approximation_scale))) * 2; + da = acos(width / (width + ((1.0f / 8) / approximation_scale))) * 2; out_vertices.add(coord_type(x + dx1, y + dy1)); - if(!ccw) { - if(a1 > a2) { @@ -18,8 +18,8 @@ index 6d7ba8a..2b06b1b 100644 a1 += da; - while(a1 < a2) { + while (a1 < a2) { - out_vertices.add(coord_type(x + (width * FXSYS_cos(a1)), - y + (width * FXSYS_sin(a1)))); + out_vertices.add(coord_type(x + (width * cos(a1)), + y + (width * sin(a1)))); - a1 += da; + a1 += da; } @@ -34,8 +34,8 @@ index 6d7ba8a..2b06b1b 100644 a1 -= da; - while(a1 > a2) { + while (a1 > a2) { - out_vertices.add(coord_type(x + (width * FXSYS_cos(a1)), - y + (width * FXSYS_sin(a1)))); + out_vertices.add(coord_type(x + (width * cos(a1)), + y + (width * sin(a1)))); - a1 -= da; + a1 -= da; } diff --git a/third_party/agg23/agg_curves.cpp b/third_party/agg23/agg_curves.cpp index 4bfe457817..483da70128 100644 --- a/third_party/agg23/agg_curves.cpp +++ b/third_party/agg23/agg_curves.cpp @@ -61,17 +61,16 @@ void curve4_div::recursive_bezier(float x1, float y1, float y1234 = (y123 + y234) / 2; float dx = x4 - x1; float dy = y4 - y1; - float d2 = FXSYS_fabs(((x2 - x4) * dy) - ((y2 - y4) * dx)); - float d3 = FXSYS_fabs(((x3 - x4) * dy) - ((y3 - y4) * dx)); + float d2 = fabs(((x2 - x4) * dy) - ((y2 - y4) * dx)); + float d3 = fabs(((x3 - x4) * dy) - ((y3 - y4) * dx)); switch((int(d2 > curve_collinearity_epsilon) << 1) + int(d3 > curve_collinearity_epsilon)) { case 0: - if(FXSYS_fabs(x1 + x3 - x2 - x2) + - FXSYS_fabs(y1 + y3 - y2 - y2) + - FXSYS_fabs(x2 + x4 - x3 - x3) + - FXSYS_fabs(y2 + y4 - y3 - y3) <= m_distance_tolerance_manhattan) { - m_points.add(point_type(x1234, y1234, path_flags_jr)); - return; + if (fabs(x1 + x3 - x2 - x2) + fabs(y1 + y3 - y2 - y2) + + fabs(x2 + x4 - x3 - x3) + fabs(y2 + y4 - y3 - y3) <= + m_distance_tolerance_manhattan) { + m_points.add(point_type(x1234, y1234, path_flags_jr)); + return; } break; case 1: diff --git a/third_party/agg23/agg_math.h b/third_party/agg23/agg_math.h index 6c03bab929..6d5e39ac3e 100644 --- a/third_party/agg23/agg_math.h +++ b/third_party/agg23/agg_math.h @@ -52,8 +52,8 @@ AGG_INLINE bool calc_intersection(float ax, float ay, float bx, float by, { float num = ((ay - cy) * (dx - cx)) - ((ax - cx) * (dy - cy)); float den = ((bx - ax) * (dy - cy)) - ((by - ay) * (dx - cx)); - if (FXSYS_fabs(den) < intersection_epsilon) { - return false; + if (fabs(den) < intersection_epsilon) { + return false; } *x = ax + ((bx - ax) * num / den); *y = ay + ((by - ay) * num / den); diff --git a/third_party/agg23/agg_math_stroke.h b/third_party/agg23/agg_math_stroke.h index 90c1153cc5..82df8080cf 100644 --- a/third_party/agg23/agg_math_stroke.h +++ b/third_party/agg23/agg_math_stroke.h @@ -51,14 +51,14 @@ void stroke_calc_arc(VertexConsumer& out_vertices, float approximation_scale) { typedef typename VertexConsumer::value_type coord_type; - float a1 = FXSYS_atan2(dy1, dx1); - float a2 = FXSYS_atan2(dy2, dx2); + float a1 = atan2(dy1, dx1); + float a2 = atan2(dy2, dx2); float da = a1 - a2; bool ccw = da > 0 && da < FX_PI; if(width < 0) { width = -width; } - da = FXSYS_acos(width / (width + ((1.0f / 8) / approximation_scale))) * 2; + da = acos(width / (width + ((1.0f / 8) / approximation_scale))) * 2; out_vertices.add(coord_type(x + dx1, y + dy1)); if (da > 0) { if (!ccw) { @@ -68,8 +68,8 @@ void stroke_calc_arc(VertexConsumer& out_vertices, a2 -= da / 4; a1 += da; while (a1 < a2) { - out_vertices.add(coord_type(x + (width * FXSYS_cos(a1)), - y + (width * FXSYS_sin(a1)))); + out_vertices.add( + coord_type(x + (width * cos(a1)), y + (width * sin(a1)))); a1 += da; } } else { @@ -79,8 +79,8 @@ void stroke_calc_arc(VertexConsumer& out_vertices, a2 += da / 4; a1 -= da; while (a1 > a2) { - out_vertices.add(coord_type(x + (width * FXSYS_cos(a1)), - y + (width * FXSYS_sin(a1)))); + out_vertices.add( + coord_type(x + (width * cos(a1)), y + (width * sin(a1)))); a1 -= da; } } @@ -168,18 +168,16 @@ void stroke_calc_cap(VertexConsumer& out_vertices, out_vertices.add(coord_type(v0.x - dx1 - dx2, v0.y + dy1 - dy2)); out_vertices.add(coord_type(v0.x + dx1 - dx2, v0.y - dy1 - dy2)); } else { - float a1 = FXSYS_atan2(dy1, -dx1); - float a2 = a1 + FX_PI; - float da = - FXSYS_acos(width / (width + ((1.0f / 8) / approximation_scale))) * - 2; - out_vertices.add(coord_type(v0.x - dx1, v0.y + dy1)); + float a1 = atan2(dy1, -dx1); + float a2 = a1 + FX_PI; + float da = acos(width / (width + ((1.0f / 8) / approximation_scale))) * 2; + out_vertices.add(coord_type(v0.x - dx1, v0.y + dy1)); + a1 += da; + a2 -= da / 4; + while (a1 < a2) { + out_vertices.add( + coord_type(v0.x + (width * cos(a1)), v0.y + (width * sin(a1)))); a1 += da; - a2 -= da / 4; - while(a1 < a2) { - out_vertices.add(coord_type(v0.x + (width * FXSYS_cos(a1)), - v0.y + (width * FXSYS_sin(a1)))); - a1 += da; } out_vertices.add(coord_type(v0.x + dx1, v0.y - dy1)); } diff --git a/third_party/agg23/agg_vcgen_dash.cpp b/third_party/agg23/agg_vcgen_dash.cpp index cfeab0764e..74fd901181 100644 --- a/third_party/agg23/agg_vcgen_dash.cpp +++ b/third_party/agg23/agg_vcgen_dash.cpp @@ -55,7 +55,7 @@ void vcgen_dash::add_dash(float dash_len, float gap_len) void vcgen_dash::dash_start(float ds) { m_dash_start = ds; - calc_dash_start(FXSYS_fabs(ds)); + calc_dash_start(fabs(ds)); } void vcgen_dash::calc_dash_start(float ds) { diff --git a/xfa/fde/cfde_path.cpp b/xfa/fde/cfde_path.cpp index 4afa718978..a7d2e47ac1 100644 --- a/xfa/fde/cfde_path.cpp +++ b/xfa/fde/cfde_path.cpp @@ -41,10 +41,9 @@ void CFDE_Path::ArcTo(bool bStart, float ry = rect.height / 2; float cx = rect.left + rx; float cy = rect.top + ry; - float alpha = - FXSYS_atan2(rx * FXSYS_sin(startAngle), ry * FXSYS_cos(startAngle)); - float beta = FXSYS_atan2(rx * FXSYS_sin(endAngle), ry * FXSYS_cos(endAngle)); - if (FXSYS_fabs(beta - alpha) > FX_PI) { + float alpha = atan2(rx * sin(startAngle), ry * cos(startAngle)); + float beta = atan2(rx * sin(endAngle), ry * cos(endAngle)); + if (fabs(beta - alpha) > FX_PI) { if (beta > alpha) beta -= 2 * FX_PI; else @@ -52,11 +51,11 @@ void CFDE_Path::ArcTo(bool bStart, } float half_delta = (beta - alpha) / 2; - float bcp = 4.0f / 3 * (1 - FXSYS_cos(half_delta)) / FXSYS_sin(half_delta); - float sin_alpha = FXSYS_sin(alpha); - float sin_beta = FXSYS_sin(beta); - float cos_alpha = FXSYS_cos(alpha); - float cos_beta = FXSYS_cos(beta); + float bcp = 4.0f / 3 * (1 - cos(half_delta)) / sin(half_delta); + float sin_alpha = sin(alpha); + float sin_beta = sin(beta); + float cos_alpha = cos(alpha); + float cos_beta = cos(beta); if (bStart) MoveTo(CFX_PointF(cx + rx * cos_alpha, cy + ry * sin_alpha)); @@ -154,8 +153,8 @@ void CFDE_Path::AddEllipse(const CFX_RectF& rect) { void CFDE_Path::AddLine(const CFX_PointF& pt1, const CFX_PointF& pt2) { std::vector& points = m_Path.GetPoints(); - if (points.empty() || FXSYS_fabs(points.back().m_Point.x - pt1.x) > 0.001 || - FXSYS_fabs(points.back().m_Point.y - pt1.y) > 0.001) { + if (points.empty() || fabs(points.back().m_Point.x - pt1.x) > 0.001 || + fabs(points.back().m_Point.y - pt1.y) > 0.001) { MoveTo(pt1); } LineTo(pt2); @@ -180,8 +179,8 @@ void CFDE_Path::AddPolygon(const std::vector& points) { AddLines(points); const CFX_PointF* p = points.data(); - if (FXSYS_fabs(p[0].x - p[iCount - 1].x) < 0.01f || - FXSYS_fabs(p[0].y - p[iCount - 1].y) < 0.01f) { + if (fabs(p[0].x - p[iCount - 1].x) < 0.01f || + fabs(p[0].y - p[iCount - 1].y) < 0.01f) { LineTo(p[0]); } CloseFigure(); diff --git a/xfa/fde/cfde_renderdevice.cpp b/xfa/fde/cfde_renderdevice.cpp index d3456e17cb..6f2431737b 100644 --- a/xfa/fde/cfde_renderdevice.cpp +++ b/xfa/fde/cfde_renderdevice.cpp @@ -57,10 +57,9 @@ void CFDE_RenderDevice::RestoreState() { bool CFDE_RenderDevice::SetClipRect(const CFX_RectF& rtClip) { m_rtClip = rtClip; - return m_pDevice->SetClip_Rect(FX_RECT((int32_t)FXSYS_floor(rtClip.left), - (int32_t)FXSYS_floor(rtClip.top), - (int32_t)FXSYS_ceil(rtClip.right()), - (int32_t)FXSYS_ceil(rtClip.bottom()))); + return m_pDevice->SetClip_Rect( + FX_RECT((int32_t)floor(rtClip.left), (int32_t)floor(rtClip.top), + (int32_t)ceil(rtClip.right()), (int32_t)ceil(rtClip.bottom()))); } const CFX_RectF& CFDE_RenderDevice::GetClipRect() { diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp index 15edfc1c1c..37e3e118d1 100644 --- a/xfa/fde/cfde_txtedtengine.cpp +++ b/xfa/fde/cfde_txtedtengine.cpp @@ -283,8 +283,7 @@ int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, break; } if (bShift && m_nAnchorPos != -1 && (m_nAnchorPos != m_nCaret)) { - AddSelRange(std::min(m_nAnchorPos, m_nCaret), - FXSYS_abs(m_nAnchorPos - m_nCaret)); + AddSelRange(std::min(m_nAnchorPos, m_nCaret), abs(m_nAnchorPos - m_nCaret)); m_Param.pEventSink->OnSelChanged(); } if (bSelChange) diff --git a/xfa/fde/css/cfde_cssnumbervalue.cpp b/xfa/fde/css/cfde_cssnumbervalue.cpp index e74ca5b859..45a9c917b1 100644 --- a/xfa/fde/css/cfde_cssnumbervalue.cpp +++ b/xfa/fde/css/cfde_cssnumbervalue.cpp @@ -8,7 +8,7 @@ CFDE_CSSNumberValue::CFDE_CSSNumberValue(FDE_CSSNumberType type, float value) : CFDE_CSSValue(FDE_CSSPrimitiveType::Number), type_(type), value_(value) { - if (type_ == FDE_CSSNumberType::Number && FXSYS_fabs(value_) < 0.001f) + if (type_ == FDE_CSSNumberType::Number && fabs(value_) < 0.001f) value_ = 0.0f; } diff --git a/xfa/fgas/crt/cfgas_formatstring.cpp b/xfa/fgas/crt/cfgas_formatstring.cpp index 9123b5c127..8d80269418 100644 --- a/xfa/fgas/crt/cfgas_formatstring.cpp +++ b/xfa/fgas/crt/cfgas_formatstring.cpp @@ -885,7 +885,7 @@ bool TimeFormat(const CFX_WideString& wsTimePattern, wsResult += tz.tzHour < 0 ? L"-" : L"+"; CFX_WideString wsTimezone; - wsTimezone.Format(L"%02d:%02d", FXSYS_abs(tz.tzHour), tz.tzMinute); + wsTimezone.Format(L"%02d:%02d", abs(tz.tzHour), tz.tzMinute); wsResult += wsTimezone; } } else if (dwSymbol == FXBSTR_ID(0, 0, 'z', '1')) { @@ -894,7 +894,7 @@ bool TimeFormat(const CFX_WideString& wsTimePattern, wsResult += tz.tzHour < 0 ? L"-" : L"+"; CFX_WideString wsTimezone; - wsTimezone.Format(L"%02d:%02d", FXSYS_abs(tz.tzHour), tz.tzMinute); + wsTimezone.Format(L"%02d:%02d", abs(tz.tzHour), tz.tzMinute); wsResult += wsTimezone; } } diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp index 07a3cefa69..842e729217 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.cpp +++ b/xfa/fgas/layout/fgas_rtfbreak.cpp @@ -703,7 +703,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, continue; } - int32_t iCharWidth = FXSYS_abs(iWidth); + int32_t iCharWidth = abs(iWidth); bool bEmptyChar = (dwCharType >= FX_CHARTYPE_Tab && dwCharType <= FX_CHARTYPE_Control); if (!bEmptyChar) diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp index c21d6bba3a..83a03eed5e 100644 --- a/xfa/fgas/layout/fgas_textbreak.cpp +++ b/xfa/fgas/layout/fgas_textbreak.cpp @@ -946,7 +946,7 @@ std::vector CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, bCharBBox = pFont->GetBBox(&bbox); float fLeft = std::max(0.0f, bbox.left * fScale); - float fHeight = FXSYS_fabs(bbox.height * fScale); + float fHeight = fabs(bbox.height * fScale); bool bRTLPiece = !!(pTxtRun->dwCharStyles & FX_TXTCHARSTYLE_OddBidiLevel); bool bSingleLine = !!(pTxtRun->dwStyles & FX_LAYOUTSTYLE_SingleLine); bool bCombText = !!(pTxtRun->dwStyles & FX_LAYOUTSTYLE_CombText); diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index c2b0ddf669..1b76ec6240 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -1367,7 +1367,7 @@ void CFWL_Edit::OnMouseMove(CFWL_MessageMouse* pMsg) { m_nSelStart = nLen; m_EdtEngine.AddSelRange(std::min(m_nSelStart, nIndex), - FXSYS_abs(nIndex - m_nSelStart)); + abs(nIndex - m_nSelStart)); } void CFWL_Edit::OnKeyDown(CFWL_MessageKey* pMsg) { 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 } diff --git a/xfa/fxgraphics/cfx_graphics.cpp b/xfa/fxgraphics/cfx_graphics.cpp index 3cfe2d0192..1f224c7685 100644 --- a/xfa/fxgraphics/cfx_graphics.cpp +++ b/xfa/fxgraphics/cfx_graphics.cpp @@ -452,7 +452,7 @@ void CFX_Graphics::FillPathWithShading(CFX_Path* path, if (b2_4ac < 0) { continue; } - float root = (FXSYS_sqrt(b2_4ac)); + float root = (sqrt(b2_4ac)); float s1, s2; if (a > 0) { s1 = (-b - root) / (2 * a); diff --git a/xfa/fxgraphics/cfx_path.cpp b/xfa/fxgraphics/cfx_path.cpp index 5ff9bffb07..fc0051ad4c 100644 --- a/xfa/fxgraphics/cfx_path.cpp +++ b/xfa/fxgraphics/cfx_path.cpp @@ -50,14 +50,14 @@ void CFX_Path::ArcToInternal(const CFX_PointF& pos, const CFX_SizeF& size, float start_angle, float sweep_angle) { - float x0 = FXSYS_cos(sweep_angle / 2); - float y0 = FXSYS_sin(sweep_angle / 2); + float x0 = cos(sweep_angle / 2); + float y0 = sin(sweep_angle / 2); float tx = ((1.0f - x0) * 4) / (3 * 1.0f); float ty = y0 - ((tx * x0) / y0); CFX_PointF points[] = {CFX_PointF(x0 + tx, -ty), CFX_PointF(x0 + tx, ty)}; - float sn = FXSYS_sin(start_angle + sweep_angle / 2); - float cs = FXSYS_cos(start_angle + sweep_angle / 2); + float sn = sin(start_angle + sweep_angle / 2); + float cs = cos(start_angle + sweep_angle / 2); CFX_PointF bezier; bezier.x = pos.x + (size.width * ((points[0].x * cs) - (points[0].y * sn))); @@ -68,8 +68,8 @@ void CFX_Path::ArcToInternal(const CFX_PointF& pos, bezier.y = pos.y + (size.height * ((points[1].x * sn) + (points[1].y * cs))); data_.AppendPoint(bezier, FXPT_TYPE::BezierTo, false); - bezier.x = pos.x + (size.width * FXSYS_cos(start_angle + sweep_angle)); - bezier.y = pos.y + (size.height * FXSYS_sin(start_angle + sweep_angle)); + bezier.x = pos.x + (size.width * cos(start_angle + sweep_angle)); + bezier.y = pos.y + (size.height * sin(start_angle + sweep_angle)); data_.AppendPoint(bezier, FXPT_TYPE::BezierTo, false); } @@ -105,8 +105,8 @@ void CFX_Path::AddArc(const CFX_PointF& original_pos, CFX_SizeF size = original_size / 2; CFX_PointF pos(original_pos.x + size.width, original_pos.y + size.height); - data_.AppendPoint(pos + CFX_PointF(size.width * FXSYS_cos(start_angle), - size.height * FXSYS_sin(start_angle)), + data_.AppendPoint(pos + CFX_PointF(size.width * cos(start_angle), + size.height * sin(start_angle)), FXPT_TYPE::MoveTo, false); float total_sweep = 0; -- cgit v1.2.3