diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qgraphicssystem_runtime.cpp | 19 | ||||
-rw-r--r-- | src/gui/painting/qgraphicssystem_runtime_p.h | 4 |
3 files changed, 9 insertions, 16 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index a14b1a7..c3824f9 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1067,7 +1067,7 @@ void QSymbianControl::Draw(const TRect& controlRect) const if (QApplicationPrivate::runtime_graphics_system) { QRuntimeWindowSurface *rtSurface = static_cast<QRuntimeWindowSurface*>(qwidget->windowSurface()); - s60Surface = static_cast<QS60WindowSurface *>(rtSurface->m_windowSurface); + s60Surface = static_cast<QS60WindowSurface *>(rtSurface->m_windowSurface.data()); } else #endif s60Surface = static_cast<QS60WindowSurface *>(qwidget->windowSurface()); diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index be04df6..e1e0ad0 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -251,7 +251,7 @@ QPixmapData* QRuntimePixmapData::runtimeData() const } QRuntimeWindowSurface::QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, QWidget *window) - : QWindowSurface(window), m_windowSurface(0), m_pendingWindowSurface(0), m_graphicsSystem(gs) + : QWindowSurface(window), m_graphicsSystem(gs) { } @@ -259,7 +259,6 @@ QRuntimeWindowSurface::QRuntimeWindowSurface(const QRuntimeGraphicsSystem *gs, Q QRuntimeWindowSurface::~QRuntimeWindowSurface() { m_graphicsSystem->removeWindowSurface(this); - delete m_windowSurface; } QPaintDevice *QRuntimeWindowSurface::paintDevice() @@ -278,8 +277,7 @@ void QRuntimeWindowSurface::flush(QWidget *widget, const QRegion ®ion, #ifdef QT_DEBUG qDebug() << "QRuntimeWindowSurface::flush() - destroy pending window surface"; #endif - delete m_pendingWindowSurface; - m_pendingWindowSurface = 0; + m_pendingWindowSurface.reset(); } } @@ -355,7 +353,7 @@ QWindowSurface *QRuntimeGraphicsSystem::createWindowSurface(QWidget *widget) con { Q_ASSERT(m_graphicsSystem); QRuntimeWindowSurface *rtSurface = new QRuntimeWindowSurface(this, widget); - rtSurface->m_windowSurface = m_graphicsSystem->createWindowSurface(widget); + rtSurface->m_windowSurface.reset(m_graphicsSystem->createWindowSurface(widget)); widget->setWindowSurface(rtSurface); m_windowSurfaces << rtSurface; return rtSurface; @@ -379,7 +377,6 @@ void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name) for (int i = 0; i < m_pixmapDatas.size(); ++i) { QRuntimePixmapData *proxy = m_pixmapDatas.at(i); QPixmapData *newData = m_graphicsSystem->createPixmapData(proxy->m_data); - // ### TODO Optimize. Openvg and s60raster graphics systems could switch internal ARGB32_PRE QImage buffers. newData->fromImage(proxy->m_data->toImage(), Qt::NoOpaqueDetection); delete proxy->m_data; proxy->m_data = newData; @@ -390,14 +387,10 @@ void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name) QRuntimeWindowSurface *proxy = m_windowSurfaces.at(i); QWidget *widget = proxy->m_windowSurface->window(); - if(m_windowSurfaceDestroyPolicy == DestroyImmediately) { - delete proxy->m_windowSurface; - proxy->m_pendingWindowSurface = 0; - } else { - proxy->m_pendingWindowSurface = proxy->m_windowSurface; - } + if(m_windowSurfaceDestroyPolicy == DestroyAfterFirstFlush) + proxy->m_pendingWindowSurface.reset(proxy->m_windowSurface.take()); - proxy->m_windowSurface = m_graphicsSystem->createWindowSurface(widget); + proxy->m_windowSurface.reset(m_graphicsSystem->createWindowSurface(widget)); qt_widget_private(widget)->invalidateBuffer(widget->rect()); } } diff --git a/src/gui/painting/qgraphicssystem_runtime_p.h b/src/gui/painting/qgraphicssystem_runtime_p.h index d4c9152..0232241 100644 --- a/src/gui/painting/qgraphicssystem_runtime_p.h +++ b/src/gui/painting/qgraphicssystem_runtime_p.h @@ -129,8 +129,8 @@ public: virtual QPoint offset(const QWidget *widget) const; - QWindowSurface *m_windowSurface; - QWindowSurface *m_pendingWindowSurface; + QScopedPointer<QWindowSurface> m_windowSurface; + QScopedPointer<QWindowSurface> m_pendingWindowSurface; private: const QRuntimeGraphicsSystem *m_graphicsSystem; |