Memory optimization and code cleanup. Don't keep deserialized paths

This commit is contained in:
Alessandro Ranellucci 2012-07-20 14:39:07 +02:00
parent 52fb02f29d
commit 1697cb24a6
11 changed files with 99 additions and 71 deletions

View file

@ -53,7 +53,6 @@ sub fill_surface {
);
foreach my $loop (map Slic3r::ExtrusionLoop->new(polygon => $_, role => EXTR_ROLE_FILL), @loops) {
# extrude all loops ccw
$loop->deserialize;
$loop->polygon->make_counter_clockwise;
# find the point of the loop that is closest to the current extruder position
@ -62,7 +61,6 @@ sub fill_surface {
# split the loop at the starting point and make a path
my $path = $loop->split_at_index($index);
$path->deserialize;
# clip the path to avoid the extruder to get exactly on the first point of the loop
$path->clip_end(scale($self->layer ? $self->layer->flow->width : $Slic3r::flow->width) * 0.15);

View file

@ -88,7 +88,7 @@ sub fill_surface {
[ map @$_, $expolygon->offset_ex($overlap_distance) ],
)};
my $collection = Slic3r::ExtrusionPath::Collection->new(
paths => [ map Slic3r::ExtrusionPath->new(polyline => $_, role => -1), @paths ],
paths => [ map Slic3r::ExtrusionPath->pack(polyline => $_, role => -1), @paths ],
);
return {}, map $_->polyline, $collection->shortest_path;