diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-04-18 14:47:46 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-04-18 20:27:36 +0000 |
commit | 9595622e366fcbef6bcc3a2ee08597959e3e2bd2 (patch) | |
tree | 0a5879089a280c5444e5af9ede20d2a1aa2df164 /src/widgets/effects | |
parent | fc2f0fb39008f95133f6fd24662fe92195431808 (diff) |
QGraphicsBlurEffect: Fix for high DPI scaling
Preserve the device pixel ratio in the various helper functions
and when drawing.
Task-number: QTBUG-60026
Change-Id: Ieac9360b00044b6aedd0d3e1ad6e3b16d436f20f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/widgets/effects')
-rw-r--r-- | src/widgets/effects/qpixmapfilter.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp index bb949fcebf..999e551af4 100644 --- a/src/widgets/effects/qpixmapfilter.cpp +++ b/src/widgets/effects/qpixmapfilter.cpp @@ -719,6 +719,7 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp } QImage temp(img.height(), img.width(), img.format()); + temp.setDevicePixelRatio(img.devicePixelRatioF()); if (transposed >= 0) { if (img.depth() == 8) { qt_memrotate270(reinterpret_cast<const quint8*>(img.bits()), @@ -780,6 +781,7 @@ Q_WIDGETS_EXPORT QImage qt_halfScaled(const QImage &source) if (source.format() == QImage::Format_Indexed8 || source.format() == QImage::Format_Grayscale8) { // assumes grayscale QImage dest(source.width() / 2, source.height() / 2, srcImage.format()); + dest.setDevicePixelRatio(source.devicePixelRatioF()); const uchar *src = reinterpret_cast<const uchar*>(const_cast<const QImage &>(srcImage).bits()); int sx = srcImage.bytesPerLine(); @@ -801,6 +803,7 @@ Q_WIDGETS_EXPORT QImage qt_halfScaled(const QImage &source) return dest; } else if (source.format() == QImage::Format_ARGB8565_Premultiplied) { QImage dest(source.width() / 2, source.height() / 2, srcImage.format()); + dest.setDevicePixelRatio(source.devicePixelRatioF()); const uchar *src = reinterpret_cast<const uchar*>(const_cast<const QImage &>(srcImage).bits()); int sx = srcImage.bytesPerLine(); @@ -837,6 +840,7 @@ Q_WIDGETS_EXPORT QImage qt_halfScaled(const QImage &source) } QImage dest(source.width() / 2, source.height() / 2, srcImage.format()); + dest.setDevicePixelRatio(source.devicePixelRatioF()); const quint32 *src = reinterpret_cast<const quint32*>(const_cast<const QImage &>(srcImage).bits()); int sx = srcImage.bytesPerLine() >> 2; @@ -881,7 +885,7 @@ Q_WIDGETS_EXPORT void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, if (p) { p->scale(scale, scale); p->setRenderHint(QPainter::SmoothPixmapTransform); - p->drawImage(QRect(0, 0, blurImage.width(), blurImage.height()), blurImage); + p->drawImage(QRect(QPoint(0, 0), blurImage.size() / blurImage.devicePixelRatioF()), blurImage); } } |