From b7d359c66471fb9fe1592d77f8711fe439ac7028 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 31 Jan 2014 14:47:30 +0100 Subject: Apply device pixel ratio to transparency layers The transparency layers are currently created with taking hiDPI into account. This means that any CSS opacity causes a shift in rendering quality. This patch forwards the device pixelratio for any QPaintDevice to transparency layers created for that device. Change-Id: Ie65f76771a4cc59bc714a9b89511cab1f7617abc Reviewed-by: Michael Bruning --- Source/WebCore/platform/graphics/qt/TransparencyLayer.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/WebCore/platform/graphics/qt/TransparencyLayer.h b/Source/WebCore/platform/graphics/qt/TransparencyLayer.h index f13deb03b..0312690e0 100644 --- a/Source/WebCore/platform/graphics/qt/TransparencyLayer.h +++ b/Source/WebCore/platform/graphics/qt/TransparencyLayer.h @@ -46,11 +46,13 @@ struct TransparencyLayer { WTF_MAKE_FAST_ALLOCATED; public: TransparencyLayer(const QPainter* p, const QRect &rect, qreal opacity, QPixmap& alphaMask) - : pixmap(rect.width(), rect.height()) - , opacity(opacity) + : opacity(opacity) , alphaMask(alphaMask) , saveCounter(1) // see the comment for saveCounter { + int devicePixelRatio = p->device()->devicePixelRatio(); + pixmap = QPixmap(rect.width() * devicePixelRatio, rect.height() * devicePixelRatio); + pixmap.setDevicePixelRatio(devicePixelRatio); offset = rect.topLeft(); pixmap.fill(Qt::transparent); painter.begin(&pixmap); -- cgit v1.2.1