Fixed the bug of thumbnail mirroring

This commit is contained in:
QIDI TECH
2023-06-28 13:47:18 +08:00
parent 297fda6005
commit 5e03535305
2 changed files with 27 additions and 24 deletions

View File

@@ -38,7 +38,7 @@ std::unique_ptr<CompressedImageBuffer> compress_thumbnail_png(
MZ_DEFAULT_LEVEL, 1);
return out;
}
// B3
//B3
std::string compress_qidi_thumbnail_png(const ThumbnailData &data)
{
auto out = std::make_unique<CompressedPNG>();
@@ -59,7 +59,7 @@ std::string compress_qidi_thumbnail_png(const ThumbnailData &data)
std::vector<uint8_t> rgba_pixels(data.pixels.size() * 4);
size_t row_size = width * 4;
for (size_t y = 0; y <height; ++y)
memcpy(rgba_pixels.data() + (height - y - 1) * row_size,
memcpy(rgba_pixels.data() + y * row_size,
data.pixels.data() + y * row_size, row_size);
const unsigned char *pixels;
pixels = (const unsigned char *) rgba_pixels.data();
@@ -68,12 +68,13 @@ std::string compress_qidi_thumbnail_png(const ThumbnailData &data)
int time = width * height-1; // 200*200-1;
for (unsigned int r = 0; r < height; ++r) {
unsigned int rr = (height - 1 - r) * width;
unsigned int rr = r * width;
for (unsigned int c = 0; c < width; ++c) {
rrrr = int(pixels[4 * (rr + c) + 0]) >> 3;
gggg = int(pixels[4 * (rr + c) + 1]) >> 2;
bbbb = int(pixels[4 * (rr + c) + 2]) >> 3;
aaaa = int(pixels[4 * (rr + c) + 3]);
unsigned int cc = width - c -1;
rrrr = int(pixels[4 * (rr + cc) + 0]) >> 3;
gggg = int(pixels[4 * (rr + cc) + 1]) >> 2;
bbbb = int(pixels[4 * (rr + cc) + 2]) >> 3;
aaaa = int(pixels[4 * (rr + cc) + 3]);
if (aaaa == 0) {
rrrr = 239 >> 3;
gggg = 243 >> 2;

View File

@@ -3471,27 +3471,29 @@ void Plater::priv::export_gcode(fs::path output_path, bool output_path_on_remova
this->restart_background_process(priv::UPDATE_BACKGROUND_PROCESS_FORCE_EXPORT);
//Y6 PrintHint
std::string filament_type;
bool ShowPrintHint = false;
const PrintStatistics& ps = this->fff_print.print_statistics();
const auto& extruders_filaments = wxGetApp().preset_bundle->extruders_filaments;
std::list<std::string> FilamentsHintList = {"PETG", "PLA", "TPU"};
if(wxGetApp().get_mode() == comSimple) {
std::string filament_type;
bool ShowPrintHint = false;
const PrintStatistics& ps = this->fff_print.print_statistics();
const auto& extruders_filaments = wxGetApp().preset_bundle->extruders_filaments;
std::list<std::string> FilamentsHintList = {"PETG", "PLA", "TPU"};
for (const auto& [filament_id, filament_vol] : ps.filament_stats) {
assert(filament_id < extruders_filaments.size());
if (const Preset* preset = extruders_filaments[filament_id].get_selected_preset()) {
filament_type = preset->config.opt_string("filament_type", filament_id);
if (std::find(FilamentsHintList.begin(), FilamentsHintList.end(), filament_type) != FilamentsHintList.end()) {
ShowPrintHint = true;
break;
for (const auto& [filament_id, filament_vol] : ps.filament_stats) {
assert(filament_id < extruders_filaments.size());
if (const Preset* preset = extruders_filaments[filament_id].get_selected_preset()) {
filament_type = preset->config.opt_string("filament_type", filament_id);
if (std::find(FilamentsHintList.begin(), FilamentsHintList.end(), filament_type) != FilamentsHintList.end()) {
ShowPrintHint = true;
break;
}
}
}
}
if (ShowPrintHint) {
std::string message;
message = _u8L("Opening the front door and top cover before printing can improve heat dissipation, obtain better print quality, and prevent extruder blockage.");
notification_manager->push_notification(message);
if (ShowPrintHint) {
std::string message;
message = _u8L("Opening the front door and top cover before printing can improve heat dissipation, obtain better print quality, and prevent extruder blockage.");
notification_manager->push_notification(message);
}
}
}