summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-04-03 14:51:45 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-03 20:36:56 +0000
commit669a418f75c05d4a39e2bcaff2b7b93dec1c5764 (patch)
treeb76f5025c8e70b1ef449f317ff60a8eef7317ab9 /core
parentac978f83392e309488601eb382d5f318b6d366ad (diff)
downloadpdfium-669a418f75c05d4a39e2bcaff2b7b93dec1c5764.tar.xz
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 <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/page/cpdf_colorspace.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_textstate.cpp8
-rw-r--r--core/fpdfapi/page/cpdf_tilingpattern.cpp4
-rw-r--r--core/fpdfapi/page/fpdf_page_func.cpp18
-rw-r--r--core/fpdfapi/render/cpdf_devicebuffer.cpp2
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.cpp7
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp81
-rw-r--r--core/fpdfapi/render/cpdf_type3cache.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_type3glyphs.cpp2
-rw-r--r--core/fpdftext/cpdf_textpage.cpp62
-rw-r--r--core/fxcodec/codec/fx_codec_flate.cpp6
-rw-r--r--core/fxcodec/codec/fx_codec_progress.cpp30
-rw-r--r--core/fxcrt/cfx_decimal.cpp4
-rw-r--r--core/fxcrt/fx_basic_coords.cpp55
-rw-r--r--core/fxcrt/fx_coordinates.h6
-rw-r--r--core/fxcrt/fx_ext.h1
-rw-r--r--core/fxcrt/fx_extension.cpp7
-rw-r--r--core/fxcrt/fx_system.h14
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp3
-rw-r--r--core/fxge/dib/cfx_dibsource.cpp2
-rw-r--r--core/fxge/dib/cfx_imagerenderer.cpp10
-rw-r--r--core/fxge/dib/cfx_imagetransformer.cpp21
-rw-r--r--core/fxge/dib/fx_dib_engine.cpp39
-rw-r--r--core/fxge/ge/cfx_facecache.cpp10
-rw-r--r--core/fxge/ge/cfx_fontmapper.cpp2
-rw-r--r--core/fxge/ge/cfx_pathdata.cpp19
-rw-r--r--core/fxge/ge/cfx_renderdevice.cpp22
-rw-r--r--core/fxge/win32/cfx_psrenderer.cpp16
-rw-r--r--core/fxge/win32/fx_win32_device.cpp7
-rw-r--r--core/fxge/win32/fx_win32_print.cpp6
30 files changed, 218 insertions, 252 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<float>::epsilon())
+ if (fabs(det) < std::numeric_limits<float>::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<CFX_DIBitmap> 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<CFX_DIBitmap>& 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<CFX_DIBitmap>& 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<CFX_DIBitmap>& pBitmap,
if (min_y == max_y)
return;
- int min_yi = std::max(static_cast<int>(FXSYS_floor(min_y)), 0);
- int max_yi = static_cast<int>(FXSYS_ceil(max_y));
+ int min_yi = std::max(static_cast<int>(floor(min_y)), 0);
+ int max_yi = static_cast<int>(ceil(max_y));
if (max_yi >= pBitmap->GetHeight())
max_yi = pBitmap->GetHeight() - 1;
@@ -436,13 +436,13 @@ void DrawGouraud(const CFX_RetainPtr<CFX_DIBitmap>& 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<CFX_DIBitmap> 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<CFX_DIBitmap>();
@@ -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<CFX_DIBitmap> 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<float>(blues[i]));
+ float distance = fabs(pos - static_cast<float>(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<uint64_t>(newval);
pmid = static_cast<uint64_t>(newval / 1e32);
phi = static_cast<uint64_t>(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<uint64_t>(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<int>(FXSYS_ceil(f2 - f1));
- int i1_1 = static_cast<int>(FXSYS_floor(f1));
- int i1_2 = static_cast<int>(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<int>(ceil(f2 - f1));
+ int i1_1 = static_cast<int>(floor(f1));
+ int i1_2 = static_cast<int>(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<float>::epsilon())
+ if (fabs(i) <= std::numeric_limits<float>::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<BaseType> {
const CFX_PTemplate<BaseType>& point2)
: CFX_PTemplate<BaseType>(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<BaseType> {
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<uint32_t>(-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> IFX_MemoryStream::Create(bool bConsecutive) {
return pdfium::MakeRetain<CFX_MemoryStream>(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<uint32_t>(p[3]) << 24) | (static_cast<uint32_t>(p[2]) << 16) | \
(static_cast<uint32_t>(p[1]) << 8) | (static_cast<uint32_t>(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_DIBitmap> CFX_DIBSource::StretchTo(int dest_width,
uint32_t flags,
const FX_RECT* pClip) {
CFX_RetainPtr<CFX_DIBSource> 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<CFX_DIBitmap>& 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<CFX_ImageStretcher>(
&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<long long>(m_SrcWidth) *
- m_SrcHeight / FXSYS_abs(dest_width)) {
+ if (!bInterpol && abs(dest_width) != 0 &&
+ abs(dest_height) / 8 < static_cast<long long>(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<int>(ft_matrix.xx)) +
- FXSYS_abs(static_cast<int>(ft_matrix.xy))) /
+ level = level *
+ (abs(static_cast<int>(ft_matrix.xx)) +
+ abs(static_cast<int>(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<float>(FXSYS_fabs(half_width * start_len / start_to_mid.x));
+ static_cast<float>(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<float>(FXSYS_fabs(half_width * end_len / end_to_mid.x));
+ end_dc = static_cast<float>(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<FXTEXT_GLYPHPOS>* 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<float>(space));
+ float error = fabs(space_f) - fabs(static_cast<float>(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<CFX_DIBitmap>();
auto Backdrop = pdfium::MakeRetain<CFX_DIBitmap>();
@@ -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<FXTEXT_GLYPHPOS> 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<int>(FXSYS_floor(glyph.m_fOrigin.x));
+ glyph.m_Origin.x = static_cast<int>(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<const DWORD*>(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<CFX_DIBSource>& 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<CFX_DIBSource>& 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<CFX_DIBitmap> pTransformed =