From bdaabf614b2f5b1bf0f8fd0f95c3f177c4c53f20 Mon Sep 17 00:00:00 2001 From: "lane.wei" Date: Mon, 25 Sep 2023 19:29:59 +0800 Subject: [PATCH] FIX: CLI: fix a 3mf saving issue some model returns -122 which is caused by the picture size not aligned JIRA: no jira Change-Id: I6501403262dfd271e3022ef70ee11b1ac4d6651b --- src/libslic3r/Format/bbs_3mf.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Format/bbs_3mf.cpp b/src/libslic3r/Format/bbs_3mf.cpp index 313b47a855..f104d516de 100644 --- a/src/libslic3r/Format/bbs_3mf.cpp +++ b/src/libslic3r/Format/bbs_3mf.cpp @@ -5890,8 +5890,11 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result) /* step width and step height */ int sw = thumbnail_data.width / PLATE_THUMBNAIL_SMALL_WIDTH; int sh = thumbnail_data.height / PLATE_THUMBNAIL_SMALL_HEIGHT; - for (int i = 0; i < thumbnail_data.height; i += sh) { - for (int j = 0; j < thumbnail_data.width; j += sw) { + int clampped_width = sw * PLATE_THUMBNAIL_SMALL_WIDTH; + int clampped_height = sh * PLATE_THUMBNAIL_SMALL_HEIGHT; + + for (int i = 0; i < clampped_height; i += sh) { + for (int j = 0; j < clampped_width; j += sw) { int r = 0, g = 0, b = 0, a = 0; for (int m = 0; m < sh; m++) { for (int n = 0; n < sw; n++) {