summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-02-23 15:23:29 -0500
committerDan Sinclair <dsinclair@chromium.org>2016-02-23 15:23:29 -0500
commit2c8fad44315db58f5b3222161dcb699691dca904 (patch)
tree70e9bdf55e1e3197d8bd088abd103012b602e32f
parent2886a25b68225ad3ad70d417b01108ad1d126488 (diff)
downloadpdfium-2c8fad44315db58f5b3222161dcb699691dca904.tar.xz
Remove FXSYS_Mul.
This define just multiples the two parameters together. Inline the *'s. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1729613003 .
-rw-r--r--core/include/fxcrt/fx_system.h1
-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
-rw-r--r--core/src/fxge/dib/fx_dib_engine.cpp8
-rw-r--r--core/src/fxge/ge/fx_ge_path.cpp22
-rw-r--r--core/src/fxge/win32/fx_win32_gdipext.cpp2
-rw-r--r--third_party/agg23/agg_clip_liang_barsky.h16
-rw-r--r--third_party/agg23/agg_curves.cpp16
-rw-r--r--third_party/agg23/agg_math.h6
-rw-r--r--third_party/agg23/agg_math_stroke.h30
-rw-r--r--xfa/src/fxgraphics/src/fx_graphics.cpp28
-rw-r--r--xfa/src/fxgraphics/src/fx_path_generator.cpp24
-rw-r--r--xfa/src/fxgraphics/src/pre.h7
16 files changed, 104 insertions, 125 deletions
diff --git a/core/include/fxcrt/fx_system.h b/core/include/fxcrt/fx_system.h
index 41dc4468a6..4eb217a094 100644
--- a/core/include/fxcrt/fx_system.h
+++ b/core/include/fxcrt/fx_system.h
@@ -269,7 +269,6 @@ int64_t FXSYS_atoi64(const FX_CHAR* str);
int64_t FXSYS_wtoi64(const FX_WCHAR* str);
const FX_CHAR* FXSYS_i64toa(int64_t value, FX_CHAR* str, int radix);
int FXSYS_round(FX_FLOAT f);
-#define FXSYS_Mul(a, b) ((a) * (b))
#define FXSYS_Div(a, b) ((a) / (b))
#define FXSYS_MulDiv(a, b, c) ((a) * (b) / (c))
#define FXSYS_sqrt2(a, b) (FX_FLOAT) FXSYS_sqrt((a) * (a) + (b) * (b))
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;
}
diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp
index de56567c51..47fca79846 100644
--- a/core/src/fxge/dib/fx_dib_engine.cpp
+++ b/core/src/fxge/dib/fx_dib_engine.cpp
@@ -274,10 +274,10 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap,
double scale_y = FXSYS_Div((FX_FLOAT)(m_SrcHeight), (FX_FLOAT)(m_DestHeight));
double base_x = m_DestWidth > 0 ? 0.0f : (FX_FLOAT)(m_DestWidth);
double base_y = m_DestHeight > 0 ? 0.0f : (FX_FLOAT)(m_DestHeight);
- double src_left = FXSYS_Mul(scale_x, (FX_FLOAT)(clip_rect.left) + base_x);
- double src_right = FXSYS_Mul(scale_x, (FX_FLOAT)(clip_rect.right) + base_x);
- double src_top = FXSYS_Mul(scale_y, (FX_FLOAT)(clip_rect.top) + base_y);
- double src_bottom = FXSYS_Mul(scale_y, (FX_FLOAT)(clip_rect.bottom) + base_y);
+ double src_left = scale_x * ((FX_FLOAT)(clip_rect.left) + base_x);
+ double src_right = scale_x * ((FX_FLOAT)(clip_rect.right) + base_x);
+ double src_top = scale_y * ((FX_FLOAT)(clip_rect.top) + base_y);
+ double src_bottom = scale_y * ((FX_FLOAT)(clip_rect.bottom) + base_y);
if (src_left > src_right) {
double temp = src_left;
src_left = src_right;
diff --git a/core/src/fxge/ge/fx_ge_path.cpp b/core/src/fxge/ge/fx_ge_path.cpp
index 23b1c2fe07..0084f092d1 100644
--- a/core/src/fxge/ge/fx_ge_path.cpp
+++ b/core/src/fxge/ge/fx_ge_path.cpp
@@ -264,14 +264,14 @@ static void _UpdateLineJoinPoints(CFX_FloatRect& rect,
}
if (!bStartVert) {
start_k = FXSYS_Div(middle_y - start_y, middle_x - start_x);
- start_c = middle_y - FXSYS_Mul(start_k, middle_x);
+ start_c = middle_y - (start_k * middle_x);
start_len = FXSYS_sqrt2(start_x - middle_x, start_y - middle_y);
start_dc = (FX_FLOAT)FXSYS_fabs(
FXSYS_MulDiv(half_width, start_len, start_x - middle_x));
}
if (!bEndVert) {
end_k = FXSYS_Div(end_y - middle_y, end_x - middle_x);
- end_c = middle_y - FXSYS_Mul(end_k, middle_x);
+ end_c = middle_y - (end_k * middle_x);
end_len = FXSYS_sqrt2(end_x - middle_x, end_y - middle_y);
end_dc = (FX_FLOAT)FXSYS_fabs(
FXSYS_MulDiv(half_width, end_len, end_x - middle_x));
@@ -284,10 +284,10 @@ static void _UpdateLineJoinPoints(CFX_FloatRect& rect,
outside_x -= half_width;
}
FX_FLOAT outside_y;
- if (start_y < FXSYS_Mul(end_k, start_x) + end_c) {
- outside_y = FXSYS_Mul(end_k, outside_x) + end_c + end_dc;
+ if (start_y < (end_k * start_x) + end_c) {
+ outside_y = (end_k * outside_x) + end_c + end_dc;
} else {
- outside_y = FXSYS_Mul(end_k, outside_x) + end_c - end_dc;
+ outside_y = (end_k * outside_x) + end_c - end_dc;
}
rect.UpdateRect(outside_x, outside_y);
return;
@@ -300,10 +300,10 @@ static void _UpdateLineJoinPoints(CFX_FloatRect& rect,
outside_x -= half_width;
}
FX_FLOAT outside_y;
- if (end_y < FXSYS_Mul(start_k, end_x) + start_c) {
- outside_y = FXSYS_Mul(start_k, outside_x) + start_c + start_dc;
+ if (end_y < (start_k * end_x) + start_c) {
+ outside_y = (start_k * outside_x) + start_c + start_dc;
} else {
- outside_y = FXSYS_Mul(start_k, outside_x) + start_c - start_dc;
+ outside_y = (start_k * outside_x) + start_c - start_dc;
}
rect.UpdateRect(outside_x, outside_y);
return;
@@ -320,19 +320,19 @@ static void _UpdateLineJoinPoints(CFX_FloatRect& rect,
return;
}
FX_FLOAT start_outside_c = start_c;
- if (end_y < FXSYS_Mul(start_k, end_x) + start_c) {
+ if (end_y < (start_k * end_x) + start_c) {
start_outside_c += start_dc;
} else {
start_outside_c -= start_dc;
}
FX_FLOAT end_outside_c = end_c;
- if (start_y < FXSYS_Mul(end_k, start_x) + end_c) {
+ if (start_y < (end_k * start_x) + end_c) {
end_outside_c += end_dc;
} else {
end_outside_c -= end_dc;
}
FX_FLOAT join_x = FXSYS_Div(end_outside_c - start_outside_c, start_k - end_k);
- FX_FLOAT join_y = FXSYS_Mul(start_k, join_x) + start_outside_c;
+ FX_FLOAT join_y = (start_k * join_x) + start_outside_c;
rect.UpdateRect(join_x, join_y);
}
CFX_FloatRect CFX_PathData::GetBoundingBox(FX_FLOAT line_width,
diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp
index aaf7c36919..ce280948d7 100644
--- a/core/src/fxge/win32/fx_win32_gdipext.cpp
+++ b/core/src/fxge/win32/fx_win32_gdipext.cpp
@@ -1087,7 +1087,7 @@ static FX_BOOL IsSmallTriangle(PointF* points,
}
FX_FLOAT dx = x1 - x2;
FX_FLOAT dy = y1 - y2;
- FX_FLOAT distance_square = FXSYS_Mul(dx, dx) + FXSYS_Mul(dy, dy);
+ FX_FLOAT distance_square = (dx * dx) + (dy * dy);
if (distance_square < (1.0f * 2 + 1.0f / 4)) {
v1 = i;
v2 = pair1;
diff --git a/third_party/agg23/agg_clip_liang_barsky.h b/third_party/agg23/agg_clip_liang_barsky.h
index cfc4c91f60..13e4ab9e30 100644
--- a/third_party/agg23/agg_clip_liang_barsky.h
+++ b/third_party/agg23/agg_clip_liang_barsky.h
@@ -85,21 +85,21 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2,
if(tin2 <= tout1) {
if(tin2 > 0) {
if(tinx > tiny) {
- *x++ = (T)xin;
- *y++ = (T)(y1 + FXSYS_Mul(deltay, tinx));
+ *x++ = (T)xin;
+ *y++ = (T)(y1 + (deltay * tinx));
} else {
- *x++ = (T)(x1 + FXSYS_Mul(deltax, tiny));
- *y++ = (T)yin;
+ *x++ = (T)(x1 + (deltax * tiny));
+ *y++ = (T)yin;
}
++np;
}
if(tout1 < 1.0f) {
if(toutx < touty) {
- *x++ = (T)xout;
- *y++ = (T)(y1 + FXSYS_Mul(deltay, toutx));
+ *x++ = (T)xout;
+ *y++ = (T)(y1 + (deltay * toutx));
} else {
- *x++ = (T)(x1 + FXSYS_Mul(deltax, touty));
- *y++ = (T)yout;
+ *x++ = (T)(x1 + (deltax * touty));
+ *y++ = (T)yout;
}
} else {
*x++ = x2;
diff --git a/third_party/agg23/agg_curves.cpp b/third_party/agg23/agg_curves.cpp
index e19221d33e..21b959dc97 100644
--- a/third_party/agg23/agg_curves.cpp
+++ b/third_party/agg23/agg_curves.cpp
@@ -61,8 +61,8 @@ void curve4_div::recursive_bezier(FX_FLOAT x1, FX_FLOAT y1,
FX_FLOAT y1234 = (y123 + y234) / 2;
FX_FLOAT dx = x4 - x1;
FX_FLOAT dy = y4 - y1;
- FX_FLOAT d2 = FXSYS_fabs(FXSYS_Mul(x2 - x4, dy) - FXSYS_Mul(y2 - y4, dx));
- FX_FLOAT d3 = FXSYS_fabs(FXSYS_Mul(x3 - x4, dy) - FXSYS_Mul(y3 - y4, dx));
+ FX_FLOAT d2 = FXSYS_fabs(((x2 - x4) * dy) - ((y2 - y4) * dx));
+ FX_FLOAT d3 = FXSYS_fabs(((x3 - x4) * dy) - ((y3 - y4) * dx));
switch((int(d2 > curve_collinearity_epsilon) << 1) +
int(d3 > curve_collinearity_epsilon)) {
case 0:
@@ -75,22 +75,22 @@ void curve4_div::recursive_bezier(FX_FLOAT x1, FX_FLOAT y1,
}
break;
case 1:
- if(FXSYS_Mul(d3, d3) <= FXSYS_Mul(m_distance_tolerance_square,
- FXSYS_Mul(dx, dx) + FXSYS_Mul(dy, dy))) {
+ if ((d3 * d3) <=
+ (m_distance_tolerance_square * ((dx * dx) + (dy * dy)))) {
m_points.add(point_type(x23, y23, path_flags_jr));
return;
}
break;
case 2:
- if(FXSYS_Mul(d2, d2) <= FXSYS_Mul(m_distance_tolerance_square,
- FXSYS_Mul(dx, dx) + FXSYS_Mul(dy, dy))) {
+ if ((d2 * d2) <=
+ (m_distance_tolerance_square * ((dx * dx) + (dy * dy)))) {
m_points.add(point_type(x23, y23, path_flags_jr));
return;
}
break;
case 3:
- if(FXSYS_Mul(d2 + d3, d2 + d3) <= FXSYS_Mul(m_distance_tolerance_square,
- FXSYS_Mul(dx, dx) + FXSYS_Mul(dy, dy))) {
+ if (((d2 + d3) * (d2 + d3)) <=
+ (m_distance_tolerance_square * ((dx * dx) + (dy * dy)))) {
m_points.add(point_type(x23, y23, path_flags_jr));
return;
}
diff --git a/third_party/agg23/agg_math.h b/third_party/agg23/agg_math.h
index 31e0daf3bb..c0d9570aa9 100644
--- a/third_party/agg23/agg_math.h
+++ b/third_party/agg23/agg_math.h
@@ -26,7 +26,7 @@ AGG_INLINE FX_FLOAT calc_point_location(FX_FLOAT x1, FX_FLOAT y1,
FX_FLOAT x2, FX_FLOAT y2,
FX_FLOAT x, FX_FLOAT y)
{
- return FXSYS_Mul(x - x2, y2 - y1) - FXSYS_Mul(y - y2, x2 - x1);
+ return ((x - x2) * (y2 - y1)) - ((y - y2) * (x2 - x1));
}
AGG_INLINE FX_FLOAT calc_distance(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2)
{
@@ -50,8 +50,8 @@ AGG_INLINE bool calc_intersection(FX_FLOAT ax, FX_FLOAT ay, FX_FLOAT bx, FX_FLOA
FX_FLOAT cx, FX_FLOAT cy, FX_FLOAT dx, FX_FLOAT dy,
FX_FLOAT* x, FX_FLOAT* y)
{
- FX_FLOAT num = FXSYS_Mul(ay - cy, dx - cx) - FXSYS_Mul(ax - cx, dy - cy);
- FX_FLOAT den = FXSYS_Mul(bx - ax, dy - cy) - FXSYS_Mul(by - ay, dx - cx);
+ FX_FLOAT num = ((ay - cy) * (dx - cx)) - ((ax - cx) * (dy - cy));
+ FX_FLOAT den = ((bx - ax) * (dy - cy)) - ((by - ay) * (dx - cx));
if (FXSYS_fabs(den) < intersection_epsilon) {
return false;
}
diff --git a/third_party/agg23/agg_math_stroke.h b/third_party/agg23/agg_math_stroke.h
index 620d675312..ff42b2291e 100644
--- a/third_party/agg23/agg_math_stroke.h
+++ b/third_party/agg23/agg_math_stroke.h
@@ -67,8 +67,8 @@ void stroke_calc_arc(VertexConsumer& out_vertices,
a2 -= da / 4;
a1 += da;
while(a1 < a2) {
- out_vertices.add(coord_type(x + FXSYS_Mul(width, FXSYS_cos(a1)),
- y + FXSYS_Mul(width, FXSYS_sin(a1))));
+ out_vertices.add(coord_type(x + (width * FXSYS_cos(a1)),
+ y + (width * FXSYS_sin(a1))));
a1 += da;
}
} else {
@@ -78,8 +78,8 @@ void stroke_calc_arc(VertexConsumer& out_vertices,
a2 += da / 4;
a1 -= da;
while(a1 > a2) {
- out_vertices.add(coord_type(x + FXSYS_Mul(width, FXSYS_cos(a1)),
- y + FXSYS_Mul(width, FXSYS_sin(a1))));
+ out_vertices.add(coord_type(x + (width * FXSYS_cos(a1)),
+ y + (width * FXSYS_sin(a1))));
a1 -= da;
}
}
@@ -107,7 +107,7 @@ void stroke_calc_miter(VertexConsumer& out_vertices,
v2.x + dx2, v2.y - dy2,
&xi, &yi)) {
FX_FLOAT d1 = calc_distance(v1.x, v1.y, xi, yi);
- FX_FLOAT lim = FXSYS_Mul(width, miter_limit);
+ FX_FLOAT lim = width * miter_limit;
if(d1 <= lim) {
out_vertices.add(coord_type(xi, yi));
miter_limit_exceeded = false;
@@ -115,8 +115,8 @@ void stroke_calc_miter(VertexConsumer& out_vertices,
} else {
FX_FLOAT x2 = v1.x + dx1;
FX_FLOAT y2 = v1.y - dy1;
- if((FXSYS_Mul(x2 - v0.x, dy1) - FXSYS_Mul(v0.y - y2, dx1) < 0) !=
- (FXSYS_Mul(x2 - v2.x, dy1) - FXSYS_Mul(v2.y - y2, dx1) < 0)) {
+ if ((((x2 - v0.x) * dy1) - ((v0.y - y2) * dx1) < 0) !=
+ (((x2 - v2.x) * dy1) - ((v2.y - y2) * dx1) < 0)) {
out_vertices.add(coord_type(v1.x + dx1, v1.y - dy1));
miter_limit_exceeded = false;
}
@@ -133,10 +133,10 @@ void stroke_calc_miter(VertexConsumer& out_vertices,
width, approximation_scale);
break;
default:
- out_vertices.add(coord_type(v1.x + dx1 + FXSYS_Mul(dy1, miter_limit),
- v1.y - dy1 + FXSYS_Mul(dx1, miter_limit)));
- out_vertices.add(coord_type(v1.x + dx2 - FXSYS_Mul(dy2, miter_limit),
- v1.y - dy2 - FXSYS_Mul(dx2, miter_limit)));
+ out_vertices.add(coord_type(v1.x + dx1 + (dy1 * miter_limit),
+ v1.y - dy1 + (dx1 * miter_limit)));
+ out_vertices.add(coord_type(v1.x + dx2 - (dy2 * miter_limit),
+ v1.y - dy2 - (dx2 * miter_limit)));
break;
}
}
@@ -156,8 +156,8 @@ void stroke_calc_cap(VertexConsumer& out_vertices,
FX_FLOAT dy1 = FXSYS_Div(v1.x - v0.x, len);
FX_FLOAT dx2 = 0;
FX_FLOAT dy2 = 0;
- dx1 = FXSYS_Mul(dx1, width);
- dy1 = FXSYS_Mul(dy1, width);
+ dx1 = dx1 * width;
+ dy1 = dy1 * width;
if(line_cap != round_cap) {
if(line_cap == square_cap) {
dx2 = dy1;
@@ -174,8 +174,8 @@ void stroke_calc_cap(VertexConsumer& out_vertices,
a1 += da;
a2 -= da / 4;
while(a1 < a2) {
- out_vertices.add(coord_type(v0.x + FXSYS_Mul(width, FXSYS_cos(a1)),
- v0.y + FXSYS_Mul(width, FXSYS_sin(a1))));
+ 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/xfa/src/fxgraphics/src/fx_graphics.cpp b/xfa/src/fxgraphics/src/fx_graphics.cpp
index 03873398de..2ad7cd5d0c 100644
--- a/xfa/src/fxgraphics/src/fx_graphics.cpp
+++ b/xfa/src/fxgraphics/src/fx_graphics.cpp
@@ -971,16 +971,15 @@ FX_ERR CFX_Graphics::FillPathWithShading(CFX_Path* path,
case FX_SHADING_Axial: {
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);
for (int32_t row = 0; row < height; row++) {
FX_DWORD* dib_buf = (FX_DWORD*)(bmp.GetBuffer() + row * pitch);
for (int32_t column = 0; column < width; column++) {
FX_FLOAT x = (FX_FLOAT)(column);
FX_FLOAT y = (FX_FLOAT)(row);
- FX_FLOAT scale = FXSYS_Div(
- FXSYS_Mul(x - start_x, x_span) + FXSYS_Mul(y - start_y, y_span),
- axis_len_square);
+ FX_FLOAT scale =
+ FXSYS_Div(((x - start_x) * x_span) + ((y - start_y) * y_span),
+ axis_len_square);
if (scale < 0) {
if (!_info._fillColor->_shading->_isExtendedBegin) {
continue;
@@ -1002,25 +1001,24 @@ FX_ERR CFX_Graphics::FillPathWithShading(CFX_Path* path,
case FX_SHADING_Radial: {
FX_FLOAT start_r = _info._fillColor->_shading->_beginRadius;
FX_FLOAT end_r = _info._fillColor->_shading->_endRadius;
- 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));
for (int32_t row = 0; row < height; row++) {
FX_DWORD* dib_buf = (FX_DWORD*)(bmp.GetBuffer() + row * pitch);
for (int32_t column = 0; column < width; column++) {
FX_FLOAT x = (FX_FLOAT)(column);
FX_FLOAT y = (FX_FLOAT)(row);
- 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;
}
diff --git a/xfa/src/fxgraphics/src/fx_path_generator.cpp b/xfa/src/fxgraphics/src/fx_path_generator.cpp
index 8d5030ac5b..c9e20b35d2 100644
--- a/xfa/src/fxgraphics/src/fx_path_generator.cpp
+++ b/xfa/src/fxgraphics/src/fx_path_generator.cpp
@@ -120,7 +120,7 @@ void CFX_PathGenerator::ArcTo(FX_FLOAT x,
FX_FLOAT x0 = FXSYS_cos(sweep_angle / 2);
FX_FLOAT y0 = FXSYS_sin(sweep_angle / 2);
FX_FLOAT tx = FXSYS_Div((1.0f - x0) * 4, 3 * 1.0f);
- FX_FLOAT ty = y0 - FXSYS_Div(FXSYS_Mul(tx, x0), y0);
+ FX_FLOAT ty = y0 - FXSYS_Div(tx * x0, y0);
FX_FLOAT px[3], py[3];
px[0] = x0 + tx;
py[0] = -ty;
@@ -131,14 +131,14 @@ void CFX_PathGenerator::ArcTo(FX_FLOAT x,
int old_count = m_pPathData->GetPointCount();
m_pPathData->AddPointCount(3);
FX_FLOAT bezier_x, bezier_y;
- bezier_x = x + FXSYS_Mul(width, FXSYS_Mul(px[0], cs) - FXSYS_Mul(py[0], sn));
- bezier_y = y + FXSYS_Mul(height, FXSYS_Mul(px[0], sn) + FXSYS_Mul(py[0], cs));
+ bezier_x = x + (width * ((px[0] * cs) - (py[0] * sn)));
+ bezier_y = y + (height * ((px[0] * sn) + (py[0] * cs)));
m_pPathData->SetPoint(old_count, bezier_x, bezier_y, FXPT_BEZIERTO);
- bezier_x = x + FXSYS_Mul(width, FXSYS_Mul(px[1], cs) - FXSYS_Mul(py[1], sn));
- bezier_y = y + FXSYS_Mul(height, FXSYS_Mul(px[1], sn) + FXSYS_Mul(py[1], cs));
+ bezier_x = x + (width * ((px[1] * cs) - (py[1] * sn)));
+ bezier_y = y + (height * ((px[1] * sn) + (py[1] * cs)));
m_pPathData->SetPoint(old_count + 1, bezier_x, bezier_y, FXPT_BEZIERTO);
- bezier_x = x + FXSYS_Mul(width, FXSYS_cos(start_angle + sweep_angle)),
- bezier_y = y + FXSYS_Mul(height, FXSYS_sin(start_angle + sweep_angle));
+ bezier_x = x + (width * FXSYS_cos(start_angle + sweep_angle));
+ bezier_y = y + (height * FXSYS_sin(start_angle + sweep_angle));
m_pPathData->SetPoint(old_count + 2, bezier_x, bezier_y, FXPT_BEZIERTO);
}
void CFX_PathGenerator::AddArc(FX_FLOAT x,
@@ -189,9 +189,8 @@ void CFX_PathGenerator::AddArc(FX_FLOAT x,
}
m_pPathData->AddPointCount(1);
m_pPathData->SetPoint(m_pPathData->GetPointCount() - 1,
- x + FXSYS_Mul(width, FXSYS_cos(start_angle)),
- y + FXSYS_Mul(height, FXSYS_sin(start_angle)),
- FXPT_MOVETO);
+ x + (width * FXSYS_cos(start_angle)),
+ y + (height * FXSYS_sin(start_angle)), FXPT_MOVETO);
FX_FLOAT total_sweep = 0, local_sweep = 0, prev_sweep = 0;
FX_BOOL done = FALSE;
do {
@@ -227,9 +226,8 @@ void CFX_PathGenerator::AddPie(FX_FLOAT x,
int old_count = m_pPathData->GetPointCount();
m_pPathData->AddPointCount(2);
m_pPathData->SetPoint(old_count, x, y, FXPT_MOVETO);
- m_pPathData->SetPoint(
- old_count + 1, x + FXSYS_Mul(width, FXSYS_cos(start_angle)),
- y + FXSYS_Mul(height, FXSYS_sin(start_angle)), FXPT_LINETO);
+ m_pPathData->SetPoint(old_count + 1, x + (width * FXSYS_cos(start_angle)),
+ y + (height * FXSYS_sin(start_angle)), FXPT_LINETO);
return;
}
AddArc(x, y, width, height, start_angle, sweep_angle);
diff --git a/xfa/src/fxgraphics/src/pre.h b/xfa/src/fxgraphics/src/pre.h
index 7341aa7e5c..1a1820551a 100644
--- a/xfa/src/fxgraphics/src/pre.h
+++ b/xfa/src/fxgraphics/src/pre.h
@@ -8,12 +8,7 @@
#define XFA_SRC_FXGRAPHICS_SRC_PRE_H_
#include "xfa/src/foxitlib.h"
-#ifndef FXSYS_Mul
-#define FXSYS_Mul(a, b) ((a) * (b))
-#define FXSYS_Div(a, b) ((a) / (b))
-#define FXSYS_MulDiv(a, b, c) ((a) * (b) / (c))
-#define FXSYS_sqrt2(a, b) (FX_FLOAT) FXSYS_sqrt((a) * (a) + (b) * (b))
-#endif
+
enum {
FX_CONTEXT_None = 0,
FX_CONTEXT_Device,