Point: Convert to delegating ctors, constref args

This commit is contained in:
FeRD (Frank Dana)
2020-12-04 10:07:31 -05:00
parent de9fb417da
commit 18844b9700
2 changed files with 16 additions and 47 deletions

View File

@@ -33,58 +33,27 @@
using namespace std;
using namespace openshot;
// Default constructor (defaults to 1,0)
Point::Point() : interpolation(BEZIER), handle_type(AUTO)
{
// set new coorinate
co = Coordinate(1, 0);
// set handles
Initialize_Handles();
}
// Default constructor
Point::Point() : Point::Point(Coordinate(1, 0), BEZIER, AUTO) {};
// Constructor which creates a single coordinate at X=1
Point::Point(float y) :
interpolation(CONSTANT), handle_type(AUTO) {
// set new coorinate
co = Coordinate(1, y);
Point::Point(float y) : Point::Point(Coordinate(1, y), CONSTANT, AUTO) {};
// set handles
Initialize_Handles();
}
// Constructor which creates a Bezier curve with point at (x, y)
Point::Point(float x, float y) : Point::Point(Coordinate(x, y), BEZIER, AUTO) {};
Point::Point(float x, float y) :
interpolation(BEZIER), handle_type(AUTO) {
// set new coorinate
co = Coordinate(x, y);
// Constructor which also creates a Point, setting X,Y, and interpolation.
Point::Point(float x, float y, InterpolationType interpolation)
: Point::Point(Coordinate(x, y), interpolation, AUTO) {};
// set handles
Initialize_Handles();
}
// Constructor which also creates a Point and sets the X,Y, and interpolation of the Point.
Point::Point(float x, float y, InterpolationType interpolation) :
handle_type(AUTO), interpolation(interpolation) {
// set new coorinate
co = Coordinate(x, y);
// Direct Coordinate-accepting constructors
Point::Point(const Coordinate& co) : Point::Point(co, BEZIER, AUTO) {};
// set handles
Initialize_Handles();
}
Point::Point(const Coordinate& co, InterpolationType interpolation)
: Point::Point(co, interpolation, AUTO) {};
Point::Point(Coordinate co) :
co(co), interpolation(BEZIER), handle_type(AUTO) {
// set handles
Initialize_Handles();
}
Point::Point(Coordinate co, InterpolationType interpolation) :
co(co), interpolation(interpolation), handle_type(AUTO) {
// set handles
Initialize_Handles();
}
Point::Point(Coordinate co, InterpolationType interpolation, HandleType handle_type) :
Point::Point(const Coordinate& co, InterpolationType interpolation, HandleType handle_type) :
co(co), interpolation(interpolation), handle_type(handle_type) {
// set handles
Initialize_Handles();