FIX:fixed gradient filament color display on MacOS

Change-Id: I57f3243f5013b8d26ace3fae2cc41e807494af6b
This commit is contained in:
tao wang 2023-04-14 10:40:11 +08:00 committed by Lane.Wei
parent 975aa70651
commit ef6827a6f8
5 changed files with 24 additions and 12 deletions

View file

@ -887,9 +887,7 @@ void AMSLib::doRender(wxDC &dc)
int top = height - curr_height;
if (curr_height >= FromDIP(6)) {
#ifdef __APPLE__
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4) + top, size.x - FromDIP(8), curr_height, m_radius);
#else
//gradient
if (m_info.material_cols.size() > 1) {
int left = FromDIP(4);
@ -898,22 +896,22 @@ void AMSLib::doRender(wxDC &dc)
for (int i = 0; i < m_info.material_cols.size() - 1; i++) {
if ( (left + gwidth) > (size.x - FromDIP(8)) ) {
if ((left + gwidth) > (size.x - FromDIP(8))) {
gwidth = (size.x - FromDIP(4)) - left;
}
auto rect = wxRect(left, height - curr_height + FromDIP(4), gwidth, curr_height);
dc.GradientFillLinear(rect, m_info.material_cols[i], m_info.material_cols[i+1], wxEAST);
dc.GradientFillLinear(rect, m_info.material_cols[i], m_info.material_cols[i + 1], wxEAST);
left += gwidth;
}
}
else {
#ifdef __APPLE__
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4) + top, size.x - FromDIP(8), curr_height, m_radius);
#else
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4) + top, size.x - FromDIP(8), curr_height, m_radius - 1);
}
#endif
}
}
if (top > 2) {