Cleaner clone() implementation

This commit is contained in:
Alessandro Ranellucci 2013-07-14 13:11:01 +02:00
parent 399bc80899
commit 0099218f61
3 changed files with 4 additions and 6 deletions

View File

@ -15,8 +15,6 @@ package Slic3r::ExPolygon::XS;
use overload
'@{}' => sub { $_[0]->arrayref };
sub clone { (ref $_[0])->_clone($_[0]) }
# to handle legacy code
sub rotate {
my $self = shift;
@ -30,8 +28,6 @@ package Slic3r::ExPolygon::Collection;
use overload
'@{}' => sub { $_[0]->arrayref };
sub clone { (ref $_[0])->_clone($_[0]) }
package Slic3r::Surface;
sub new {

View File

@ -6,8 +6,9 @@
%}
%name{Slic3r::ExPolygon::XS} class ExPolygon {
%name{_clone} ExPolygon(ExPolygon& self);
~ExPolygon();
ExPolygon* clone()
%code{% const char* CLASS = "Slic3r::ExPolygon::XS"; RETVAL = new ExPolygon(*THIS); %};
SV* arrayref()
%code{% RETVAL = expolygon2perl(*THIS); %};
void scale(double factor);

View File

@ -6,8 +6,9 @@
%}
%name{Slic3r::ExPolygon::Collection} class ExPolygonCollection {
%name{_clone} ExPolygonCollection(ExPolygonCollection& self);
~ExPolygonCollection();
ExPolygonCollection* clone()
%code{% const char* CLASS = "Slic3r::ExPolygon::Collection"; RETVAL = new ExPolygonCollection(*THIS); %};
void scale(double factor);
void translate(double x, double y);
void rotate(double angle, Point* center);