FIX: filament color icon on macOS

Change-Id: I9ed9d5d87554acfab67e0c41b64c7e8bb3a90f99
This commit is contained in:
chunmao.guo 2023-05-19 17:41:16 +08:00 committed by Lane.Wei
parent 164251531e
commit f8bc0fd2d2
1 changed files with 4 additions and 4 deletions

View File

@ -509,8 +509,6 @@ std::vector<wxBitmap*> get_extruder_color_icons(bool thin_icon/* = false*/)
if (colors.empty()) if (colors.empty())
return bmps; return bmps;
unsigned char rgb[3];
/* It's supposed that standard size of an icon is 36px*16px for 100% scaled display. /* It's supposed that standard size of an icon is 36px*16px for 100% scaled display.
* So set sizes for solid_colored icons used for filament preset * So set sizes for solid_colored icons used for filament preset
* and scale them in respect to em_unit value * and scale them in respect to em_unit value
@ -519,8 +517,6 @@ std::vector<wxBitmap*> get_extruder_color_icons(bool thin_icon/* = false*/)
const int icon_width = lround((thin_icon ? 2 : 4.4) * em); const int icon_width = lround((thin_icon ? 2 : 4.4) * em);
const int icon_height = lround(2 * em); const int icon_height = lround(2 * em);
bool dark_mode = Slic3r::GUI::wxGetApp().dark_mode();
int index = 0; int index = 0;
for (const std::string &color : colors) for (const std::string &color : colors)
{ {
@ -544,8 +540,12 @@ wxBitmap *get_extruder_color_icon(std::string color, std::string label, int icon
// there is no neede to scale created solid bitmap // there is no neede to scale created solid bitmap
wxColor clr(color); wxColor clr(color);
bitmap = bmp_cache.insert(bitmap_key, wxBitmap(icon_width, icon_height)); bitmap = bmp_cache.insert(bitmap_key, wxBitmap(icon_width, icon_height));
#ifdef __WXOSX__
wxMemoryDC dc;
#else
wxClientDC cdc((wxWindow *) Slic3r::GUI::wxGetApp().mainframe); wxClientDC cdc((wxWindow *) Slic3r::GUI::wxGetApp().mainframe);
wxMemoryDC dc(&cdc); wxMemoryDC dc(&cdc);
#endif
dc.SetFont(::Label::Body_12); dc.SetFont(::Label::Body_12);
dc.SelectObject(*bitmap); dc.SelectObject(*bitmap);
if (clr.Alpha() == 0) { if (clr.Alpha() == 0) {