From 4f1f507d5a181c57e272d5980c7ff6cd45575c34 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 6 Jan 2020 12:40:58 +0100 Subject: [PATCH] Fix of #3371 --- src/slic3r/GUI/GLCanvas3D.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 5b27c8870..d2428cf96 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1137,6 +1137,12 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c // calculate scaling const float scale_gl = canvas.get_canvas_size().get_scale_factor(); +#if ENABLE_RETINA_GL + // For non-visible or non-created window getBackingScaleFactor function return 0.0 value. + // And using of the zero scale causes a crash, when we trying to draw text to the (0,0) rectangle + if (scale_gl <= 0.0f) + return false; +#endif const float scale = scale_gl * wxGetApp().em_unit()*0.1; // get scale from em_unit() value, because of get_scale_factor() return 1 const int scaled_square = std::floor((float)Px_Square * scale); const int scaled_title_offset = Px_Title_Offset * scale;