summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-04-24 12:22:37 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-04-28 14:42:24 (GMT)
commit4e3ba194fe2404de380fbe544f87773edd66f7b9 (patch)
treef25523ce9e116168350f8b1d90392fac3c305c2f /src/gui/painting
parent6143217a8594c40d693e4ffceb914bc927f43b05 (diff)
downloadQt-4e3ba194fe2404de380fbe544f87773edd66f7b9.zip
Qt-4e3ba194fe2404de380fbe544f87773edd66f7b9.tar.gz
Qt-4e3ba194fe2404de380fbe544f87773edd66f7b9.tar.bz2
Get transparency working by clearing the window surface.
This is duplicated code from the raster paint engine's beginPaint() function. For translucent windows the previous contents must be cleared from the backing store before the new content is painted. This class should probably be re-written as a subclass of the raster version. The reason we cannot use that implementation directly is because we cannot use QNativeImage because it doesn't provide anywhere we can do locking.
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qwindowsurface_s60.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp
index 50278ce..85190c2 100644
--- a/src/gui/painting/qwindowsurface_s60.cpp
+++ b/src/gui/painting/qwindowsurface_s60.cpp
@@ -15,6 +15,7 @@
#include <private/qwidget_p.h>
#include "qwindowsurface_s60_p.h"
#include "qt_s60_p.h"
+#include "private/qdrawhelper_p.h"
QT_BEGIN_NAMESPACE
@@ -61,7 +62,7 @@ QS60WindowSurface::~QS60WindowSurface()
delete d_ptr;
}
-void QS60WindowSurface::beginPaint(const QRegion &)
+void QS60WindowSurface::beginPaint(const QRegion &rgn)
{
if(!d_ptr->bitmap)
return;
@@ -69,6 +70,26 @@ void QS60WindowSurface::beginPaint(const QRegion &)
Q_ASSERT(!QS60WindowSurfacePrivate::lockedSurface);
QS60WindowSurfacePrivate::lockedSurface = this;
lockBitmapHeap();
+
+ if (!qt_widget_private(window())->isOpaque) {
+ QRgb *data = reinterpret_cast<QRgb *>(d_ptr->device.bits());
+ const int row_stride = d_ptr->device.bytesPerLine() / 4;
+
+ const QVector<QRect> rects = rgn.rects();
+ for (QVector<QRect>::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();
+
+ QRgb *row = data + row_stride * y_start;
+ for (int y = 0; y < height; ++y) {
+ qt_memfill(row + x_start, 0U, width);
+ row += row_stride;
+ }
+ }
+ }
}
void QS60WindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &)