Merge branch 'master' into grow-narrow

This commit is contained in:
Alessandro Ranellucci 2013-03-13 16:39:57 +01:00
commit f528088d31
5 changed files with 26 additions and 14 deletions

View file

@ -26,6 +26,7 @@ my $build = Module::Build->new(
'IO::Scalar' => '0.10', 'IO::Scalar' => '0.10',
}, },
recommends => { recommends => {
'Class::XSAccessor' => '0',
'Growl::GNTP' => '0.15', 'Growl::GNTP' => '0.15',
'Net::DBus' => '0', 'Net::DBus' => '0',
'XML::SAX::ExpatXS' => '0', 'XML::SAX::ExpatXS' => '0',

View file

@ -991,7 +991,11 @@ END
}; };
# generate accessors # generate accessors
{ if (eval "use Class::XSAccessor; 1") {
Class::XSAccessor->import(
getters => { map { $_ => $_ } keys %$Options },
);
} else {
no strict 'refs'; no strict 'refs';
for my $opt_key (keys %$Options) { for my $opt_key (keys %$Options) {
*{$opt_key} = sub { $_[0]{$opt_key} }; *{$opt_key} = sub { $_[0]{$opt_key} };

View file

@ -229,15 +229,7 @@ sub point_is_on_left_of_segment {
sub polyline_lines { sub polyline_lines {
my ($polygon) = @_; my ($polygon) = @_;
return map Slic3r::Line->new($polygon->[$_], $polygon->[$_+1]), 0 .. $#$polygon-1;
my @lines = ();
my $last_point;
foreach my $point (@$polygon) {
push @lines, Slic3r::Line->new($last_point, $point) if $last_point;
$last_point = $point;
}
return @lines;
} }
sub polygon_lines { sub polygon_lines {

View file

@ -39,6 +39,21 @@ sub depth_layers { $_[0][S_DEPTH_LAYERS] } # this integer represents the thic
sub bridge_angle { $_[0][S_BRIDGE_ANGLE] = $_[1] if defined $_[1]; $_[0][S_BRIDGE_ANGLE] } sub bridge_angle { $_[0][S_BRIDGE_ANGLE] = $_[1] if defined $_[1]; $_[0][S_BRIDGE_ANGLE] }
sub extra_perimeters { $_[0][S_EXTRA_PERIMETERS] = $_[1] if defined $_[1]; $_[0][S_EXTRA_PERIMETERS] } sub extra_perimeters { $_[0][S_EXTRA_PERIMETERS] = $_[1] if defined $_[1]; $_[0][S_EXTRA_PERIMETERS] }
if (eval "use Class::XSAccessor::Array; 1") {
Class::XSAccessor::Array->import(
getters => {
expolygon => S_EXPOLYGON,
},
accessors => {
surface_type => S_SURFACE_TYPE,
depth_layers => S_DEPTH_LAYERS,
bridge_angle => S_BRIDGE_ANGLE,
extra_perimeters => S_EXTRA_PERIMETERS,
},
replace => 1,
);
}
# delegate handles # delegate handles
sub encloses_point { $_[0]->expolygon->encloses_point } sub encloses_point { $_[0]->expolygon->encloses_point }
sub lines { $_[0]->expolygon->lines } sub lines { $_[0]->expolygon->lines }

View file

@ -163,10 +163,10 @@ sub check_manifoldness {
sub unpack_line { sub unpack_line {
my ($packed) = @_; my ($packed) = @_;
my @data = unpack I_FMT, $packed; my $data = [ unpack I_FMT, $packed ];
splice @data, 0, 2, [ @data[0,1] ]; splice @$data, 0, 2, [ @$data[0,1] ];
$data[$_] = undef for grep $data[$_] == -1, I_A_ID, I_B_ID, I_FACET_EDGE, I_PREV_FACET_INDEX, I_NEXT_FACET_INDEX; $data->[$_] = undef for grep $data->[$_] == -1, I_A_ID, I_B_ID, I_FACET_EDGE, I_PREV_FACET_INDEX, I_NEXT_FACET_INDEX;
return [@data]; return $data;
} }
sub make_loops { sub make_loops {