Return objects by reference instead of always cloning

This commit is contained in:
Alessandro Ranellucci 2013-09-02 20:22:20 +02:00
parent 1741301973
commit c0789506e4
30 changed files with 158 additions and 54 deletions

View file

@ -5,8 +5,21 @@
namespace Slic3r {
Point*
Polygon::last_point()
{
return &(this->points.front()); // last point == first point for polygons
}
SV*
Polygon::to_SV_ref() {
Polygon::to_SV_ref() const {
SV* sv = newSV(0);
sv_setref_pv( sv, "Slic3r::Polygon::Ref", (void*)this );
return sv;
}
SV*
Polygon::to_SV_clone_ref() const {
SV* sv = newSV(0);
sv_setref_pv( sv, "Slic3r::Polygon", new Polygon(*this) );
return sv;