diff --git a/libs/ui/kis_splash_screen.h b/libs/ui/kis_splash_screen.h --- a/libs/ui/kis_splash_screen.h +++ b/libs/ui/kis_splash_screen.h @@ -59,6 +59,7 @@ bool m_themed; QImage m_splashImage; int m_textTop; + qreal m_scaleFactor; }; #endif // KIS_SPLASH_SCREEN_H diff --git a/libs/ui/kis_splash_screen.cpp b/libs/ui/kis_splash_screen.cpp --- a/libs/ui/kis_splash_screen.cpp +++ b/libs/ui/kis_splash_screen.cpp @@ -50,12 +50,24 @@ setupUi(this); setWindowIcon(KisIconUtils::loadIcon("krita")); - QImage img = pixmap.toImage(); + QImage img; + if (devicePixelRatioF() > 1.01) { img = pixmap_x2.toImage(); - img.setDevicePixelRatio(2); + img.setDevicePixelRatio(devicePixelRatioF()); + + // actual size : image size (x1) + m_scaleFactor = 2 / devicePixelRatioF(); + } else { + img = pixmap.toImage(); + m_scaleFactor = 1; } + setFixedWidth(pixmap.width() * m_scaleFactor); + setFixedHeight(pixmap.height() * m_scaleFactor); + lblSplash->setFixedWidth(pixmap.width() * m_scaleFactor); + lblSplash->setFixedHeight(pixmap.height() * m_scaleFactor); + QFont font = this->font(); font.setPointSize(11); font.setBold(true); @@ -67,16 +79,16 @@ // positioning of the text over the image (version) // also see setLoadingText() for positiong (loading progress text) - int leftEdge = 475-metrics.width(version); - int topEdge = 58+metrics.ascent(); + qreal leftEdge = 475 * m_scaleFactor - metrics.width(version); + qreal topEdge = 58 * m_scaleFactor + metrics.ascent(); //draw shadow QPen pen(QColor(0, 0, 0, 80)); p.setPen(pen); - p.drawText(leftEdge+1, topEdge+1, version); + p.drawText(QPointF(leftEdge+1, topEdge+1), version); //draw main text p.setPen(QPen(QColor(255, 255, 255, 255))); - p.drawText(leftEdge, topEdge, version); + p.drawText(QPointF(leftEdge, topEdge), version); p.end(); @@ -86,7 +98,6 @@ // Maintain the aspect ratio on high DPI screens when scaling lblSplash->setPixmap(QPixmap::fromImage(img)); - setFixedWidth(pixmap.width()); bnClose->hide(); connect(bnClose, SIGNAL(clicked()), this, SLOT(close())); @@ -211,16 +222,16 @@ p.setRenderHint(QPainter::Antialiasing); // position text for loading text - int leftEdge = 475-metrics.width(text); - int topEdge = m_textTop; + qreal leftEdge = 475 * m_scaleFactor - metrics.width(text); + qreal topEdge = m_textTop; //draw shadow QPen pen(QColor(0, 0, 0, 80)); p.setPen(pen); - p.drawText(leftEdge+1, topEdge+1, text); + p.drawText(QPointF(leftEdge+1, topEdge+1), text); //draw main text p.setPen(QPen(QColor(255, 255, 255, 255))); - p.drawText(leftEdge, topEdge, text); + p.drawText(QPointF(leftEdge, topEdge), text); p.end(); lblSplash->setPixmap(QPixmap::fromImage(img)); }