Fix for QOI thumbnails not working (#2755)

Fix for QOI not working

Should remidy the issues in https://github.com/SoftFever/OrcaSlicer/issues/2741
This commit is contained in:
Exerqtor 2023-11-16 11:13:08 +01:00 committed by GitHub
parent bbdd580bb1
commit f61c504696
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,15 +57,17 @@ inline void export_thumbnails_to_file(ThumbnailsGeneratorCallback &thumbnail_cb,
std::string encoded;
encoded.resize(boost::beast::detail::base64::encoded_size(compressed->size));
encoded.resize(boost::beast::detail::base64::encode((void *) encoded.data(), (const void *) compressed->data,
compressed->size));
output((boost::format("; thumbnail begin %dx%d %d\n") % data.width % data.height % encoded.size()).str().c_str());
compressed->size));
output((boost::format("\n;\n; %s begin %dx%d %d\n") % compressed->tag() % data.width % data.height % encoded.size())
.str()
.c_str());
while (encoded.size() > max_row_length) {
output((boost::format("; %s\n") % encoded.substr(0, max_row_length)).str().c_str());
encoded = encoded.substr(max_row_length);
}
if (encoded.size() > 0)
output((boost::format("; %s\n") % encoded).str().c_str());
output((boost::format("; %s end\n;\n") % compressed->tag()).str().c_str());
output("; thumbnail end\n");
}
@ -81,4 +83,4 @@ inline void export_thumbnails_to_file(ThumbnailsGeneratorCallback &thumbnail_cb,
} // namespace Slic3r::GCodeThumbnails
#endif // slic3r_GCodeThumbnails_hpp_
#endif // slic3r_GCodeThumbnails_hpp_