Fixing build on Win and OSX

This commit is contained in:
tamasmeszaros 2019-05-20 11:19:43 +02:00
parent 38d54d779a
commit 4e2ef09a50
5 changed files with 65 additions and 25 deletions

View File

@ -1,6 +1,8 @@
#ifndef SLARASTER_CPP
#define SLARASTER_CPP
#include <functional>
#include "SLARaster.hpp"
#include "libslic3r/ExPolygon.hpp"
#include <libnest2d/backends/clipper/clipper_polygon.hpp>
@ -179,10 +181,17 @@ private:
const Raster::Impl::TPixel Raster::Impl::ColorWhite = Raster::Impl::TPixel(255);
const Raster::Impl::TPixel Raster::Impl::ColorBlack = Raster::Impl::TPixel(0);
Raster::Raster() = default;
template<> Raster::Raster() { reset(); };
Raster::~Raster() = default;
Raster::Raster(Raster &&m) = default;
Raster& Raster::operator=(Raster&&) = default;
// Raster::Raster(Raster &&m) = default;
// Raster& Raster::operator=(Raster&&) = default;
// FIXME: remove after migrating to higher version of windows compiler
Raster::Raster(Raster &&m): m_impl(std::move(m.m_impl)) {}
Raster& Raster::operator=(Raster &&m) {
m_impl = std::move(m.m_impl); return *this;
}
void Raster::reset(const Raster::Resolution &r, const Raster::PixelDim &pd,
Format fmt, double gamma)

View File

@ -4,6 +4,8 @@
#include <ostream>
#include <memory>
#include <vector>
#include <array>
#include <utility>
#include <cstdint>
namespace ClipperLib { struct Polygon; }
@ -27,22 +29,20 @@ public:
const uint8_t * data() { return m_buffer.data(); }
RawBytes(const RawBytes&) = delete;
RawBytes(RawBytes&&) = default;
RawBytes& operator=(const RawBytes&) = delete;
RawBytes& operator=(RawBytes&&) = default;
// /////////////////////////////////////////////////////////////////////////
// FIXME: the following is needed for MSVC2013 compatibility
// /////////////////////////////////////////////////////////////////////////
// RawBytes(const RawBytes&) = delete;
// RawBytes(RawBytes&& mv) : m_buffer(std::move(mv.m_buffer)) {}
// RawBytes(RawBytes&&) = default;
// RawBytes& operator=(RawBytes&&) = default;
// RawBytes& operator=(const RawBytes&) = delete;
// RawBytes& operator=(RawBytes&& mv) {
// m_buffer = std::move(mv.m_buffer);
// return *this;
// }
RawBytes(RawBytes&& mv) : m_buffer(std::move(mv.m_buffer)) {}
RawBytes& operator=(RawBytes&& mv) {
m_buffer = std::move(mv.m_buffer);
return *this;
}
// /////////////////////////////////////////////////////////////////////////
};
@ -92,7 +92,6 @@ public:
reset(std::forward<Args>(args)...);
}
Raster();
Raster(const Raster& cpy) = delete;
Raster& operator=(const Raster& cpy) = delete;
Raster(Raster&& m);
@ -141,6 +140,10 @@ public:
RawBytes save();
};
// This prevents the duplicate default constructor warning on MSVC2013
template<> Raster::Raster();
} // sla
} // Slic3r

View File

@ -44,11 +44,11 @@ void SLARasterWriter::flpXY(ClipperLib::Polygon &poly)
void SLARasterWriter::flpXY(ExPolygon &poly)
{
for(auto& p : poly.contour.points) p = {p.y(), p.x()};
for(auto& p : poly.contour.points) p = Point(p.y(), p.x());
std::reverse(poly.contour.points.begin(), poly.contour.points.end());
for(auto& h : poly.holes) {
for(auto& p : h.points) p = {p.y(), p.x()};
for(auto& p : h.points) p = Point(p.y(), p.x());
std::reverse(h.points.begin(), h.points.end());
}
}

View File

@ -5,6 +5,7 @@
#include <fstream>
#include <sstream>
#include <vector>
#include <array>
#include "libslic3r/PrintConfig.hpp"
@ -49,8 +50,18 @@ private:
Layer(const Layer&) = delete; // The image is big, do not copy by accident
Layer& operator=(const Layer&) = delete;
Layer(Layer&& m) = default;
Layer& operator=(Layer&&) = default;
// /////////////////////////////////////////////////////////////////////
// FIXME: the following is needed for MSVC2013 compatibility
// /////////////////////////////////////////////////////////////////////
// Layer(Layer&& m) = default;
// Layer& operator=(Layer&&) = default;
Layer(Layer &&m):
raster(std::move(m.raster)), rawbytes(std::move(m.rawbytes)) {}
Layer& operator=(Layer &&m) {
raster = std::move(m.raster); rawbytes = std::move(m.rawbytes);
return *this;
}
};
// We will save the compressed PNG data into RawBytes type buffers in
@ -83,13 +94,30 @@ public:
SLARasterWriter(const SLARasterWriter& ) = delete;
SLARasterWriter& operator=(const SLARasterWriter&) = delete;
SLARasterWriter(SLARasterWriter&& m) = default;
SLARasterWriter& operator=(SLARasterWriter&&) = default;
// SLARasterWriter(SLARasterWriter&& m) = default;
// SLARasterWriter(SLARasterWriter&& m):
// m_layers_rst(std::move(m.m_layers_rst)),
// m_res(m.m_res),
// m_pxdim(m.m_pxdim) {}
// /////////////////////////////////////////////////////////////////////////
// FIXME: the following is needed for MSVC2013 compatibility
// /////////////////////////////////////////////////////////////////////////
// SLARasterWriter(SLARasterWriter&& m) = default;
// SLARasterWriter& operator=(SLARasterWriter&&) = default;
SLARasterWriter(SLARasterWriter&& m):
m_layers_rst(std::move(m.m_layers_rst)),
m_res(m.m_res),
m_pxdim(m.m_pxdim),
m_exp_time_s(m.m_exp_time_s),
m_exp_time_first_s(m.m_exp_time_first_s),
m_layer_height(m.m_layer_height),
m_o(m.m_o),
m_mirror(std::move(m.m_mirror)),
m_gamma(m.m_gamma),
m_used_material(m.m_used_material),
m_cnt_fade_layers(m.m_cnt_fade_layers),
m_cnt_slow_layers(m.m_cnt_slow_layers),
m_cnt_fast_layers(m.m_cnt_fast_layers)
{}
// /////////////////////////////////////////////////////////////////////////
inline void layers(unsigned cnt) { if(cnt > 0) m_layers_rst.resize(cnt); }
inline unsigned layers() const { return unsigned(m_layers_rst.size()); }

View File

@ -742,7 +742,7 @@ void SLAPrint::process()
// We apply the printer correction offset here.
if(clpr_offs != 0)
po.m_model_slices[id] =
offset_ex(po.m_model_slices[id], clpr_offs);
offset_ex(po.m_model_slices[id], float(clpr_offs));
mit->set_model_slice_idx(po, id); ++mit;
}