summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-02-23 16:04:59 -0500
committerDan Sinclair <dsinclair@chromium.org>2016-02-23 16:04:59 -0500
commitaffe4b09575b297747e66bd0b807d2b1b04822fe (patch)
tree249ef3593f4e4187454d70da14f0f0624a932039 /core/src/fpdfapi
parentc145aeb2bf13ac408fc3e8233acca43d4251bbdc (diff)
downloadpdfium-affe4b09575b297747e66bd0b807d2b1b04822fe.tar.xz
Remove FXSYS_Div.
This is just a wrapper for (a) / (b). Inline the divide. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1727793002 .
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page.cpp9
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp32
2 files changed, 21 insertions, 20 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index 81cf92ee05..d589d5809f 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -752,11 +752,10 @@ void CPDF_Page::GetDisplayMatrix(CFX_Matrix& matrix,
y2 = yPos;
break;
}
- display_matrix.Set(FXSYS_Div((FX_FLOAT)(x2 - x0), m_PageWidth),
- FXSYS_Div((FX_FLOAT)(y2 - y0), m_PageWidth),
- FXSYS_Div((FX_FLOAT)(x1 - x0), m_PageHeight),
- FXSYS_Div((FX_FLOAT)(y1 - y0), m_PageHeight), (FX_FLOAT)x0,
- (FX_FLOAT)y0);
+ display_matrix.Set(
+ ((FX_FLOAT)(x2 - x0)) / m_PageWidth, ((FX_FLOAT)(y2 - y0)) / m_PageWidth,
+ ((FX_FLOAT)(x1 - x0)) / m_PageHeight,
+ ((FX_FLOAT)(y1 - y0)) / m_PageHeight, (FX_FLOAT)x0, (FX_FLOAT)y0);
matrix = m_PageMatrix;
matrix.Concat(display_matrix);
}
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index b9ff9f4750..43ce995f05 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -83,8 +83,8 @@ static void DrawAxialShading(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 scale = FXSYS_Div(
- ((x - start_x) * x_span) + ((y - start_y) * y_span), axis_len_square);
+ FX_FLOAT scale = (((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) {
@@ -189,7 +189,7 @@ static void DrawRadialShading(CFX_DIBitmap* pBitmap,
((y - start_y) * (y - start_y)) - (start_r * start_r);
FX_FLOAT s;
if (a == 0) {
- s = FXSYS_Div(-c, b);
+ s = -c / b;
} else {
FX_FLOAT b2_4ac = (b * b) - 4 * (a * c);
if (b2_4ac < 0) {
@@ -198,11 +198,11 @@ static void DrawRadialShading(CFX_DIBitmap* pBitmap,
FX_FLOAT root = FXSYS_sqrt(b2_4ac);
FX_FLOAT s1, s2;
if (a > 0) {
- s1 = FXSYS_Div(-b - root, 2 * a);
- s2 = FXSYS_Div(-b + root, 2 * a);
+ s1 = (-b - root) / (2 * a);
+ s2 = (-b + root) / (2 * a);
} else {
- s2 = FXSYS_Div(-b - root, 2 * a);
- s1 = FXSYS_Div(-b + root, 2 * a);
+ s2 = (-b - root) / (2 * a);
+ s1 = (-b + root) / (2 * a);
}
if (bDecreasing) {
if (s1 >= 0 || bStartExtend) {
@@ -1044,14 +1044,16 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
mtDevice2Pattern.SetReverse(mtPattern2Device);
CFX_FloatRect clip_box_p(clip_box);
clip_box_p.Transform(&mtDevice2Pattern);
- min_col = (int)FXSYS_ceil(
- FXSYS_Div(clip_box_p.left - pPattern->m_BBox.right, pPattern->m_XStep));
- max_col = (int)FXSYS_floor(
- FXSYS_Div(clip_box_p.right - pPattern->m_BBox.left, pPattern->m_XStep));
- min_row = (int)FXSYS_ceil(
- FXSYS_Div(clip_box_p.bottom - pPattern->m_BBox.top, pPattern->m_YStep));
- max_row = (int)FXSYS_floor(
- FXSYS_Div(clip_box_p.top - pPattern->m_BBox.bottom, pPattern->m_YStep));
+
+ min_col = (int)FXSYS_ceil((clip_box_p.left - pPattern->m_BBox.right) /
+ pPattern->m_XStep);
+ max_col = (int)FXSYS_floor((clip_box_p.right - pPattern->m_BBox.left) /
+ pPattern->m_XStep);
+ min_row = (int)FXSYS_ceil((clip_box_p.bottom - pPattern->m_BBox.top) /
+ pPattern->m_YStep);
+ max_row = (int)FXSYS_floor((clip_box_p.top - pPattern->m_BBox.bottom) /
+ pPattern->m_YStep);
+
if (width > clip_box.Width() || height > clip_box.Height() ||
width * height > clip_box.Width() * clip_box.Height()) {
CPDF_GraphicStates* pStates = NULL;