refactor: scale avatar to 32x32 before drawing

This commit is contained in:
MeexReay 2025-06-30 17:35:37 +03:00
parent 5266d1190f
commit ba0e041423

View File

@ -12,6 +12,7 @@ use std::time::{Duration, SystemTime};
use chrono::Local; use chrono::Local;
use gtk4::gdk_pixbuf::InterpType;
use gtk4 as gtk; use gtk4 as gtk;
use gtk::gdk::{Cursor, Display, Texture}; use gtk::gdk::{Cursor, Display, Texture};
@ -1075,6 +1076,9 @@ fn prepare_avatar(avatars: &mut RwLockWriteGuard<'_, HashMap<u64, Pixbuf>>, mess
let Ok(pixbuf) = load_pixbuf(&data.to_vec()) else { let Ok(pixbuf) = load_pixbuf(&data.to_vec()) else {
return return
}; };
let Some(pixbuf) = pixbuf.scale_simple(32, 32, InterpType::Bilinear) else {
return
};
avatars.insert(id, pixbuf); avatars.insert(id, pixbuf);
} }
} }