From f70ed1f2cc4cce16d6e844c961003fa7d545ed51 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell Date: Wed, 25 Nov 2009 14:44:49 +0000 Subject: Allow Symbian widget implementations to select native paint mode On the Symbian platform, the Qt raster paint engine targets an off-screen buffer owned by the Font & Bitmap server (FBSERV). When an area of the screen needs to be refreshed, the window server (WSERV) asks the control environment (CONE) to redraw the control(s) intersecting that screen region. Each Qt native widget has an associated Symbian control, whose Draw function blits the required region of the backing store via WSERV. Use cases involving Direct Screen Access (DSA) may require this behaviour to be modified, to either of the following: - Disable: the Draw function does nothing. In this case, the output of paint events, rendered to the backing store, is not blitted to the screen. This mode was introduced by change 8f445e13. - Zero fill: the Draw function fills all pixels within the redraw region with zeroes. This change allows the widget implementation to select either of these alternative modes by setting a flag in its QWExtra structure. Note that these alternative modes are only suitable for native widgets, because they act on a per-control rather than per-widget basis. Task-number: QTBUG-5467 Reviewed-by: Jason Barron --- src/gui/kernel/qapplication_s60.cpp | 23 ++++++++++++++++++++++- src/gui/kernel/qwidget_p.h | 33 +++++++++++++++++++++++++++------ src/gui/kernel/qwidget_s60.cpp | 2 +- 3 files changed, 50 insertions(+), 8 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index fb2bc72..ae7b494 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -822,10 +822,31 @@ void QSymbianControl::Draw(const TRect& controlRect) const CFbsBitmap *bitmap = s60Surface->symbianBitmap(); CWindowGc &gc = SystemGc(); - if(!qwidget->d_func()->extraData()->disableBlit) { + switch(qwidget->d_func()->extraData()->nativePaintMode) { + case QWExtra::Disable: + // Do nothing + break; + + case QWExtra::Blit: if (qwidget->d_func()->isOpaque) gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect); + break; + + case QWExtra::ZeroFill: + if (Window().DisplayMode() == EColor16MA) { + gc.SetBrushStyle(CGraphicsContext::ESolidBrush); + gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); + gc.SetBrushColor(TRgb::Color16MA(0)); + gc.Clear(controlRect); + } else { + gc.SetBrushColor(TRgb(0x000000)); + gc.Clear(controlRect); + }; + break; + + default: + Q_ASSERT(false); } } else { surface->flush(qwidget, QRegion(qt_TRect2QRect(backingStoreRect)), QPoint()); diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 66efcb5..025d703 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -230,12 +230,33 @@ struct QWExtra { #elif defined(Q_OS_SYMBIAN) // <----------------------------------------------------- Symbian uint activated : 1; // RWindowBase::Activated has been called - // If set, QSymbianControl::Draw does not blit this widget - // This is to allow, for use cases such as video, widgets which, from the Qt point - // of view, are just placeholders in the scene. For these widgets, any necessary - // drawing to the UI framebuffer is done by the relevant Symbian subsystem. For - // video rendering, this would be an MMF controller, or MDF post-processor. - uint disableBlit : 1; + /** + * Defines the behaviour of QSymbianControl::Draw. + */ + enum NativePaintMode { + /** + * Normal drawing mode: blits the required region of the backing store + * via WSERV. + */ + Blit, + + /** + * Disable drawing for this widget. + */ + Disable, + + /** + * Paint zeros into the WSERV framebuffer, using BitGDI APIs. For windows + * with an EColor16MU display mode, zero is written only into the R, G and B + * channels of the pixel. + */ + ZeroFill, + + Default = Blit + }; + + NativePaintMode nativePaintMode : 2; + #endif }; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 359df2a..d7d76df 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -881,7 +881,7 @@ void QWidgetPrivate::deleteTLSysExtra() void QWidgetPrivate::createSysExtra() { extra->activated = 0; - extra->disableBlit = 0; + extra->nativePaintMode = QWExtra::Default; } void QWidgetPrivate::deleteSysExtra() -- cgit v0.12