Bug 1377090 - Move NudgeToInteger(double) into Tools.h for reuse. r?Bas draft
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 05 Jul 2017 11:18:48 -0400
changeset 604206 83180176cfc71e687cad0f17f2938cab1610c16c
parent 604205 fd339bbccdba406a427f6c59b79da84455ab16ac
child 604207 9db62d86e90517fad5f243efc6987766123bab3a
push id67001
push userkgupta@mozilla.com
push dateWed, 05 Jul 2017 15:19:48 +0000
reviewersBas
bugs1377090
milestone56.0a1
Bug 1377090 - Move NudgeToInteger(double) into Tools.h for reuse. r?Bas MozReview-Commit-ID: HJ5rmUfKOaG
gfx/2d/Tools.h
gfx/thebes/gfxMatrix.cpp
--- a/gfx/2d/Tools.h
+++ b/gfx/2d/Tools.h
@@ -66,16 +66,24 @@ static inline void
 NudgeToInteger(float *aVal, float aErr)
 {
   float r = floorf(*aVal + 0.5f);
   if (FuzzyEqual(r, *aVal, aErr)) {
     *aVal = r;
   }
 }
 
+static inline void
+NudgeToInteger(double *aVal)
+{
+  float f = float(*aVal);
+  NudgeToInteger(&f);
+  *aVal = f;
+}
+
 static inline Float
 Distance(Point aA, Point aB)
 {
   return hypotf(aB.x - aA.x, aB.y - aA.y);
 }
 
 static inline int
 BytesPerPixel(SurfaceFormat aFormat)
--- a/gfx/thebes/gfxMatrix.cpp
+++ b/gfx/thebes/gfxMatrix.cpp
@@ -135,33 +135,25 @@ gfxMatrix::TransformBounds(const gfxRect
             min_y = quad_y[i];
         if (quad_y[i] > max_y)
             max_y = quad_y[i];
     }
 
     return gfxRect(min_x, min_y, max_x - min_x, max_y - min_y);
 }
 
-
-static void NudgeToInteger(double *aVal)
-{
-    float f = float(*aVal);
-    mozilla::gfx::NudgeToInteger(&f);
-    *aVal = f;
-}
-
 gfxMatrix&
 gfxMatrix::NudgeToIntegers(void)
 {
-    NudgeToInteger(&_11);
-    NudgeToInteger(&_21);
-    NudgeToInteger(&_12);
-    NudgeToInteger(&_22);
-    NudgeToInteger(&_31);
-    NudgeToInteger(&_32);
+    mozilla::gfx::NudgeToInteger(&_11);
+    mozilla::gfx::NudgeToInteger(&_21);
+    mozilla::gfx::NudgeToInteger(&_12);
+    mozilla::gfx::NudgeToInteger(&_22);
+    mozilla::gfx::NudgeToInteger(&_31);
+    mozilla::gfx::NudgeToInteger(&_32);
     return *this;
 }
 
 mozilla::gfx::Matrix4x4
 gfxMatrix::operator *(const mozilla::gfx::Matrix4x4& aMatrix) const
 {
   Matrix4x4 resultMatrix;