FIX:fixed thumbnail not updating when using multiple plates

jira:[STUDIO-6313]

Change-Id: If49daa5b38b9a580ae226ff00a1e0085d167c15c
This commit is contained in:
tao wang 2024-03-12 20:01:47 +08:00 committed by Lane.Wei
parent 13eeae7fa2
commit 7e81915780
2 changed files with 7 additions and 3 deletions

View File

@ -4548,7 +4548,7 @@ void EditDevNameDialog::on_edit_name(wxCommandEvent &e)
dc.DrawBitmap(m_background_bitmap.bmp(), 0, 0);
dc.DrawBitmap(m_bitmap, 0, 0);
dc.SelectObject(wxNullBitmap);
Refresh();
}
void ThumbnailPanel::OnPaint(wxPaintEvent& event) {

View File

@ -63,6 +63,7 @@ enum PrintFromType {
};
static int get_brightness_value(wxImage image) {
wxImage grayImage = image.ConvertToGreyscale();
int width = grayImage.GetWidth();
@ -71,9 +72,9 @@ static int get_brightness_value(wxImage image) {
int totalLuminance = 0;
unsigned char alpha;
int num_none_transparent = 0;
for (int y = 0; y < height; y+=2) {
for (int y = 0; y < height; y += 2) {
for (int x = 0; x < width; x+=2) {
for (int x = 0; x < width; x += 2) {
alpha = image.GetAlpha(x, y);
if (alpha != 0) {
@ -83,6 +84,9 @@ static int get_brightness_value(wxImage image) {
}
}
}
if (totalLuminance <= 0 || num_none_transparent <= 0) {
return 0;
}
return totalLuminance / num_none_transparent;
}