Skip to content

Commit

Permalink
fix: set devicePixelRatio on pixmap (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
LosFarmosCTL authored Jul 1, 2022
1 parent c74a082 commit a210e6f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/providers/seventv/paints/Paint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,19 @@ QPixmap Paint::getPixmap(const QString text, const QFont font,
if (!shadow.isValid())
continue;

auto scaledShadow = shadow.scaled(scale);

// HACK: create a QLabel from the pixmap to apply drop shadows
QLabel *label = new QLabel();

auto scaledShadow = shadow.scaled(scale / label->devicePixelRatioF());

// NOTE: avoid scaling issues on high DPI displays
pixmap.setDevicePixelRatio(label->devicePixelRatioF());

label->setPixmap(pixmap);
label->setGraphicsEffect(scaledShadow.getGraphicsEffect());

pixmap = label->grab();
pixmap.setDevicePixelRatio(1);
}

if (drawColon)
Expand Down

0 comments on commit a210e6f

Please sign in to comment.