Avoid copying the object when not needed.

This commit is contained in:
Luca Carlon
2025-05-10 14:48:39 +02:00
committed by Christoph Cullmann
parent 4bdcf59579
commit 3da573fc25
2 changed files with 6 additions and 6 deletions

View File

@@ -98,7 +98,7 @@ bool ColorSchemeWallpaper::isNull() const
return _path.isEmpty();
}
bool ColorSchemeWallpaper::draw(QPainter &painter, const QRect rect, qreal bgColorOpacity, const QColor &backgroundColor)
bool ColorSchemeWallpaper::draw(QPainter &painter, const QRect& rect, qreal bgColorOpacity, const QColor &backgroundColor)
{
if ((_picture == nullptr) || _picture->isNull()) {
return false;
@@ -163,7 +163,7 @@ qreal ColorSchemeWallpaper::opacity() const
return _opacity;
}
QRectF ColorSchemeWallpaper::ScaledRect(const QSize viewportSize, const QSize pictureSize, const QRect rect)
QRectF ColorSchemeWallpaper::ScaledRect(const QSize &viewportSize, const QSize &pictureSize, const QRect &rect)
{
QRectF scaledRect = QRectF();
QSize scaledSize = _style == NoScaling ? pictureSize : pictureSize.scaled(viewportSize, RatioMode());
@@ -197,7 +197,7 @@ Qt::AspectRatioMode ColorSchemeWallpaper::RatioMode()
}
}
QImage ColorSchemeWallpaper::FlipImage(const QImage image, const ColorSchemeWallpaper::FlipType flipType)
QImage ColorSchemeWallpaper::FlipImage(const QImage &image, const ColorSchemeWallpaper::FlipType flipType)
{
switch (flipType) {
case Horizontal:

View File

@@ -61,7 +61,7 @@ public:
void load();
/** Returns true if wallpaper available and drawn */
bool draw(QPainter &painter, const QRect rect, qreal bgColorOpacity, const QColor &backgroundColor);
bool draw(QPainter &painter, const QRect& rect, qreal bgColorOpacity, const QColor &backgroundColor);
bool isNull() const;
@@ -93,9 +93,9 @@ private:
bool _isAnimated;
int _frameDelay;
QRectF ScaledRect(const QSize viewportSize, const QSize pictureSize, const QRect rect);
QRectF ScaledRect(const QSize &viewportSize, const QSize &pictureSize, const QRect &rect);
Qt::AspectRatioMode RatioMode();
QImage FlipImage(const QImage image, const ColorSchemeWallpaper::FlipType flipType);
QImage FlipImage(const QImage &image, const ColorSchemeWallpaper::FlipType flipType);
};
}