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/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 +++++++++++----------- 4 files changed, 26 insertions(+), 27 deletions(-) (limited to 'core/fxge/ge') 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) { -- cgit v1.2.3