Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEnrico Turri <enricoturri@seznam.cz>2019-10-29 09:32:15 +0300
committerEnrico Turri <enricoturri@seznam.cz>2019-10-29 09:32:15 +0300
commitf36dd833d2fecebe86d351fe0f2933e1c920673c (patch)
tree8b306c0fa507ee24ba0b8cf5a25171e37345dccd /src
parent2896e12a4692db145dfd772d788e6b84c3a77299 (diff)
ENABLE_THUMBNAIL_GENERATOR -> Reduce thumbnail size if exceeding 3D scene canvas size
Diffstat (limited to 'src')
-rw-r--r--src/slic3r/GUI/GLCanvas3D.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp
index 703321c3c..139ee5fa4 100644
--- a/src/slic3r/GUI/GLCanvas3D.cpp
+++ b/src/slic3r/GUI/GLCanvas3D.cpp
@@ -1658,6 +1658,16 @@ void GLCanvas3D::render_thumbnail(ThumbnailData& thumbnail_data, unsigned int w,
static const float orange[] = { 0.99f, 0.49f, 0.26f };
static const float gray[] = { 0.64f, 0.64f, 0.64f };
+ const Size& cnv_size = get_canvas_size();
+ unsigned int cnv_w = (unsigned int)cnv_size.get_width();
+ unsigned int cnv_h = (unsigned int)cnv_size.get_height();
+ if ((w > cnv_w) || (h > cnv_h))
+ {
+ float ratio = std::min((float)cnv_w / (float)w, (float)cnv_h / (float)h);
+ w = (unsigned int)(ratio * (float)w);
+ h = (unsigned int)(ratio * (float)h);
+ }
+
thumbnail_data.set(w, h);
GLVolumePtrs visible_volumes;
@@ -1720,7 +1730,6 @@ void GLCanvas3D::render_thumbnail(ThumbnailData& thumbnail_data, unsigned int w,
#endif
// restore the framebuffer size to avoid flickering on the 3D scene
- const Size& cnv_size = get_canvas_size();
m_camera.apply_viewport(0, 0, cnv_size.get_width(), cnv_size.get_height());
}
#endif // ENABLE_THUMBNAIL_GENERATOR