summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-03-16 12:14:18 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-16 17:25:51 +0000
commitfbd9ea1db2f1bb7fa006e7304a1202afc683c142 (patch)
tree8501b34ee302409d4ce3db34ea243ced33f2138b
parentcfdb5fdd12d47136ad1db9a67fc598a71f6757ff (diff)
downloadpdfium-fbd9ea1db2f1bb7fa006e7304a1202afc683c142.tar.xz
Compare to epsilon instead of 0 in CFX_Matrix::SetReverse
Since we are going to divide i by 0, it is better to compare it to epsilon and avoid wonkiness from division by something too close to 0. BUG=chromium:702041 Change-Id: I8136d6063f8debd41cef37eaab7e4097b3f32f4b Reviewed-on: https://pdfium-review.googlesource.com/3090 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r--core/fxcrt/fx_basic_coords.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_basic_coords.cpp
index 460f700f03..a1b403820e 100644
--- a/core/fxcrt/fx_basic_coords.cpp
+++ b/core/fxcrt/fx_basic_coords.cpp
@@ -4,9 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include <limits.h>
-
#include <algorithm>
+#include <limits>
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_ext.h"
@@ -231,7 +230,7 @@ CFX_FloatRect CFX_FloatRect::GetBBox(const CFX_PointF* pPoints, int nPoints) {
void CFX_Matrix::SetReverse(const CFX_Matrix& m) {
float i = m.a * m.d - m.b * m.c;
- if (FXSYS_fabs(i) == 0)
+ if (FXSYS_fabs(i) <= std::numeric_limits<float>::epsilon())
return;
float j = -i;