This commit is contained in:
YuSanka 2020-01-06 12:40:58 +01:00
parent 8fd753ab27
commit 4f1f507d5a

View File

@ -1137,6 +1137,12 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c
// calculate scaling // calculate scaling
const float scale_gl = canvas.get_canvas_size().get_scale_factor(); 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 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_square = std::floor((float)Px_Square * scale);
const int scaled_title_offset = Px_Title_Offset * scale; const int scaled_title_offset = Px_Title_Offset * scale;