* Replace FTBBox::Move() with the += operator, to make it clearer that the object is modified in the process.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
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);