summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font.cpp13
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp15
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp29
5 files changed, 29 insertions, 40 deletions
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
index 87c95c668e..1e9335f30f 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -1569,13 +1569,10 @@ FX_BOOL CPDF_Type3Font::_Load() {
}
CPDF_Array* pBBox = m_pFontDict->GetArrayBy("FontBBox");
if (pBBox) {
- m_FontBBox.left =
- (int32_t)(FXSYS_Mul(pBBox->GetNumberAt(0), xscale) * 1000);
- m_FontBBox.bottom =
- (int32_t)(FXSYS_Mul(pBBox->GetNumberAt(1), yscale) * 1000);
- m_FontBBox.right =
- (int32_t)(FXSYS_Mul(pBBox->GetNumberAt(2), xscale) * 1000);
- m_FontBBox.top = (int32_t)(FXSYS_Mul(pBBox->GetNumberAt(3), yscale) * 1000);
+ m_FontBBox.left = (int32_t)(pBBox->GetNumberAt(0) * xscale * 1000);
+ m_FontBBox.bottom = (int32_t)(pBBox->GetNumberAt(1) * yscale * 1000);
+ m_FontBBox.right = (int32_t)(pBBox->GetNumberAt(2) * xscale * 1000);
+ m_FontBBox.top = (int32_t)(pBBox->GetNumberAt(3) * yscale * 1000);
}
int StartChar = m_pFontDict->GetIntegerBy("FirstChar");
CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths");
@@ -1589,7 +1586,7 @@ FX_BOOL CPDF_Type3Font::_Load() {
}
for (FX_DWORD i = 0; i < count; i++) {
m_CharWidthL[StartChar + i] =
- FXSYS_round(FXSYS_Mul(pWidthArray->GetNumberAt(i), xscale) * 1000);
+ FXSYS_round(pWidthArray->GetNumberAt(i) * xscale * 1000);
}
}
m_pCharProcs = m_pFontDict->GetDictBy("CharProcs");
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index be038004ac..81cf92ee05 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -246,7 +246,7 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX,
m_nChars == 1 ? (FX_DWORD)(uintptr_t)m_pCharCodes : m_pCharCodes[i];
if (i > 0) {
if (charcode == (FX_DWORD)-1) {
- curpos -= FXSYS_Mul(m_pCharPos[i - 1], fontsize) / 1000;
+ curpos -= (m_pCharPos[i - 1] * fontsize) / 1000;
continue;
}
m_pCharPos[i - 1] = curpos;
@@ -336,7 +336,7 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX,
max_x = max_x * fontsize / 1000;
} else {
if (pTextAdvanceX) {
- *pTextAdvanceX = FXSYS_Mul(curpos, horz_scale);
+ *pTextAdvanceX = curpos * horz_scale;
}
if (pTextAdvanceY) {
*pTextAdvanceY = 0;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
index bee4a5b707..de3a6572f2 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
@@ -315,13 +315,13 @@ void CPDF_TextState::SetFont(CPDF_Font* pFont) {
FX_FLOAT CPDF_TextState::GetFontSizeV() const {
FX_FLOAT* pMatrix = GetMatrix();
FX_FLOAT unit = FXSYS_sqrt2(pMatrix[1], pMatrix[3]);
- FX_FLOAT size = FXSYS_Mul(unit, GetFontSize());
+ FX_FLOAT size = unit * GetFontSize();
return (FX_FLOAT)FXSYS_fabs(size);
}
FX_FLOAT CPDF_TextState::GetFontSizeH() const {
FX_FLOAT* pMatrix = GetMatrix();
FX_FLOAT unit = FXSYS_sqrt2(pMatrix[0], pMatrix[2]);
- FX_FLOAT size = FXSYS_Mul(unit, GetFontSize());
+ FX_FLOAT size = unit * GetFontSize();
return (FX_FLOAT)FXSYS_fabs(size);
}
FX_FLOAT CPDF_TextState::GetBaselineAngle() const {
@@ -449,10 +449,10 @@ void CPDF_AllStates::SetLineDash(CPDF_Array* pArray,
FX_FLOAT phase,
FX_FLOAT scale) {
CFX_GraphStateData* pData = m_GraphState.GetModify();
- pData->m_DashPhase = FXSYS_Mul(phase, scale);
+ pData->m_DashPhase = phase * scale;
pData->SetDashCount(pArray->GetCount());
for (FX_DWORD i = 0; i < pArray->GetCount(); i++) {
- pData->m_DashArray[i] = FXSYS_Mul(pArray->GetNumberAt(i), scale);
+ pData->m_DashArray[i] = pArray->GetNumberAt(i) * scale;
}
}
void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index efe0f25a9f..fe07a63bca 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -1351,12 +1351,10 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs,
if (fInitKerning != 0) {
if (!pFont->IsVertWriting()) {
m_pCurStates->m_TextX -=
- FXSYS_Mul(fInitKerning, m_pCurStates->m_TextState.GetFontSize()) /
- 1000;
+ (fInitKerning * m_pCurStates->m_TextState.GetFontSize()) / 1000;
} else {
m_pCurStates->m_TextY -=
- FXSYS_Mul(fInitKerning, m_pCurStates->m_TextState.GetFontSize()) /
- 1000;
+ (fInitKerning * m_pCurStates->m_TextState.GetFontSize()) / 1000;
}
}
if (nsegs == 0) {
@@ -1396,13 +1394,11 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs,
if (pKerning && pKerning[nsegs - 1] != 0) {
if (!pFont->IsVertWriting()) {
m_pCurStates->m_TextX -=
- FXSYS_Mul(pKerning[nsegs - 1],
- m_pCurStates->m_TextState.GetFontSize()) /
+ (pKerning[nsegs - 1] * m_pCurStates->m_TextState.GetFontSize()) /
1000;
} else {
m_pCurStates->m_TextY -=
- FXSYS_Mul(pKerning[nsegs - 1],
- m_pCurStates->m_TextState.GetFontSize()) /
+ (pKerning[nsegs - 1] * m_pCurStates->m_TextState.GetFontSize()) /
1000;
}
}
@@ -1430,8 +1426,7 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() {
if (nsegs == 0) {
for (int i = 0; i < n; i++) {
m_pCurStates->m_TextX -=
- FXSYS_Mul(pArray->GetNumberAt(i),
- m_pCurStates->m_TextState.GetFontSize()) /
+ (pArray->GetNumberAt(i) * m_pCurStates->m_TextState.GetFontSize()) /
1000;
}
return;
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index f4ade7d48d..b9ff9f4750 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -44,8 +44,7 @@ static void DrawAxialShading(CFX_DIBitmap* pBitmap,
int height = pBitmap->GetHeight();
FX_FLOAT x_span = end_x - start_x;
FX_FLOAT y_span = end_y - start_y;
- FX_FLOAT axis_len_square =
- FXSYS_Mul(x_span, x_span) + FXSYS_Mul(y_span, y_span);
+ FX_FLOAT axis_len_square = (x_span * x_span) + (y_span * y_span);
CFX_Matrix matrix;
matrix.SetReverse(*pObject2Bitmap);
int total_results = 0;
@@ -85,8 +84,7 @@ static void DrawAxialShading(CFX_DIBitmap* pBitmap,
FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row;
matrix.Transform(x, y);
FX_FLOAT scale = FXSYS_Div(
- FXSYS_Mul(x - start_x, x_span) + FXSYS_Mul(y - start_y, y_span),
- axis_len_square);
+ ((x - start_x) * x_span) + ((y - start_y) * y_span), axis_len_square);
int index = (int32_t)(scale * (SHADING_STEPS - 1));
if (index < 0) {
if (!bStartExtend) {
@@ -165,16 +163,16 @@ static void DrawRadialShading(CFX_DIBitmap* pBitmap,
FXARGB_TODIB(FXARGB_MAKE(alpha, FXSYS_round(R * 255),
FXSYS_round(G * 255), FXSYS_round(B * 255)));
}
- FX_FLOAT a = FXSYS_Mul(start_x - end_x, start_x - end_x) +
- FXSYS_Mul(start_y - end_y, start_y - end_y) -
- FXSYS_Mul(start_r - end_r, start_r - end_r);
+ FX_FLOAT a = ((start_x - end_x) * (start_x - end_x)) +
+ ((start_y - end_y) * (start_y - end_y)) -
+ ((start_r - end_r) * (start_r - end_r));
int width = pBitmap->GetWidth();
int height = pBitmap->GetHeight();
int pitch = pBitmap->GetPitch();
FX_BOOL bDecreasing = FALSE;
if (start_r > end_r) {
- int length = (int)FXSYS_sqrt((FXSYS_Mul(start_x - end_x, start_x - end_x) +
- FXSYS_Mul(start_y - end_y, start_y - end_y)));
+ int length = (int)FXSYS_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;
}
@@ -184,17 +182,16 @@ static void DrawRadialShading(CFX_DIBitmap* pBitmap,
for (int column = 0; column < width; column++) {
FX_FLOAT x = (FX_FLOAT)column, y = (FX_FLOAT)row;
matrix.Transform(x, y);
- FX_FLOAT b = -2 * (FXSYS_Mul(x - start_x, end_x - start_x) +
- FXSYS_Mul(y - start_y, end_y - start_y) +
- FXSYS_Mul(start_r, end_r - start_r));
- FX_FLOAT c = FXSYS_Mul(x - start_x, x - start_x) +
- FXSYS_Mul(y - start_y, y - start_y) -
- FXSYS_Mul(start_r, start_r);
+ FX_FLOAT b = -2 * (((x - start_x) * (end_x - start_x)) +
+ ((y - start_y) * (end_y - start_y)) +
+ (start_r * (end_r - start_r)));
+ FX_FLOAT c = ((x - start_x) * (x - start_x)) +
+ ((y - start_y) * (y - start_y)) - (start_r * start_r);
FX_FLOAT s;
if (a == 0) {
s = FXSYS_Div(-c, b);
} else {
- FX_FLOAT b2_4ac = FXSYS_Mul(b, b) - 4 * FXSYS_Mul(a, c);
+ FX_FLOAT b2_4ac = (b * b) - 4 * (a * c);
if (b2_4ac < 0) {
continue;
}