Sketcher: fix cropping of some icons on hidpi screens
This commit is contained in:
committed by
Kacper Donat
parent
51f4ad7432
commit
ed770bf849
@@ -197,17 +197,14 @@ void ToolHandler::addCursorTail(std::vector<QPixmap>& pixmaps)
|
||||
int newIconWidth = baseCursorWidth + tailWidth;
|
||||
int newIconHeight = baseCursorHeight;
|
||||
|
||||
QPixmap newIcon(newIconWidth, newIconHeight);
|
||||
QPixmap newIcon(newIconWidth * pixelRatio, newIconHeight * pixelRatio);
|
||||
newIcon.setDevicePixelRatio(pixelRatio);
|
||||
newIcon.fill(Qt::transparent);
|
||||
|
||||
QPainter qp;
|
||||
qp.begin(&newIcon);
|
||||
|
||||
qp.drawPixmap(QPointF(0, 0),
|
||||
baseIcon.scaled(baseCursorWidth * pixelRatio,
|
||||
baseCursorHeight * pixelRatio,
|
||||
Qt::KeepAspectRatio,
|
||||
Qt::SmoothTransformation));
|
||||
qp.drawPixmap(QPointF(0, 0), baseIcon);
|
||||
|
||||
// Iterate through pixmaps and them to the cursor pixmap
|
||||
qreal currentIconX = baseCursorWidth;
|
||||
@@ -215,7 +212,7 @@ void ToolHandler::addCursorTail(std::vector<QPixmap>& pixmaps)
|
||||
|
||||
for (auto& icon : pixmaps) {
|
||||
currentIconY = baseCursorHeight - icon.height();
|
||||
qp.drawPixmap(QPointF(currentIconX, currentIconY), icon);
|
||||
qp.drawPixmap(QPointF(currentIconX, currentIconY) / pixelRatio, icon);
|
||||
currentIconX += icon.width();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user