From 35e70fb57f9e4093e759d0d35b6d9b8e7800a1a3 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Mon, 27 Mar 2017 16:20:02 -0400 Subject: M58: Compare to epsilon instead of 0 in CFX_Matrix::SetReverse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: dsinclair (cherry picked from commit fbd9ea1db2f1bb7fa006e7304a1202afc683c142) Change-Id: I9b50a3940599faa91780c7a9209c3c2fb0ea152a Reviewed-on: https://pdfium-review.googlesource.com/3235 Reviewed-by: Nicolás Peña --- core/fxcrt/fx_basic_coords.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/fxcrt/fx_basic_coords.cpp b/core/fxcrt/fx_basic_coords.cpp index cb5a010427..b73dc6d825 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 - #include +#include #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) { FX_FLOAT i = m.a * m.d - m.b * m.c; - if (FXSYS_fabs(i) == 0) + if (FXSYS_fabs(i) <= std::numeric_limits::epsilon()) return; FX_FLOAT j = -i; -- cgit v1.2.3