summaryrefslogtreecommitdiff
path: root/xfa
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 /xfa
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 .
Diffstat (limited to 'xfa')
-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
3 files changed, 25 insertions, 34 deletions
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,