Fixed several std::moves that had no effect, moved GCode data to heap
This commit is contained in:
parent
96a6c8538f
commit
e01d32d01a
7 changed files with 19 additions and 19 deletions
|
@ -169,10 +169,10 @@ inline Polylines to_polylines(ExPolygon &&src)
|
|||
Polyline &pl = polylines[idx ++];
|
||||
pl.points = std::move(src.contour.points);
|
||||
pl.points.push_back(pl.points.front());
|
||||
for (Polygons::const_iterator ith = src.holes.begin(); ith != src.holes.end(); ++ith) {
|
||||
for (auto ith = src.holes.begin(); ith != src.holes.end(); ++ith) {
|
||||
Polyline &pl = polylines[idx ++];
|
||||
pl.points = std::move(ith->points);
|
||||
pl.points.push_back(ith->points.front());
|
||||
pl.points.push_back(p1.points.front());
|
||||
}
|
||||
assert(idx == polylines.size());
|
||||
return polylines;
|
||||
|
@ -183,14 +183,14 @@ inline Polylines to_polylines(ExPolygons &&src)
|
|||
Polylines polylines;
|
||||
polylines.assign(number_polygons(src), Polyline());
|
||||
size_t idx = 0;
|
||||
for (ExPolygons::const_iterator it = src.begin(); it != src.end(); ++it) {
|
||||
for (auto it = src.begin(); it != src.end(); ++it) {
|
||||
Polyline &pl = polylines[idx ++];
|
||||
pl.points = std::move(it->contour.points);
|
||||
pl.points.push_back(pl.points.front());
|
||||
for (Polygons::const_iterator ith = it->holes.begin(); ith != it->holes.end(); ++ith) {
|
||||
for (auto ith = it->holes.begin(); ith != it->holes.end(); ++ith) {
|
||||
Polyline &pl = polylines[idx ++];
|
||||
pl.points = std::move(ith->points);
|
||||
pl.points.push_back(ith->points.front());
|
||||
pl.points.push_back(pl.points.front());
|
||||
}
|
||||
}
|
||||
assert(idx == polylines.size());
|
||||
|
|
|
@ -242,7 +242,7 @@ public:
|
|||
ExtrusionLoop(ExtrusionPaths &&paths, ExtrusionLoopRole role = elrDefault) : paths(std::move(paths)), m_loop_role(role) {}
|
||||
ExtrusionLoop(const ExtrusionPath &path, ExtrusionLoopRole role = elrDefault) : m_loop_role(role)
|
||||
{ this->paths.push_back(path); }
|
||||
ExtrusionLoop(const ExtrusionPath &&path, ExtrusionLoopRole role = elrDefault) : m_loop_role(role)
|
||||
ExtrusionLoop(ExtrusionPath &&path, ExtrusionLoopRole role = elrDefault) : m_loop_role(role)
|
||||
{ this->paths.emplace_back(std::move(path)); }
|
||||
bool is_loop() const override{ return true; }
|
||||
bool can_reverse() const override { return false; }
|
||||
|
|
|
@ -817,7 +817,7 @@ private:
|
|||
this->set_material_id(other.material_id());
|
||||
}
|
||||
// Providing a new mesh, therefore this volume will get a new unique ID assigned.
|
||||
ModelVolume(ModelObject *object, const ModelVolume &other, const TriangleMesh &&mesh) :
|
||||
ModelVolume(ModelObject *object, const ModelVolume &other, TriangleMesh &&mesh) :
|
||||
name(other.name), source(other.source), m_mesh(new TriangleMesh(std::move(mesh))), config(other.config), m_type(other.m_type), object(object), m_transformation(other.m_transformation)
|
||||
{
|
||||
assert(this->id().valid());
|
||||
|
|
|
@ -220,10 +220,10 @@ inline Polylines to_polylines(Polygons &&polys)
|
|||
Polylines polylines;
|
||||
polylines.assign(polys.size(), Polyline());
|
||||
size_t idx = 0;
|
||||
for (Polygons::const_iterator it = polys.begin(); it != polys.end(); ++ it) {
|
||||
for (auto it = polys.begin(); it != polys.end(); ++ it) {
|
||||
Polyline &pl = polylines[idx ++];
|
||||
pl.points = std::move(it->points);
|
||||
pl.points.push_back(it->points.front());
|
||||
pl.points.push_back(pl.points.front());
|
||||
}
|
||||
assert(idx == polylines.size());
|
||||
return polylines;
|
||||
|
@ -242,7 +242,7 @@ inline Polygons to_polygons(std::vector<Points> &&paths)
|
|||
{
|
||||
Polygons out;
|
||||
out.reserve(paths.size());
|
||||
for (const Points &path : paths)
|
||||
for (Points &path : paths)
|
||||
out.emplace_back(std::move(path));
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ inline Polylines to_polylines(std::vector<Points> &&paths)
|
|||
{
|
||||
Polylines out;
|
||||
out.reserve(paths.size());
|
||||
for (const Points &path : paths)
|
||||
for (Points &path : paths)
|
||||
out.emplace_back(std::move(path));
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -885,9 +885,9 @@ std::string Print::export_gcode(const std::string& path_template, GCodeProcessor
|
|||
message = L("Generating G-code");
|
||||
this->set_status(90, message);
|
||||
|
||||
// The following line may die for multiple reasons.
|
||||
GCode gcode;
|
||||
gcode.do_export(this, path.c_str(), result, thumbnail_cb);
|
||||
// Create GCode on heap, it has quite a lot of data.
|
||||
std::unique_ptr<GCode> gcode(new GCode);
|
||||
gcode->do_export(this, path.c_str(), result, thumbnail_cb);
|
||||
return path.c_str();
|
||||
}
|
||||
|
||||
|
|
|
@ -58,11 +58,11 @@ public:
|
|||
thickness(rhs.thickness), thickness_layers(rhs.thickness_layers),
|
||||
bridge_angle(rhs.bridge_angle), extra_perimeters(rhs.extra_perimeters)
|
||||
{};
|
||||
Surface(SurfaceType _surface_type, const ExPolygon &&_expolygon)
|
||||
Surface(SurfaceType _surface_type, ExPolygon &&_expolygon)
|
||||
: surface_type(_surface_type), expolygon(std::move(_expolygon)),
|
||||
thickness(-1), thickness_layers(1), bridge_angle(-1), extra_perimeters(0)
|
||||
{};
|
||||
Surface(const Surface &other, const ExPolygon &&_expolygon)
|
||||
Surface(const Surface &other, ExPolygon &&_expolygon)
|
||||
: surface_type(other.surface_type), expolygon(std::move(_expolygon)),
|
||||
thickness(other.thickness), thickness_layers(other.thickness_layers),
|
||||
bridge_angle(other.bridge_angle), extra_perimeters(other.extra_perimeters)
|
||||
|
@ -159,7 +159,7 @@ inline ExPolygons to_expolygons(Surfaces &&src)
|
|||
{
|
||||
ExPolygons expolygons;
|
||||
expolygons.reserve(src.size());
|
||||
for (Surfaces::const_iterator it = src.begin(); it != src.end(); ++it)
|
||||
for (auto it = src.begin(); it != src.end(); ++it)
|
||||
expolygons.emplace_back(ExPolygon(std::move(it->expolygon)));
|
||||
src.clear();
|
||||
return expolygons;
|
||||
|
@ -260,8 +260,8 @@ inline void surfaces_append(Surfaces &dst, ExPolygons &&src, SurfaceType surface
|
|||
inline void surfaces_append(Surfaces &dst, ExPolygons &&src, const Surface &surfaceTempl)
|
||||
{
|
||||
dst.reserve(dst.size() + number_polygons(src));
|
||||
for (ExPolygons::const_iterator it = src.begin(); it != src.end(); ++ it)
|
||||
dst.emplace_back(Surface(surfaceTempl, std::move(*it)));
|
||||
for (ExPolygon& explg : src)
|
||||
dst.emplace_back(Surface(surfaceTempl, std::move(explg)));
|
||||
src.clear();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue