Commit 48b68f5540a13a4b94e54c5a8cac969191f4b9f1

sammy 2008-05-07T15:06:19

* Replace FTBBox::Move() with the += operator, to make it clearer that the object is modified in the process.

diff --git a/src/FTFont/FTFont.cpp b/src/FTFont/FTFont.cpp
index 3a71b6f..b345dae 100644
--- a/src/FTFont/FTFont.cpp
+++ b/src/FTFont/FTFont.cpp
@@ -452,7 +452,7 @@ inline FTBBox FTFontImpl::BBoxI(const T* string, const int start, const int end)
             if(CheckGlyph(string[i]))
             {
                 FTBBox tempBBox = glyphList->BBox(string[i]);
-                tempBBox.Move(FTPoint(advance, 0.0f, 0.0f));
+                tempBBox += FTPoint(advance, 0.0f, 0.0f);
 
                 totalBBox |= tempBBox;
                 advance += glyphList->Advance(string[i], string[i + 1]);
diff --git a/src/FTGL/FTBBox.h b/src/FTGL/FTBBox.h
index faf2d5f..f7a5063 100644
--- a/src/FTGL/FTBBox.h
+++ b/src/FTGL/FTBBox.h
@@ -119,12 +119,13 @@ class FTGL_EXPORT FTBBox
         /**
          * Move the Bounding Box by a vector.
          *
-         * @param distance The distance to move the bbox in 3D space.
+         * @param distance The vector to move the bbox in 3D space.
          */
-        FTBBox& Move(FTPoint distance)
+        FTBBox& operator += (const FTPoint vector)
         {
-            lower += distance;
-            upper += distance;
+            lower += vector;
+            upper += vector;
+
             return *this;
         }
 
diff --git a/test/FTBBox-Test.cpp b/test/FTBBox-Test.cpp
index 7f4fc9b..455724e 100644
--- a/test/FTBBox-Test.cpp
+++ b/test/FTBBox-Test.cpp
@@ -90,7 +90,7 @@ class FTBBoxTest : public CppUnit::TestCase
             FTPoint firstMove(3.5f, 1.0f, -2.5f);
             FTPoint secondMove(-3.5f, -1.0f, 2.5f);
 
-            boundingBox.Move(firstMove);
+            boundingBox += firstMove;
 
             CPPUNIT_ASSERT(boundingBox.Lower().X() ==  3.5f);
             CPPUNIT_ASSERT(boundingBox.Lower().Y() ==  1.0f);
@@ -99,7 +99,7 @@ class FTBBoxTest : public CppUnit::TestCase
             CPPUNIT_ASSERT(boundingBox.Upper().Y() ==  1.0f);
             CPPUNIT_ASSERT(boundingBox.Upper().Z() == -2.5f);
 
-            boundingBox.Move(secondMove);
+            boundingBox += secondMove;
 
             CPPUNIT_ASSERT(boundingBox.Lower().X() == 0.0f);
             CPPUNIT_ASSERT(boundingBox.Lower().Y() == 0.0f);
@@ -116,7 +116,7 @@ class FTBBoxTest : public CppUnit::TestCase
             FTBBox boundingBox1;
             FTBBox boundingBox2(face->glyph);
 
-            boundingBox1 += boundingBox2;
+            boundingBox1 |= boundingBox2;
 
             CPPUNIT_ASSERT_DOUBLES_EQUAL(2, boundingBox2.Lower().X(), 0.01);
             CPPUNIT_ASSERT_DOUBLES_EQUAL(-15, boundingBox2.Lower().Y(), 0.01);
@@ -127,8 +127,8 @@ class FTBBoxTest : public CppUnit::TestCase
 
             float advance  = 40;
 
-            boundingBox2.Move(FTPoint(advance, 0, 0));
-            boundingBox1 += boundingBox2;
+            boundingBox2 += FTPoint(advance, 0, 0);
+            boundingBox1 |= boundingBox2;
 
             CPPUNIT_ASSERT_DOUBLES_EQUAL(42, boundingBox2.Lower().X(), 0.01);
             CPPUNIT_ASSERT_DOUBLES_EQUAL(-15, boundingBox2.Lower().Y(), 0.01);