mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-11 03:31:49 +08:00
2DBed and BedShapeDialog: Fixed memory leaks
This commit is contained in:
parent
e02c5e84cc
commit
a22c18475a
@ -39,8 +39,8 @@ void Bed_2D::repaint(const std::vector<Vec2d>& shape)
|
|||||||
#else
|
#else
|
||||||
auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT); //GetSystemColour
|
auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT); //GetSystemColour
|
||||||
#endif
|
#endif
|
||||||
dc.SetPen(*new wxPen(color, 1, wxPENSTYLE_SOLID));
|
dc.SetPen(wxPen(color, 1, wxPENSTYLE_SOLID));
|
||||||
dc.SetBrush(*new wxBrush(color, wxBRUSHSTYLE_SOLID));
|
dc.SetBrush(wxBrush(color, wxBRUSHSTYLE_SOLID));
|
||||||
auto rect = GetUpdateRegion().GetBox();
|
auto rect = GetUpdateRegion().GetBox();
|
||||||
dc.DrawRectangle(rect.GetLeft(), rect.GetTop(), rect.GetWidth(), rect.GetHeight());
|
dc.DrawRectangle(rect.GetLeft(), rect.GetTop(), rect.GetWidth(), rect.GetHeight());
|
||||||
}
|
}
|
||||||
@ -75,11 +75,15 @@ void Bed_2D::repaint(const std::vector<Vec2d>& shape)
|
|||||||
|
|
||||||
// draw bed fill
|
// draw bed fill
|
||||||
dc.SetBrush(wxBrush(wxColour(255, 255, 255), wxBRUSHSTYLE_SOLID));
|
dc.SetBrush(wxBrush(wxColour(255, 255, 255), wxBRUSHSTYLE_SOLID));
|
||||||
|
|
||||||
wxPointList pt_list;
|
wxPointList pt_list;
|
||||||
for (auto pt : shape)
|
const size_t pt_cnt = shape.size();
|
||||||
{
|
std::vector<wxPoint> points;
|
||||||
Point pt_pix = to_pixels(pt, ch);
|
points.reserve(pt_cnt);
|
||||||
pt_list.push_back(new wxPoint(pt_pix(0), pt_pix(1)));
|
for (const auto& shape_pt : shape) {
|
||||||
|
Point pt_pix = to_pixels(shape_pt, ch);
|
||||||
|
points.emplace_back(wxPoint(pt_pix(0), pt_pix(1)));
|
||||||
|
pt_list.Append(&points.back());
|
||||||
}
|
}
|
||||||
dc.DrawPolygon(&pt_list, 0, 0);
|
dc.DrawPolygon(&pt_list, 0, 0);
|
||||||
|
|
||||||
|
@ -123,8 +123,8 @@ void BedShape::apply_optgroup_values(ConfigOptionsGroupShp optgroup)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// rectangle, convex, concave...
|
// rectangle, convex, concave...
|
||||||
optgroup->set_value("rect_size" , new ConfigOptionPoints{ to_2d(m_build_volume.bounding_volume().size()) });
|
optgroup->set_value("rect_size" , to_2d(m_build_volume.bounding_volume().size()));
|
||||||
optgroup->set_value("rect_origin" , new ConfigOptionPoints{ - to_2d(m_build_volume.bounding_volume().min) });
|
optgroup->set_value("rect_origin" , to_2d(-1 * m_build_volume.bounding_volume().min));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,8 +425,6 @@ void BedShapePanel::set_shape(const ConfigOptionPoints& points)
|
|||||||
m_loaded_shape = points.values;
|
m_loaded_shape = points.values;
|
||||||
|
|
||||||
update_shape();
|
update_shape();
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BedShapePanel::update_preview()
|
void BedShapePanel::update_preview()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user