diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/painting/qbackingstore.cpp | 1 | ||||
-rw-r--r-- | src/gui/painting/qplatformbackingstore.cpp | 19 | ||||
-rw-r--r-- | src/gui/painting/qplatformbackingstore.h | 4 | ||||
-rw-r--r-- | src/platformsupport/graphics/qrasterbackingstore.cpp | 5 |
4 files changed, 29 insertions, 0 deletions
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index e3d18512dd..ceaad61e13 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -138,6 +138,7 @@ QBackingStore::QBackingStore(QWindow *window) : d_ptr(new QBackingStorePrivate(window)) { d_ptr->platformBackingStore = QGuiApplicationPrivate::platformIntegration()->createPlatformBackingStore(window); + d_ptr->platformBackingStore->setBackingStore(this); } /*! diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 0c5de36981..b8bbdefa37 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -77,6 +77,7 @@ class QPlatformBackingStorePrivate public: QPlatformBackingStorePrivate(QWindow *w) : window(w) + , backingStore(0) #ifndef QT_NO_OPENGL , textureId(0) , blitter(0) @@ -100,6 +101,7 @@ public: #endif } QWindow *window; + QBackingStore *backingStore; #ifndef QT_NO_OPENGL mutable GLuint textureId; mutable QSize textureSize; @@ -623,6 +625,23 @@ QWindow* QPlatformBackingStore::window() const } /*! + Sets the backing store associated with this surface. +*/ +void QPlatformBackingStore::setBackingStore(QBackingStore *backingStore) +{ + d_ptr->backingStore = backingStore; +} + +/*! + Returns a pointer to the backing store associated with this + surface. +*/ +QBackingStore *QPlatformBackingStore::backingStore() const +{ + return d_ptr->backingStore; +} + +/*! This function is called before painting onto the surface begins, with the \a region in which the painting will occur. diff --git a/src/gui/painting/qplatformbackingstore.h b/src/gui/painting/qplatformbackingstore.h index 8d0e29ad8d..ec56aaa002 100644 --- a/src/gui/painting/qplatformbackingstore.h +++ b/src/gui/painting/qplatformbackingstore.h @@ -112,6 +112,7 @@ public: virtual ~QPlatformBackingStore(); QWindow *window() const; + QBackingStore *backingStore() const; virtual QPaintDevice *paintDevice() = 0; @@ -145,6 +146,9 @@ public: private: QPlatformBackingStorePrivate *d_ptr; + + void setBackingStore(QBackingStore *); + friend class QBackingStore; }; #ifndef QT_NO_OPENGL diff --git a/src/platformsupport/graphics/qrasterbackingstore.cpp b/src/platformsupport/graphics/qrasterbackingstore.cpp index 325c98b93d..ef26edc494 100644 --- a/src/platformsupport/graphics/qrasterbackingstore.cpp +++ b/src/platformsupport/graphics/qrasterbackingstore.cpp @@ -39,6 +39,7 @@ #include "qrasterbackingstore_p.h" +#include <QtGui/qbackingstore.h> #include <QtGui/qpainter.h> QT_BEGIN_NAMESPACE @@ -104,6 +105,10 @@ bool QRasterBackingStore::scroll(const QRegion ®ion, int dx, int dy) void QRasterBackingStore::beginPaint(const QRegion ®ion) { + // Keep backing store device pixel ratio in sync with window + if (m_image.devicePixelRatio() != window()->devicePixelRatio()) + resize(backingStore()->size(), backingStore()->staticContents()); + if (!m_image.hasAlphaChannel()) return; |