Skip to content

Commit

Permalink
Don't scale image if it's the same size
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems committed Feb 3, 2024
1 parent d9ccdb9 commit 27838c6
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions applications/system-service/systemapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,19 @@ void SystemAPI::PrepareForSleep(bool suspending){
1
);
auto rect = image.rect();
QPoint center(rect.width() / 2, rect.height() / 2);
painter.translate(center);
painter.scale(
1 * (rect.width() / qreal(img.height())),
1 * (rect.width() / qreal(img.height()))
);
painter.translate(0 - img.width() / 2, 0 - img.height() / 2);
painter.drawPixmap(img.rect(), QPixmap::fromImage(img));
painter.end();
if(rect == img.rect()){
painter.drawImage(rect, img, rect);
}else{
QPoint center(rect.width() / 2, rect.height() / 2);
painter.translate(center);
painter.scale(
1 * (rect.width() / qreal(img.height())),
1 * (rect.width() / qreal(img.height()))
);
painter.translate(0 - img.width() / 2, 0 - img.height() / 2);
painter.drawPixmap(img.rect(), QPixmap::fromImage(img));
painter.end();
}
addSystemBuffer(m_buffer);
auto maybe = Blight::connection()->raise(m_buffer);
// Repaint to attempt to reduce ghosting
Expand Down

0 comments on commit 27838c6

Please sign in to comment.