summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-03-19 16:03:36 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-03-19 16:03:36 (GMT)
commit3e12d523ce4e2839bda0c1f709134cc6d3f507b3 (patch)
tree7d34bcf037ccb727f095afa3c493a2557d83c445 /src
parentf9815142befe5fb312a6fea1dac43c33a3189145 (diff)
parentc08eed6bec191364a31aecbf5cf33277c637bd7e (diff)
downloadQt-3e12d523ce4e2839bda0c1f709134cc6d3f507b3.zip
Qt-3e12d523ce4e2839bda0c1f709134cc6d3f507b3.tar.gz
Qt-3e12d523ce4e2839bda0c1f709134cc6d3f507b3.tar.bz2
Merge branch 4.7 into qt-master-from-4.7
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qapplication_s60.cpp3
-rw-r--r--src/gui/kernel/qwidget_p.h5
-rw-r--r--src/gui/kernel/qwidget_s60.cpp10
-rw-r--r--src/gui/painting/qwindowsurface_s60.cpp28
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp19
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.h6
-rw-r--r--src/s60installs/s60installs.pro2
7 files changed, 53 insertions, 20 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 3ce597b..3d642d0 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1132,7 +1132,8 @@ void QSymbianControl::Draw(const TRect& controlRect) const
// Do nothing
break;
case QWExtra::Blit:
- if (qwidget->d_func()->isOpaque)
+ case QWExtra::BlitWriteAlpha:
+ if (qwidget->d_func()->isOpaque || nativePaintMode == QWExtra::BlitWriteAlpha)
gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect);
break;
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index dd9bb49..b4c4163 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -322,6 +322,11 @@ struct QWExtra {
*/
ZeroFill,
+ /**
+ * Blit backing store, propagating alpha channel into the framebuffer.
+ */
+ BlitWriteAlpha,
+
Default = Blit
};
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 16f28c7..b031936 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -809,9 +809,14 @@ void QWidgetPrivate::s60UpdateIsOpaque()
{
Q_Q(QWidget);
- if (!q->testAttribute(Qt::WA_WState_Created) || !q->testAttribute(Qt::WA_TranslucentBackground))
+ if (!q->testAttribute(Qt::WA_WState_Created))
return;
+ const bool writeAlpha = extraData()->nativePaintMode == QWExtra::BlitWriteAlpha;
+ if (!q->testAttribute(Qt::WA_TranslucentBackground) && !writeAlpha)
+ return;
+ const bool requireAlphaChannel = !isOpaque || writeAlpha;
+
createTLExtra();
RWindow *const window = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow());
@@ -823,12 +828,11 @@ void QWidgetPrivate::s60UpdateIsOpaque()
return;
}
#endif
- if (!isOpaque) {
+ if (requireAlphaChannel) {
const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA));
if (window->SetTransparencyAlphaChannel() == KErrNone) {
window->SetBackgroundColor(TRgb(255, 255, 255, 0));
extra->topextra->nativeWindowTransparencyEnabled = 1;
-
if (extra->topextra->backingStore.data() && (
QApplicationPrivate::graphics_system_name == QLatin1String("openvg")
|| QApplicationPrivate::graphics_system_name == QLatin1String("opengl"))) {
diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp
index 71556d7..bb4c870 100644
--- a/src/gui/painting/qwindowsurface_s60.cpp
+++ b/src/gui/painting/qwindowsurface_s60.cpp
@@ -63,7 +63,6 @@ struct QS60WindowSurfacePrivate
TDisplayMode displayMode(bool opaque)
{
-
TDisplayMode mode = S60->screenDevice()->DisplayMode();
if (opaque) {
mode = EColor16MU;
@@ -76,10 +75,18 @@ TDisplayMode displayMode(bool opaque)
return mode;
}
+bool blitWriteAlpha(QWidgetPrivate *widgetPrivate)
+{
+ QWExtra *extra = widgetPrivate->extraData();
+ return extra ? extra->nativePaintMode == QWExtra::BlitWriteAlpha : false;
+}
+
QS60WindowSurface::QS60WindowSurface(QWidget* widget)
: QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate)
{
- TDisplayMode mode = displayMode(qt_widget_private(widget)->isOpaque);
+ QWidgetPrivate *widgetPrivate = qt_widget_private(widget);
+ const bool opaque = widgetPrivate->isOpaque && !blitWriteAlpha(widgetPrivate);
+ TDisplayMode mode = displayMode(opaque);
// We create empty CFbsBitmap here -> it will be resized in setGeometry
CFbsBitmap *bitmap = new CFbsBitmap; // CBase derived object needs check on new
Q_CHECK_PTR(bitmap);
@@ -124,7 +131,8 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn)
S60->wsSession().Finish();
#endif
- if (!qt_widget_private(window())->isOpaque) {
+ QWidgetPrivate *windowPrivate = qt_widget_private(window());
+ if (!windowPrivate->isOpaque || blitWriteAlpha(windowPrivate)) {
QS60PixmapData *pixmapData = static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data());
TDisplayMode mode = displayMode(false);
@@ -133,12 +141,14 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn)
pixmapData->beginDataAccess();
- QPainter p(&pixmapData->image);
- p.setCompositionMode(QPainter::CompositionMode_Source);
- const QVector<QRect> rects = rgn.rects();
- const QColor blank = Qt::transparent;
- for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
- p.fillRect(*it, blank);
+ if (!windowPrivate->isOpaque) {
+ QPainter p(&pixmapData->image);
+ p.setCompositionMode(QPainter::CompositionMode_Source);
+ const QVector<QRect> rects = rgn.rects();
+ const QColor blank = Qt::transparent;
+ for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
+ p.fillRect(*it, blank);
+ }
}
pixmapData->endDataAccess();
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
index cb66695..c904c3c 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
@@ -67,6 +67,8 @@ QHash <Qt::HANDLE, QPixmap*> QMeeGoGraphicsSystem::liveTexturePixmaps;
QList<QMeeGoSwitchCallback> QMeeGoGraphicsSystem::switchCallbacks;
+QMeeGoGraphicsSystem::SwitchPolicy QMeeGoGraphicsSystem::switchPolicy = QMeeGoGraphicsSystem::AutomaticSwitch;
+
QMeeGoGraphicsSystem::QMeeGoGraphicsSystem()
{
qDebug("Using the meego graphics system");
@@ -122,14 +124,14 @@ void QMeeGoGraphicsSystemSwitchHandler::addWidget(QWidget *widget)
void QMeeGoGraphicsSystemSwitchHandler::handleMapNotify()
{
- if (m_widgets.isEmpty())
+ if (m_widgets.isEmpty() && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch)
QTimer::singleShot(0, this, SLOT(switchToMeeGo()));
}
void QMeeGoGraphicsSystemSwitchHandler::removeWidget(QObject *object)
{
m_widgets.removeOne(static_cast<QWidget *>(object));
- if (m_widgets.isEmpty())
+ if (m_widgets.isEmpty() && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch)
QTimer::singleShot(0, this, SLOT(switchToRaster()));
}
@@ -153,7 +155,9 @@ int QMeeGoGraphicsSystemSwitchHandler::visibleWidgets() const
bool QMeeGoGraphicsSystemSwitchHandler::eventFilter(QObject *object, QEvent *event)
{
- if (event->type() == QEvent::WindowStateChange) {
+ if (event->type() == QEvent::WindowStateChange
+ && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch)
+ {
QWindowStateChangeEvent *change = static_cast<QWindowStateChangeEvent *>(event);
QWidget *widget = static_cast<QWidget *>(object);
@@ -380,7 +384,7 @@ QString QMeeGoGraphicsSystem::runningGraphicsSystemName()
void QMeeGoGraphicsSystem::switchToMeeGo()
{
- if (meeGoRunning())
+ if (switchPolicy == NoSwitch || meeGoRunning())
return;
if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime"))
@@ -397,7 +401,7 @@ void QMeeGoGraphicsSystem::switchToMeeGo()
void QMeeGoGraphicsSystem::switchToRaster()
{
- if (runningGraphicsSystemName() == QLatin1String("raster"))
+ if (switchPolicy == NoSwitch || runningGraphicsSystemName() == QLatin1String("raster"))
return;
if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime"))
@@ -522,4 +526,9 @@ void qt_meego_register_switch_callback(QMeeGoSwitchCallback callback)
QMeeGoGraphicsSystem::registerSwitchCallback(callback);
}
+void qt_meego_set_switch_policy(int policy)
+{
+ QMeeGoGraphicsSystem::switchPolicy = QMeeGoGraphicsSystem::SwitchPolicy(policy);
+}
+
#include "qmeegographicssystem.moc"
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.h b/src/plugins/graphicssystems/meego/qmeegographicssystem.h
index ecc85b2..3528425 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.h
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.h
@@ -52,6 +52,8 @@ extern "C" typedef void (*QMeeGoSwitchCallback)(int type, const char *name);
class QMeeGoGraphicsSystem : public QGraphicsSystem
{
public:
+ enum SwitchPolicy { AutomaticSwitch, ManualSwitch, NoSwitch };
+
QMeeGoGraphicsSystem();
~QMeeGoGraphicsSystem();
@@ -84,6 +86,8 @@ public:
static void registerSwitchCallback(QMeeGoSwitchCallback callback);
+ static SwitchPolicy switchPolicy;
+
private:
static bool meeGoRunning();
static EGLSurface getSurfaceForLiveTexturePixmap(QPixmap *pixmap);
@@ -93,7 +97,6 @@ private:
static bool surfaceWasCreated;
static QHash<Qt::HANDLE, QPixmap*> liveTexturePixmaps;
static QList<QMeeGoSwitchCallback> switchCallbacks;
-
};
/* C api */
@@ -118,6 +121,7 @@ extern "C" {
Q_DECL_EXPORT void qt_meego_switch_to_raster(void);
Q_DECL_EXPORT void qt_meego_switch_to_meego(void);
Q_DECL_EXPORT void qt_meego_register_switch_callback(QMeeGoSwitchCallback callback);
+ Q_DECL_EXPORT void qt_meego_set_switch_policy(int policy);
}
#endif
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index 1c91422..1b5a5ce 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -58,7 +58,7 @@ symbian: {
" \"$$pluginLocations/qts60plugin_5_0$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0$${QT_LIBINFIX}.dll\"" \
" \"$$bearerPluginLocation/qsymbianbearer$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \
"ENDIF" \
- " \"$$bearerStubZ\" - \"c:$$replace(QT_PLUGINS_BASE_DIR,/,\\)\\bearer\\qsymbianbearer$${QT_LIBINFIX}.qtplugin\"
+ " \"$$bearerStubZ\" - \"c:$$replace(QT_PLUGINS_BASE_DIR,/,\\)\\bearer\\qsymbianbearer$${QT_LIBINFIX}.qtplugin\""
} else {
# No need to deploy plugins for older platform versions when building on Symbian3 or later
qts60plugindeployment = \