summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2009-05-05 11:16:50 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2009-05-05 11:16:50 (GMT)
commite4b70508f33a94f32527934b2564eaf7e0677e5e (patch)
tree2f9ff8ba3009e9232549f7887afb587b1f349c23 /src/gui/painting
parentd6634f369db51abb60d94fd5a4b0e78f06f77f5c (diff)
parent33098f7d362172b148032f4b1b41ade271049d9a (diff)
downloadQt-e4b70508f33a94f32527934b2564eaf7e0677e5e.zip
Qt-e4b70508f33a94f32527934b2564eaf7e0677e5e.tar.gz
Qt-e4b70508f33a94f32527934b2564eaf7e0677e5e.tar.bz2
Merge branch 'master' of git@scm.dev.troll.no:qt/qt-s60-public
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qwindowsurface_s60.cpp46
1 files changed, 38 insertions, 8 deletions
diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp
index b262cb2..2618ce2 100644
--- a/src/gui/painting/qwindowsurface_s60.cpp
+++ b/src/gui/painting/qwindowsurface_s60.cpp
@@ -12,9 +12,10 @@
#include <qglobal.h> // for Q_WS_WIN define (non-PCH)
#include <QtGui/qpaintdevice.h>
-#include <QtGui/qwidget.h>
+#include <private/qwidget_p.h>
#include "qwindowsurface_s60_p.h"
#include "qt_s60_p.h"
+#include "private/qdrawhelper_p.h"
QT_BEGIN_NAMESPACE
@@ -35,12 +36,17 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget)
d_ptr->bytes = 0;
d_ptr->bitmap = 0;
- TSize size(0, 0);
TDisplayMode mode = S60->screenDevice()->DisplayMode();
+ bool isOpaque = qt_widget_private(widget)->isOpaque;
+ if (mode == EColor16MA && isOpaque)
+ mode = EColor16MU; // Faster since 16MU -> 16MA is typically accelerated
+ else if (mode == EColor16MU && !isOpaque)
+ mode = EColor16MA; // Try for transparency anyway
- // We create empty CFbsBitmap here -> it will be resized in setGeometry
+
+ // We create empty CFbsBitmap here -> it will be resized in setGeometry
d_ptr->bitmap = new (ELeave) CFbsBitmap;
- User::LeaveIfError( d_ptr->bitmap->Create( size, mode ) );
+ User::LeaveIfError( d_ptr->bitmap->Create(TSize(0, 0), mode ) );
updatePaintDeviceOnBitmap();
@@ -56,7 +62,7 @@ QS60WindowSurface::~QS60WindowSurface()
delete d_ptr;
}
-void QS60WindowSurface::beginPaint(const QRegion &)
+void QS60WindowSurface::beginPaint(const QRegion &rgn)
{
if(!d_ptr->bitmap)
return;
@@ -64,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 &)
@@ -118,12 +144,13 @@ void QS60WindowSurface::setGeometry(const QRect& rect)
if (rect == geometry())
return;
+ QWindowSurface::setGeometry(rect);
+
TRect nativeRect(qt_QRect2TRect(rect));
User::LeaveIfError(d_ptr->bitmap->Resize(nativeRect.Size()));
- updatePaintDeviceOnBitmap();
-
- QWindowSurface::setGeometry(rect);
+ if (!rect.isNull())
+ updatePaintDeviceOnBitmap();
}
void QS60WindowSurface::lockBitmapHeap()
@@ -143,6 +170,9 @@ void QS60WindowSurface::lockBitmapHeap()
// Get some values for QImage creation
TDisplayMode mode = bitmap->DisplayMode();
+ if (mode == EColor16MA
+ && qt_widget_private(QS60WindowSurfacePrivate::lockedSurface->window())->isOpaque)
+ mode = EColor16MU;
QImage::Format format = qt_TDisplayMode2Format( mode );
TSize bitmapSize = bitmap->SizeInPixels();
int bytesPerLine = CFbsBitmap::ScanLineLength( bitmapSize.iWidth, mode);