Do not use QPainter::setOpacity because, as explained in http://techbase.kde.org/Development/Tutorials/Graphics/Performance#QPainter::setOpacity.28.29 this deactivate hardware acceleration and make Clementine use 100% CPU when using a custom image as background.
This commit is contained in:
parent
b32444dce7
commit
7912caa115
@ -801,10 +801,21 @@ void PlaylistView::paintEvent(QPaintEvent* event) {
|
||||
width(), height(),
|
||||
Qt::KeepAspectRatioByExpanding,
|
||||
Qt::SmoothTransformation);
|
||||
QPixmap temp(cached_scaled_background_image_.size());
|
||||
temp.fill(Qt::transparent);
|
||||
|
||||
QPainter p(&temp);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
p.drawPixmap(0, 0, cached_scaled_background_image_);
|
||||
p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
|
||||
p.fillRect(temp.rect(), QColor(0, 0, 0, 127*kBackgroundOpacity));
|
||||
p.end();
|
||||
|
||||
cached_scaled_background_image_ = temp;
|
||||
|
||||
last_height_ = height();
|
||||
last_width_ = width();
|
||||
}
|
||||
background_painter.setOpacity(kBackgroundOpacity);
|
||||
background_painter.drawPixmap((width() - cached_scaled_background_image_.width()) / 2,
|
||||
(height() - cached_scaled_background_image_.height()) / 2,
|
||||
cached_scaled_background_image_);
|
||||
|
Loading…
x
Reference in New Issue
Block a user