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
This commit is contained in:
lane.wei 2023-09-25 19:29:59 +08:00 committed by Lane.Wei
parent 2e2fe7506c
commit bdaabf614b

View file

@ -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++) {