From 284c786c04f62a04992e9f62d71c261894856599 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Thu, 1 Oct 2009 15:43:14 +0100 Subject: Map redraw rectangle into co-ordinate system of backing store, for native child widgets The implementation of QSymbianControl::Draw previously assumed that the co-ordinate system of the control always matched that of the backing store - in other words, that the only widget for which a QSymbianControl was created would be the top-level widget. Now that create_sys has been modified to create a native window (and therefore a QSymbianControl) for child widgets on which winId() is called, this assumption is no longer valid. This function has therefore been modified to map the redraw rectangle into the coordinate system of the backing store. --- src/gui/kernel/qapplication_s60.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 71d0cd1..d8a4c19 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -777,7 +777,7 @@ TCoeInputCapabilities QSymbianControl::InputCapabilities() const } #endif -void QSymbianControl::Draw(const TRect& r) const +void QSymbianControl::Draw(const TRect& controlRect) const { QWindowSurface *surface = qwidget->windowSurface(); QPaintEngine *engine = surface ? surface->paintDevice()->paintEngine() : NULL; @@ -785,6 +785,11 @@ void QSymbianControl::Draw(const TRect& r) const if (!engine) return; + // Map source rectangle into coordinates of the backing store. + const QPoint controlBase(controlRect.iTl.iX, controlRect.iTl.iY); + const QPoint backingStoreBase = qwidget->mapTo(qwidget->window(), controlBase); + const TRect backingStoreRect(TPoint(backingStoreBase.x(), backingStoreBase.y()), controlRect.Size()); + if (engine->type() == QPaintEngine::Raster) { QS60WindowSurface *s60Surface = static_cast(qwidget->windowSurface()); CFbsBitmap *bitmap = s60Surface->symbianBitmap(); @@ -793,10 +798,10 @@ void QSymbianControl::Draw(const TRect& r) const if(!qwidget->d_func()->extraData()->disableBlit) { if (qwidget->d_func()->isOpaque) gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); - gc.BitBlt(r.iTl, bitmap, r); - } + gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect); + } } else { - surface->flush(qwidget, QRegion(qt_TRect2QRect(r)), QPoint()); + surface->flush(qwidget, QRegion(qt_TRect2QRect(backingStoreRect)), QPoint()); } } -- cgit v0.12