summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi')
-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
9 files changed, 62 insertions, 66 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;