Bug 1304886 - Part 4: Mark gfxQuaternion::Slerp and ToMatrix const. r?boris draft
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Wed, 16 Nov 2016 20:32:32 +0900
changeset 439609 b2a605588e13c3e165cf3617aae72ac236ce2bcb
parent 439608 c5cf349e36f1f14db4e0244e5519c66013e16050
child 439610 4c62d1637175ea29ca0093a1f08daf4f772ff349
push id36059
push userhiikezoe@mozilla-japan.org
push dateWed, 16 Nov 2016 11:32:59 +0000
reviewersboris
bugs1304886
milestone53.0a1
Bug 1304886 - Part 4: Mark gfxQuaternion::Slerp and ToMatrix const. r?boris We will use them for const gfxQuaternion in subsequent patches. MozReview-Commit-ID: 7CBjnklpxUQ
gfx/thebes/gfxQuaternion.h
--- a/gfx/thebes/gfxQuaternion.h
+++ b/gfx/thebes/gfxQuaternion.h
@@ -48,17 +48,17 @@ struct gfxQuaternion : public mozilla::g
         MOZ_ASSERT(mozilla::gfx::FuzzyEqual(aDirection.Length(), 1.0f),
                    "aDirection should be an unit vector");
         x = aDirection.x * sin(aAngle/2.0);
         y = aDirection.y * sin(aAngle/2.0);
         z = aDirection.z * sin(aAngle/2.0);
         w = cos(aAngle/2.0);
     }
 
-    gfxQuaternion Slerp(const gfxQuaternion &aOther, gfxFloat aCoeff) {
+    gfxQuaternion Slerp(const gfxQuaternion &aOther, gfxFloat aCoeff) const {
         gfxFloat dot = mozilla::clamped(DotProduct(aOther), -1.0, 1.0);
         if (dot == 1.0) {
             return *this;
         }
 
         gfxFloat theta = acos(dot);
         gfxFloat rsintheta = 1/sqrt(1 - dot*dot);
         gfxFloat rightWeight = sin(aCoeff*theta)*rsintheta;
@@ -67,17 +67,17 @@ struct gfxQuaternion : public mozilla::g
         gfxQuaternion right = aOther;
 
         left *= cos(aCoeff*theta) - dot*rightWeight;
         right *= rightWeight;
 
         return left + right;
     }
 
-    mozilla::gfx::Matrix4x4 ToMatrix() {
+    mozilla::gfx::Matrix4x4 ToMatrix() const {
       mozilla::gfx::Matrix4x4 temp;
 
         temp[0][0] = 1 - 2 * (y * y + z * z);
         temp[0][1] = 2 * (x * y + w * z);
         temp[0][2] = 2 * (x * z - w * y);
         temp[1][0] = 2 * (x * y - w * z);
         temp[1][1] = 1 - 2 * (x * x + z * z);
         temp[1][2] = 2 * (y * z + w * x);