Skip to content

Commit

Permalink
Scale suspend image to fit
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems committed Jan 15, 2024
1 parent a547b54 commit c3b0237
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions applications/system-service/screenapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,23 @@ bool ScreenAPI::drawFullscreenImage(QString path, float rotate) {
auto frameBuffer = EPFrameBuffer::framebuffer();
QRect rect = frameBuffer->rect();
QPainter painter(frameBuffer);
painter.drawImage(rect, img);
painter.fillRect(rect, Qt::white);
painter.setRenderHints(
QPainter::Antialiasing | QPainter::SmoothPixmapTransform,
1
);
QPixmap pxmap;
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();
EPFrameBuffer::sendUpdate(
rect,
frameBuffer->rect(),
EPFrameBuffer::HighQualityGrayscale,
EPFrameBuffer::FullUpdate,
true
Expand Down

0 comments on commit c3b0237

Please sign in to comment.