2020-12-27 14:30:33 +01:00
|
|
|
|
|
|
|
#include "EdgeHolder.h"
|
|
|
|
|
|
|
|
namespace msdfgen {
|
|
|
|
|
|
|
|
void EdgeHolder::swap(EdgeHolder &a, EdgeHolder &b) {
|
|
|
|
EdgeSegment *tmp = a.edgeSegment;
|
|
|
|
a.edgeSegment = b.edgeSegment;
|
|
|
|
b.edgeSegment = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
EdgeHolder::EdgeHolder() : edgeSegment(NULL) { }
|
|
|
|
|
|
|
|
EdgeHolder::EdgeHolder(EdgeSegment *segment) : edgeSegment(segment) { }
|
|
|
|
|
|
|
|
EdgeHolder::EdgeHolder(Point2 p0, Point2 p1, EdgeColor edgeColor) : edgeSegment(new LinearSegment(p0, p1, edgeColor)) { }
|
|
|
|
|
|
|
|
EdgeHolder::EdgeHolder(Point2 p0, Point2 p1, Point2 p2, EdgeColor edgeColor) : edgeSegment(new QuadraticSegment(p0, p1, p2, edgeColor)) { }
|
|
|
|
|
|
|
|
EdgeHolder::EdgeHolder(Point2 p0, Point2 p1, Point2 p2, Point2 p3, EdgeColor edgeColor) : edgeSegment(new CubicSegment(p0, p1, p2, p3, edgeColor)) { }
|
|
|
|
|
|
|
|
EdgeHolder::EdgeHolder(const EdgeHolder &orig) : edgeSegment(orig.edgeSegment ? orig.edgeSegment->clone() : NULL) { }
|
|
|
|
|
|
|
|
#ifdef MSDFGEN_USE_CPP11
|
|
|
|
EdgeHolder::EdgeHolder(EdgeHolder &&orig) : edgeSegment(orig.edgeSegment) {
|
|
|
|
orig.edgeSegment = NULL;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
EdgeHolder::~EdgeHolder() {
|
|
|
|
delete edgeSegment;
|
|
|
|
}
|
|
|
|
|
2024-03-12 09:26:55 +01:00
|
|
|
EdgeHolder &EdgeHolder::operator=(const EdgeHolder &orig) {
|
2020-12-27 14:30:33 +01:00
|
|
|
if (this != &orig) {
|
|
|
|
delete edgeSegment;
|
|
|
|
edgeSegment = orig.edgeSegment ? orig.edgeSegment->clone() : NULL;
|
|
|
|
}
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MSDFGEN_USE_CPP11
|
2024-03-12 09:26:55 +01:00
|
|
|
EdgeHolder &EdgeHolder::operator=(EdgeHolder &&orig) {
|
2020-12-27 14:30:33 +01:00
|
|
|
if (this != &orig) {
|
|
|
|
delete edgeSegment;
|
|
|
|
edgeSegment = orig.edgeSegment;
|
|
|
|
orig.edgeSegment = NULL;
|
|
|
|
}
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2024-03-12 09:26:55 +01:00
|
|
|
EdgeSegment &EdgeHolder::operator*() {
|
2020-12-27 14:30:33 +01:00
|
|
|
return *edgeSegment;
|
|
|
|
}
|
|
|
|
|
2024-03-12 09:26:55 +01:00
|
|
|
const EdgeSegment &EdgeHolder::operator*() const {
|
2020-12-27 14:30:33 +01:00
|
|
|
return *edgeSegment;
|
|
|
|
}
|
|
|
|
|
2024-03-12 09:26:55 +01:00
|
|
|
EdgeSegment *EdgeHolder::operator->() {
|
2020-12-27 14:30:33 +01:00
|
|
|
return edgeSegment;
|
|
|
|
}
|
|
|
|
|
2024-03-12 09:26:55 +01:00
|
|
|
const EdgeSegment *EdgeHolder::operator->() const {
|
2020-12-27 14:30:33 +01:00
|
|
|
return edgeSegment;
|
|
|
|
}
|
|
|
|
|
|
|
|
EdgeHolder::operator EdgeSegment *() {
|
|
|
|
return edgeSegment;
|
|
|
|
}
|
|
|
|
|
|
|
|
EdgeHolder::operator const EdgeSegment *() const {
|
|
|
|
return edgeSegment;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|