diff options
author | Gareth Stockwell <gareth.stockwell@sosco.com> | 2009-09-17 11:47:07 (GMT) |
---|---|---|
committer | Frans Englich <frans.englich@nokia.com> | 2009-09-23 12:39:22 (GMT) |
commit | 8a6da961602d9e372a9ccf88332889b4dffda825 (patch) | |
tree | 01410d19434b5f86d28707f05e62d94ee80f8265 /src/3rdparty/phonon/mmf/videooutput.cpp | |
parent | 031260adc1093e95c1c4d95d1d322b5b47ac1891 (diff) | |
download | Qt-8a6da961602d9e372a9ccf88332889b4dffda825.zip Qt-8a6da961602d9e372a9ccf88332889b4dffda825.tar.gz Qt-8a6da961602d9e372a9ccf88332889b4dffda825.tar.bz2 |
Added function for writing transparent pixels directly to the backing store
See VideoOutput::transparentFill. This should be called from the paintEvent, having removed the TranslucentWindowBackground hack from the mediaplayer demo.
As yet this has not been tested.
Diffstat (limited to 'src/3rdparty/phonon/mmf/videooutput.cpp')
-rw-r--r-- | src/3rdparty/phonon/mmf/videooutput.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp index 2130d58..27e4f54 100644 --- a/src/3rdparty/phonon/mmf/videooutput.cpp +++ b/src/3rdparty/phonon/mmf/videooutput.cpp @@ -29,6 +29,13 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <QMoveEvent> #include <QResizeEvent> +// Required for implementation of transparentFill +#include <QtGui/private/qwidget_p.h> +#include <QtGui/private/qdrawhelper_p.h> +#include <QtGui/private/qwindowsurface_p.h> +#include <QImage> + + QT_BEGIN_NAMESPACE using namespace Phonon; @@ -120,6 +127,9 @@ void MMF::VideoOutput::paintEvent(QPaintEvent* event) dump(); +#ifdef PHONON_MMF_DIRECT_WRITE_ALPHA + transparentFill(event->region().rects()); +#else // Note: composition mode code was a failed attempt to get transparent // alpha values to be propagated to the (EColor16MU) window surface. @@ -131,6 +141,43 @@ void MMF::VideoOutput::paintEvent(QPaintEvent* event) painter.drawRects(event->region().rects()); painter.end(); //painter.setCompositionMode(compositionMode); +#endif +} + +void MMF::VideoOutput::transparentFill(const QVector<QRect>& rects) +{ + TRACE_CONTEXT(VideoOutput::transparentFill, EVideoInternal); + TRACE_ENTRY_0(); + + QImage *image = window()->windowSurface()->buffer(window()); + QRgb *data = reinterpret_cast<QRgb *>(image->bits()); + const int row_stride = image->bytesPerLine() / 4; + + for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { + + const QRect& rect = *it; + + TRACE("%d %d size %d x %d", rect.x(), rect.y(), rect.width(), rect.height()); + + const int x_start = rect.x(); + const int width = rect.width(); + + const int y_start = rect.y(); + const int height = rect.height(); + + QRgb *row = data + row_stride * y_start; + for (int y = 0; y < height; ++y) { + + // Note: not using the optimised qt_memfill function implemented in + // gui/painting/qdrawhelper.cpp - can we somehow link against this? + + //qt_memfill(row + x_start, 0U, width); + memset(row + x_start, 0, width*4); + row += row_stride; + } + } + + TRACE_EXIT_0(); } void MMF::VideoOutput::resizeEvent(QResizeEvent* event) |