diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2016-02-23 16:04:59 -0500 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2016-02-23 16:04:59 -0500 |
commit | affe4b09575b297747e66bd0b807d2b1b04822fe (patch) | |
tree | 249ef3593f4e4187454d70da14f0f0624a932039 /third_party | |
parent | c145aeb2bf13ac408fc3e8233acca43d4251bbdc (diff) | |
download | pdfium-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 'third_party')
-rw-r--r-- | third_party/agg23/agg_clip_liang_barsky.h | 14 | ||||
-rw-r--r-- | third_party/agg23/agg_math_stroke.h | 11 |
2 files changed, 13 insertions, 12 deletions
diff --git a/third_party/agg23/agg_clip_liang_barsky.h b/third_party/agg23/agg_clip_liang_barsky.h index 13e4ab9e30..db6ca97505 100644 --- a/third_party/agg23/agg_clip_liang_barsky.h +++ b/third_party/agg23/agg_clip_liang_barsky.h @@ -50,7 +50,7 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2, xin = (FX_FLOAT)clip_box.x2; xout = (FX_FLOAT)clip_box.x1; } - FX_FLOAT tinx = FXSYS_Div(xin - x1, deltax); + FX_FLOAT tinx = (xin - x1) / deltax; if(deltay == 0) { deltay = (y1 > clip_box.y1) ? -nearzero : nearzero; } @@ -62,7 +62,7 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2, yin = (FX_FLOAT)clip_box.y2; yout = (FX_FLOAT)clip_box.y1; } - FX_FLOAT tiny = FXSYS_Div(yin - y1, deltay); + FX_FLOAT tiny = (yin - y1) / deltay; FX_FLOAT tin1, tin2; if (tinx < tiny) { tin1 = tinx; @@ -78,10 +78,10 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2, ++np; } if(tin2 <= 1.0f) { - FX_FLOAT toutx = FXSYS_Div(xout - x1, deltax); - FX_FLOAT touty = FXSYS_Div(yout - y1, deltay); - FX_FLOAT tout1 = (toutx < touty) ? toutx : touty; - if(tin2 > 0 || tout1 > 0) { + FX_FLOAT toutx = (xout - x1) / deltax; + FX_FLOAT touty = (yout - y1) / deltay; + FX_FLOAT tout1 = (toutx < touty) ? toutx : touty; + if (tin2 > 0 || tout1 > 0) { if(tin2 <= tout1) { if(tin2 > 0) { if(tinx > tiny) { @@ -116,7 +116,7 @@ inline unsigned clip_liang_barsky(T x1, T y1, T x2, T y2, } ++np; } - } + } } } return np; diff --git a/third_party/agg23/agg_math_stroke.h b/third_party/agg23/agg_math_stroke.h index ff42b2291e..402028ba67 100644 --- a/third_party/agg23/agg_math_stroke.h +++ b/third_party/agg23/agg_math_stroke.h @@ -58,7 +58,7 @@ void stroke_calc_arc(VertexConsumer& out_vertices, if(width < 0) { width = -width; } - da = FXSYS_acos(FXSYS_Div(width, width + FXSYS_Div(1.0f / 8, approximation_scale))) * 2; + da = FXSYS_acos(width / (width + ((1.0f / 8) / approximation_scale))) * 2; out_vertices.add(coord_type(x + dx1, y + dy1)); if(!ccw) { if(a1 > a2) { @@ -152,8 +152,8 @@ void stroke_calc_cap(VertexConsumer& out_vertices, { typedef typename VertexConsumer::value_type coord_type; out_vertices.remove_all(); - FX_FLOAT dx1 = FXSYS_Div(v1.y - v0.y, len); - FX_FLOAT dy1 = FXSYS_Div(v1.x - v0.x, len); + FX_FLOAT dx1 = (v1.y - v0.y) / len; + FX_FLOAT dy1 = (v1.x - v0.x) / len; FX_FLOAT dx2 = 0; FX_FLOAT dy2 = 0; dx1 = dx1 * width; @@ -168,8 +168,9 @@ void stroke_calc_cap(VertexConsumer& out_vertices, } else { FX_FLOAT a1 = FXSYS_atan2(dy1, -dx1); FX_FLOAT a2 = a1 + FX_PI; - FX_FLOAT da = FXSYS_acos(FXSYS_Div(width, width + - FXSYS_Div(1.0f / 8, approximation_scale))) * 2; + FX_FLOAT da = + FXSYS_acos(width / (width + ((1.0f / 8) / approximation_scale))) * + 2; out_vertices.add(coord_type(v0.x - dx1, v0.y + dy1)); a1 += da; a2 -= da / 4; |