Reducing copies when writing png data.

This commit is contained in:
tamasmeszaros 2019-03-18 18:02:50 +01:00
parent 24145cc14f
commit 04e03c840d
6 changed files with 88 additions and 12 deletions

View file

@ -3,11 +3,18 @@
#include <ostream>
#include <memory>
#include <vector>
namespace Slic3r {
class ExPolygon;
// Raw byte buffer paired with its size. Suitable for compressed PNG data.
struct RawBytes {
std::unique_ptr<std::uint8_t> buffer = nullptr;
size_t size = 0;
};
/**
* @brief Raster captures an anti-aliased monochrome canvas where vectorial
* polygons can be rasterized. Fill color is always white and the background is
@ -87,6 +94,8 @@ public:
/// Save the raster on the specified stream.
void save(std::ostream& stream, Compression comp = Compression::RAW);
RawBytes save(Compression comp = Compression::RAW);
};
}