diff options
author | Anders Bakken <anders.bakken@nokia.com> | 2009-08-26 07:12:25 (GMT) |
---|---|---|
committer | Anders Bakken <anders.bakken@nokia.com> | 2009-08-26 17:19:27 (GMT) |
commit | bf6a3925109ea55b57633d02fc752344d55a9fae (patch) | |
tree | be967562e6477e58c810d6b5460b6638f0da1252 /src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp | |
parent | 52f5e632da1bd5ef413b3108564b9b47850ce441 (diff) | |
download | Qt-bf6a3925109ea55b57633d02fc752344d55a9fae.zip Qt-bf6a3925109ea55b57633d02fc752344d55a9fae.tar.gz Qt-bf6a3925109ea55b57633d02fc752344d55a9fae.tar.bz2 |
Implement QDirectFBScreen::surfaceForWidget
Allow applications to get a pointer to the surface of the window surface
for a given widget or a subsurface of the widget.
This function ignores whether or not the widget is fully or partially
obscured.
Reviewed-by: Donald Carr <donald.carr@nokia.com>
Diffstat (limited to 'src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp')
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 2f240fb..aa98a13 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -466,6 +466,27 @@ QImage *QDirectFBWindowSurface::buffer(const QWidget *widget) return img; } +IDirectFBSurface *QDirectFBWindowSurface::surfaceForWidget(const QWidget *widget, QRect *rect) const +{ + Q_ASSERT(widget); + if (!dfbSurface) { + if (sibling && (!sibling->sibling || sibling->dfbSurface)) + return sibling->surfaceForWidget(widget, rect); + return 0; + } + QWidget *win = window(); + Q_ASSERT(win); + if (rect) { + if (win == widget) { + *rect = widget->rect(); + } else { + *rect = QRect(widget->mapTo(win, QPoint(0, 0)), widget->size()); + } + } + Q_ASSERT(win == widget || widget->isAncestorOf(win)); + return dfbSurface; +} + void QDirectFBWindowSurface::updateFormat() { imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid; |