ENABLE_THUMBNAIL_GENERATOR -> ENABLE_THUMBNAIL_GENERATOR_PNG_TO_GCODE set as default

This commit is contained in:
Enrico Turri 2019-11-25 10:30:31 +01:00
parent 2b17e81f13
commit b1047d2e26
3 changed files with 0 additions and 88 deletions
src/libslic3r

View file

@ -32,9 +32,7 @@
#include <Shiny/Shiny.h>
#if ENABLE_THUMBNAIL_GENERATOR_PNG_TO_GCODE
#include "miniz_extension.hpp"
#endif // ENABLE_THUMBNAIL_GENERATOR_PNG_TO_GCODE
#if 0
// Enable debugging and asserts, even in the release build.
@ -998,7 +996,6 @@ void GCode::_do_export(Print& print, FILE* file)
{
if (data.is_valid())
{
#if ENABLE_THUMBNAIL_GENERATOR_PNG_TO_GCODE
size_t png_size = 0;
void* png_data = tdefl_write_image_to_png_file_in_memory_ex((const void*)data.pixels.data(), data.width, data.height, 4, &png_size, MZ_DEFAULT_LEVEL, 1);
if (png_data != nullptr)
@ -1024,39 +1021,6 @@ void GCode::_do_export(Print& print, FILE* file)
mz_free(png_data);
}
#else
_write_format(file, "\n;\n; thumbnail begin %dx%d\n", data.width, data.height);
size_t row_size = 4 * data.width;
for (int r = (int)data.height - 1; r >= 0; --r)
{
std::string encoded;
encoded.resize(boost::beast::detail::base64::encoded_size(row_size));
encoded.resize(boost::beast::detail::base64::encode((void*)&encoded[0], (const void*)(data.pixels.data() + r * row_size), row_size));
unsigned int row_count = 0;
while (encoded.size() > max_row_length)
{
if (row_count == 0)
_write_format(file, "; %s\n", encoded.substr(0, max_row_length).c_str());
else
_write_format(file, ";>%s\n", encoded.substr(0, max_row_length).c_str());
encoded = encoded.substr(max_row_length);
++row_count;
}
if (encoded.size() > 0)
{
if (row_count == 0)
_write_format(file, "; %s\n", encoded.c_str());
else
_write_format(file, ";>%s\n", encoded.c_str());
}
}
_write(file, "; thumbnail end\n;\n");
#endif // ENABLE_THUMBNAIL_GENERATOR_PNG_TO_GCODE
}
print.throw_if_canceled();
}