FIX: Bitmap cache not take effect

Change-Id: I972098fdbda0b4542c6c759a8f5e1f0f2a30852b
Jira: STUDIO-4991
This commit is contained in:
chunmao.guo 2023-11-06 17:11:33 +08:00 committed by Lane.Wei
parent 0ef0c55070
commit 8df56cfb60
3 changed files with 17 additions and 3 deletions

View File

@ -316,9 +316,9 @@ wxBitmap* BitmapCache::load_svg(const std::string &bitmap_name, unsigned target_
+ (grayscale ? "-gs" : "")
+ new_color;
/*auto it = m_map.find(bitmap_key);
auto it = m_map.find(bitmap_key);
if (it != m_map.end())
return it->second;*/
return it->second;
// map of color replaces
std::map<std::string, std::string> replaces;

View File

@ -190,6 +190,8 @@ void ObjectDataViewModelNode::set_extruder_icon()
void ObjectDataViewModelNode::set_printable_icon(PrintIndicator printable)
{
if (m_printable == printable)
return;
m_printable = printable;
m_printable_icon = m_printable == piUndef ? m_empty_bmp :
create_scaled_bitmap(m_printable == piPrintable ? "check_on" : "check_off_focused");
@ -197,6 +199,8 @@ void ObjectDataViewModelNode::set_printable_icon(PrintIndicator printable)
void ObjectDataViewModelNode::set_action_icon(bool enable)
{
if (m_action_enable == enable)
return;
m_action_enable = enable;
auto undo = enable ? "lock_normal" : "dot";
m_action_icon_name = m_type & itPlate ? undo :
@ -208,6 +212,8 @@ void ObjectDataViewModelNode::set_action_icon(bool enable)
// BBS
void ObjectDataViewModelNode::set_color_icon(bool enable)
{
if (m_color_enable == enable)
return;
m_color_enable = enable;
if ((m_type & itObject) && enable)
m_color_icon = create_scaled_bitmap("mmu_segmentation");
@ -217,6 +223,8 @@ void ObjectDataViewModelNode::set_color_icon(bool enable)
void ObjectDataViewModelNode::set_support_icon(bool enable)
{
if (m_support_enable == enable)
return;
m_support_enable = enable;
if ((m_type & itObject) && enable)
m_support_icon = create_scaled_bitmap("toolbar_support");
@ -226,6 +234,8 @@ void ObjectDataViewModelNode::set_support_icon(bool enable)
void ObjectDataViewModelNode::set_sinking_icon(bool enable)
{
if (m_sink_enable == enable)
return;
m_sink_enable = enable;
if ((m_type & itObject) && enable)
m_sinking_icon = create_scaled_bitmap("objlist_sinking");

View File

@ -143,7 +143,11 @@ void StaticBox::render(wxDC& dc)
wxSize size = GetSize();
if (size.x <= 0 || size.y <= 0)
return;
wxMemoryDC memdc;
wxMemoryDC memdc(&dc);
if (!memdc.IsOk()) {
doRender(dc);
return;
}
wxBitmap bmp(size.x, size.y);
memdc.SelectObject(bmp);
//memdc.Blit({0, 0}, size, &dc, {0, 0});