diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-09-17 07:19:14 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-09-17 07:19:14 (GMT) |
commit | 8be000bc99de86e0aed57bfb50036eaa695308e9 (patch) | |
tree | 9548b7a179beb2974d352720dab53727404caf91 /src/plugins/gfxdrivers/directfb | |
parent | ebd0823fa2e8b1a19bff32a39c4051ba8535d501 (diff) | |
parent | dfcf988a3f0c88f96e202482e5d363d880b9d6d2 (diff) | |
download | Qt-8be000bc99de86e0aed57bfb50036eaa695308e9.zip Qt-8be000bc99de86e0aed57bfb50036eaa695308e9.tar.gz Qt-8be000bc99de86e0aed57bfb50036eaa695308e9.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/plugins/gfxdrivers/directfb')
6 files changed, 55 insertions, 58 deletions
diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro index d397050..0706f01 100644 --- a/src/plugins/gfxdrivers/directfb/directfb.pro +++ b/src/plugins/gfxdrivers/directfb/directfb.pro @@ -11,5 +11,5 @@ SOURCES += qdirectfbscreenplugin.cpp QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB LIBS += $$QT_LIBS_DIRECTFB -DEFINES += $$QT_DEFINES_DIRECTFB +DEFINES += $$QT_DEFINES_DIRECTFB QT_DIRECTFB_PLUGIN contains(gfx-plugins, directfb):DEFINES += QT_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index b5c4cc5..ce9a55c 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -250,19 +250,6 @@ bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescripti return false; } - QDirectFBPointer<IDirectFBSurface> surfaceFromDescription; - surfaceFromDescription.reset(screen->createDFBSurface(surfaceDescription, QDirectFBScreen::DontTrackSurface, &result)); - if (!surfaceFromDescription) { - DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't create surface", result); - return false; - } - - result = provider->RenderTo(provider.data(), surfaceFromDescription.data(), 0); - if (result != DFB_OK) { - DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't render to surface", result); - return false; - } - DFBImageDescription imageDescription; result = provider->GetImageDescription(provider.data(), &imageDescription); if (result != DFB_OK) { @@ -275,51 +262,19 @@ bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescripti dfbSurface = screen->createDFBSurface(QSize(surfaceDescription.width, surfaceDescription.height), imageFormat, QDirectFBScreen::TrackSurface); - if (alpha) - dfbSurface->Clear(dfbSurface, 0, 0, 0, 0); - - DFBSurfaceBlittingFlags blittingFlags = DSBLIT_NOFX; - if (imageDescription.caps & DICAPS_COLORKEY) { - blittingFlags |= DSBLIT_SRC_COLORKEY; - result = surfaceFromDescription->SetSrcColorKey(surfaceFromDescription.data(), - imageDescription.colorkey_r, - imageDescription.colorkey_g, - imageDescription.colorkey_b); - if (result != DFB_OK) { - DirectFBError("QDirectFBPixmapData::fromSurfaceDescription: Can't set src color key", result); - invalidate(); // release dfbSurface - return false; - } - } - if (imageDescription.caps & DICAPS_ALPHACHANNEL) { - blittingFlags |= DSBLIT_BLEND_ALPHACHANNEL; - } - result = dfbSurface->SetBlittingFlags(dfbSurface, blittingFlags); - if (result != DFB_OK) { - DirectFBError("QDirectFBPixmapData::fromSurfaceDescription: Can't set blitting flags", result); - invalidate(); // release dfbSurface - return false; - } - result = dfbSurface->Blit(dfbSurface, surfaceFromDescription.data(), 0, 0, 0); + result = provider->RenderTo(provider.data(), dfbSurface, 0); if (result != DFB_OK) { - DirectFBError("QDirectFBPixmapData::fromSurfaceDescription: Can't blit to surface", result); - invalidate(); // release dfbSurface + DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't render to surface", result); return false; } - if (blittingFlags != DSBLIT_NOFX) { - dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); - } - w = surfaceDescription.width; h = surfaceDescription.height; is_null = (w <= 0 || h <= 0); d = QDirectFBScreen::depth(imageFormat); setSerialNumber(++global_ser_no); -#if (Q_DIRECTFB_VERSION >= 0x010000) - dfbSurface->ReleaseSource(dfbSurface); -#endif + #if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE screen->setDirectFBImageProvider(providerPtr); provider.take(); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 4413858..0f7a6de 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -1652,6 +1652,19 @@ void QDirectFBScreen::waitIdle() d_ptr->dfb->WaitIdle(d_ptr->dfb); } +#ifdef QT_DIRECTFB_WM +IDirectFBWindow *QDirectFBScreen::windowForWidget(const QWidget *widget) const +{ + if (widget) { + const QWSWindowSurface *surface = static_cast<const QWSWindowSurface*>(widget->windowSurface()); + if (surface && surface->key() == QLatin1String("directfb")) { + return static_cast<const QDirectFBWindowSurface*>(surface)->directFBWindow(); + } + } + return 0; +} +#endif + IDirectFBSurface * QDirectFBScreen::surfaceForWidget(const QWidget *widget, QRect *rect) const { Q_ASSERT(widget); @@ -1687,6 +1700,26 @@ IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, co } #endif +#ifndef QT_DIRECTFB_PLUGIN +Q_GUI_EXPORT IDirectFBSurface *qt_directfb_surface_for_widget(const QWidget *widget, QRect *rect) +{ + return QDirectFBScreen::instance() ? QDirectFBScreen::instance()->surfaceForWidget(widget, rect) : 0; +} +#ifdef QT_DIRECTFB_SUBSURFACE +Q_GUI_EXPORT IDirectFBSurface *qt_directfb_subsurface_for_widget(const QWidget *widget, const QRect &area) +{ + return QDirectFBScreen::instance() ? QDirectFBScreen::instance()->subSurfaceForWidget(widget, area) : 0; +} +#endif +#ifdef QT_DIRECTFB_WM +Q_GUI_EXPORT IDirectFBWindow *qt_directfb_window_for_widget(const QWidget *widget) +{ + return QDirectFBScreen::instance() ? QDirectFBScreen::instance()->windowForWidget(widget) : 0; +} + +#endif +#endif + QT_END_NAMESPACE #include "qdirectfbscreen.moc" diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 79a01d3..5e8c5c6 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -75,8 +75,8 @@ QT_MODULE(Gui) #if !defined QT_DIRECTFB_WINDOW_AS_CURSOR && !defined QT_NO_DIRECTFB_WINDOW_AS_CURSOR #define QT_NO_DIRECTFB_WINDOW_AS_CURSOR #endif -#if !defined QT_NO_DIRECTFB_PALETTE && !defined QT_DIRECTFB_PALETTE -#define QT_DIRECTFB_PALETTE +#if !defined QT_DIRECTFB_PALETTE && !defined QT_NO_DIRECTFB_PALETTE +#define QT_NO_DIRECTFB_PALETTE #endif #if !defined QT_NO_DIRECTFB_PREALLOCATED && !defined QT_DIRECTFB_PREALLOCATED #define QT_DIRECTFB_PREALLOCATED @@ -174,9 +174,10 @@ public: #ifdef QT_DIRECTFB_SUBSURFACE IDirectFBSurface *subSurfaceForWidget(const QWidget *widget, const QRect &area = QRect()) const; #endif - IDirectFB *dfb(); -#ifdef QT_NO_DIRECTFB_WM +#ifdef QT_DIRECTFB_WM + IDirectFBWindow *windowForWidget(const QWidget *widget) const; +#else IDirectFBSurface *primarySurface(); #endif #ifndef QT_NO_DIRECTFB_LAYER diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index ff9f7bd..4cebc96 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -113,13 +113,17 @@ bool QDirectFBWindowSurface::isValid() const #ifdef QT_DIRECTFB_WM void QDirectFBWindowSurface::raise() { - if (dfbWindow) { - dfbWindow->RaiseToTop(dfbWindow); - } else if (sibling && (!sibling->sibling || sibling->dfbWindow)) { - sibling->raise(); + if (IDirectFBWindow *window = directFBWindow()) { + window->RaiseToTop(window); } } +IDirectFBWindow *QDirectFBWindowSurface::directFBWindow() const +{ + return (dfbWindow ? dfbWindow : (sibling ? sibling->dfbWindow : 0)); +} + + void QDirectFBWindowSurface::createWindow(const QRect &rect) { IDirectFBDisplayLayer *layer = screen->dfbDisplayLayer(); @@ -411,7 +415,8 @@ IDirectFBSurface *QDirectFBWindowSurface::surfaceForWidget(const QWidget *widget *rect = QRect(widget->mapTo(win, QPoint(0, 0)), widget->size()); } } - Q_ASSERT(win == widget || widget->isAncestorOf(win)); + + Q_ASSERT(win == widget || win->isAncestorOf(widget)); return dfbSurface; } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index 036830a..0dd3a3b 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -93,6 +93,9 @@ public: IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const; IDirectFBSurface *directFBSurface() const; +#ifdef QT_DIRECTFB_WM + IDirectFBWindow *directFBWindow() const; +#endif private: void updateFormat(); void releaseSurface(); |