Bug 777194. Part 0: Add gfxPoint::WithinEpsilonOf. r=jrmuizel
authorRobert O'Callahan <robert@ocallahan.org>
Fri, 17 Aug 2012 11:38:59 +1200
changeset 107357 1f8b8d69d23ac65e36f3bb5af07059f05096635e
parent 107347 176b61afc41d8fc6fc5780648332a22fa57659f0
child 107358 2365bb8a416a62ec1a362fe6b6cf16b595723907
push id23486
push usergraememcc_firefox@graeme-online.co.uk
push dateWed, 19 Sep 2012 14:18:40 +0000
treeherdermozilla-central@0c8ac138706e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs777194
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 777194. Part 0: Add gfxPoint::WithinEpsilonOf. r=jrmuizel
gfx/thebes/gfxPoint.h
--- a/gfx/thebes/gfxPoint.h
+++ b/gfx/thebes/gfxPoint.h
@@ -36,11 +36,15 @@ struct THEBES_API gfxPoint : public mozi
     // See https://bugzilla.mozilla.org/show_bug.cgi?id=410748#c14
     // And if you need similar method which is using NS_round(), you should
     // create new |RoundAwayFromZero()| method.
     gfxPoint& Round() {
         x = floor(x + 0.5);
         y = floor(y + 0.5);
         return *this;
     }
+
+    bool WithinEpsilonOf(const gfxPoint& aPoint, gfxFloat aEpsilon) {
+        return fabs(aPoint.x - x) < aEpsilon && fabs(aPoint.y - y) < aEpsilon;
+    }
 };
 
 #endif /* GFX_POINT_H */