diff -r 41300fa6a67c -r f7bc934e204c src/gui/painting/qwindowsurface_s60.cpp --- a/src/gui/painting/qwindowsurface_s60.cpp Tue Feb 02 00:43:10 2010 +0200 +++ b/src/gui/painting/qwindowsurface_s60.cpp Wed Mar 31 11:06:36 2010 +0300 @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -70,13 +70,13 @@ // We create empty CFbsBitmap here -> it will be resized in setGeometry CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) ); - + QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType); if (data) { data->fromSymbianBitmap(bitmap, true); d_ptr->device = QPixmap(data); } - + setStaticContentsSupport(true); } QS60WindowSurface::~QS60WindowSurface() @@ -89,24 +89,15 @@ if (!qt_widget_private(window())->isOpaque) { QS60PixmapData *pixmapData = static_cast(d_ptr->device.data_ptr().data()); pixmapData->beginDataAccess(); - QImage &image = pixmapData->image; - QRgb *data = reinterpret_cast(image.bits()); - const int row_stride = image.bytesPerLine() / 4; - - const QVector rects = rgn.rects(); - for (QVector::const_iterator it = rects.begin(); it != rects.end(); ++it) { - const int x_start = it->x(); - const int width = it->width(); - const int y_start = it->y(); - const int height = it->height(); + QPainter p(&pixmapData->image); + p.setCompositionMode(QPainter::CompositionMode_Source); + const QVector rects = rgn.rects(); + const QColor blank = Qt::transparent; + for (QVector::const_iterator it = rects.begin(); it != rects.end(); ++it) { + p.fillRect(*it, blank); + } - QRgb *row = data + row_stride * y_start; - for (int y = 0; y < height; ++y) { - qt_memfill(row + x_start, 0U, width); - row += row_stride; - } - } pixmapData->endDataAccess(); } } @@ -128,7 +119,7 @@ const QPoint off = offset(widget); QImage *img = &(static_cast(d_ptr->device.data_ptr().data())->image); - + QRect rect(off, widget->size()); rect &= QRect(QPoint(), img->size()); @@ -145,10 +136,23 @@ void QS60WindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &) { - const QVector subRects = region.rects(); - for (int i = 0; i < subRects.count(); ++i) { - TRect tr = qt_QRect2TRect(subRects[i]); + QWidget *window = widget->window(); + Q_ASSERT(window); + QTLWExtra *topExtra = window->d_func()->maybeTopData(); + Q_ASSERT(topExtra); + QRect qr = region.boundingRect(); + if (!topExtra->inExpose) { + topExtra->inExpose = true; // Prevent DrawNow() from calling syncBackingStore() again + TRect tr = qt_QRect2TRect(qr); widget->winId()->DrawNow(tr); + topExtra->inExpose = false; + } else { + // This handles the case when syncBackingStore updates content outside of the + // original drawing rectangle. This might happen if there are pending update() + // events at the same time as we get a Draw() from Symbian. + QRect drawRect = qt_TRect2QRect(widget->winId()->DrawableWindow()->GetDrawRect()); + if (!drawRect.contains(qr)) + widget->winId()->DrawDeferred(); } }