ContextAlbum: Use const reference for image parameter

This commit is contained in:
Jonas Kvinge 2024-06-20 15:59:34 +02:00
parent 05f012e590
commit 6177d4a2c4
2 changed files with 9 additions and 7 deletions

View File

@ -141,11 +141,7 @@ void ContextAlbum::UpdateWidth(const int new_width) {
}
void ContextAlbum::SetImage(QImage image) {
if (image.isNull()) {
image = image_strawberry_;
}
void ContextAlbum::SetImage(const QImage &image) {
if (downloading_covers_) {
downloading_covers_ = false;
@ -156,7 +152,13 @@ void ContextAlbum::SetImage(QImage image) {
QPixmap pixmap_previous = pixmap_current_;
qreal opacity_previous = pixmap_current_opacity_;
image_original_ = image;
if (image.isNull()) {
image_original_ = image_strawberry_;
}
else {
image_original_ = image;
}
pixmap_current_opacity_ = 0.0;
ScaleCover();

View File

@ -51,7 +51,7 @@ class ContextAlbum : public QWidget {
explicit ContextAlbum(QWidget *parent = nullptr);
void Init(ContextView *context_view, AlbumCoverChoiceController *album_cover_choice_controller);
void SetImage(QImage image = QImage());
void SetImage(const QImage &image = QImage());
void UpdateWidth(const int width);
protected: