Qt 4.8
|
The QWSWindowSurface class provides the drawing area for top-level windows in Qt for Embedded Linux. More...
#include <qwindowsurface_qws_p.h>
Public Types | |
enum | SurfaceFlag { RegionReserved = 0x1, Buffered = 0x2, Opaque = 0x4 } |
This enum is used to describe the window surface's contents. More... | |
Public Types inherited from QWindowSurface | |
enum | WindowSurfaceFeature { PartialUpdates = 0x00000001, PreservedContents = 0x00000002, StaticContents = 0x00000004, AllFeatures = 0xffffffff } |
Public Functions | |
virtual void | beginPaint (const QRegion &) |
This function is called before painting onto the surface begins, with the region in which the painting will occur. More... | |
const QRegion | clipRegion () const |
Returns the region currently visible on the screen. More... | |
virtual void | endPaint (const QRegion &) |
This function is called after painting onto the surface has ended, with the region in which the painting was performed. More... | |
virtual void | flush (QWidget *widget, const QRegion ®ion, const QPoint &offset) |
Flushes the given region from the specified widget onto the screen. More... | |
virtual QImage | image () const =0 |
Implement this function to return an image of the top-level window. More... | |
bool | isBuffered () const |
Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false. More... | |
bool | isOpaque () const |
Returns true if the QWSWindowSurface::Opaque is set; otherwise returns false. More... | |
bool | isRegionReserved () const |
Returns true if the QWSWindowSurface::RegionReserved is set; otherwise returns false. More... | |
virtual bool | isValid () const =0 |
Implement this function to return true if the surface is a valid surface for the given top-level window; otherwise return false. More... | |
virtual QString | key () const =0 |
Implement this function to return a string that uniquely identifies the class of this surface. More... | |
virtual bool | lock (int timeout=-1) |
virtual bool | move (const QPoint &offset) |
Move the surface with the given offset. More... | |
virtual QRegion | move (const QPoint &offset, const QRegion &newClip) |
Move the surface with the given offset. More... | |
virtual QPaintDevice * | paintDevice ()=0 |
Implement this function to return the appropriate paint device. More... | |
virtual QPoint | painterOffset () const |
Returns the offset to be used when painting. More... | |
virtual QByteArray | permanentState () const |
Implement this function to return the data required for creating a server-side representation of the surface. More... | |
QWSWindowSurface () | |
Constructs an empty surface. More... | |
QWSWindowSurface (QWidget *widget) | |
Constructs an empty surface for the given top-level widget. More... | |
virtual void | releaseSurface () |
void | setClipRegion (const QRegion &) |
Sets the region currently visible on the screen to be the given clip region. More... | |
virtual void | setGeometry (const QRect &rect) |
Sets the currently allocated area to be the given rect. More... | |
virtual void | setGeometry (const QRect &rect, const QRegion &mask) |
virtual void | setPermanentState (const QByteArray &state) |
Implement this function to attach a server-side surface instance to the corresponding client side instance using the given data. More... | |
virtual void | setTransientState (const QByteArray &state) |
SurfaceFlags | surfaceFlags () const |
Returns the surface flags describing the contents of this surface. More... | |
virtual QByteArray | transientState () const |
virtual void | unlock () |
int | winId () const |
~QWSWindowSurface () | |
Public Functions inherited from QWindowSurface | |
virtual QImage * | buffer (const QWidget *widget) |
Returns a QImage pointer which represents the actual buffer the widget is drawn into or 0 if this is unavailable. More... | |
virtual WindowSurfaceFeatures | features () const |
QRect | geometry () const |
Returns the currently allocated area on the screen. More... | |
virtual QPixmap | grabWidget (const QWidget *widget, const QRect &rectangle=QRect()) const |
Returns a QPixmap generated from the part of the backing store corresponding to widget. More... | |
bool | hasFeature (WindowSurfaceFeature feature) const |
virtual QPoint | offset (const QWidget *widget) const |
Returns the offset of widget in the coordinates of this window surface. More... | |
QWindowSurface (QWidget *window, bool setDefaultSurface=true) | |
Constructs an empty surface for the given top-level window. More... | |
QRect | rect (const QWidget *widget) const |
Returns the rectangle for widget in the coordinates of this window surface. More... | |
virtual bool | scroll (const QRegion &area, int dx, int dy) |
Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative. More... | |
void | setStaticContents (const QRegion ®ion) |
QRegion | staticContents () const |
QWidget * | window () const |
Returns a pointer to the top-level window associated with this surface. More... | |
virtual | ~QWindowSurface () |
Destroys this surface. More... | |
Protected Functions | |
void | setSurfaceFlags (SurfaceFlags type) |
Sets the surface flags describing the contents of this surface, to be the given flags. More... | |
void | setWinId (int id) |
Protected Functions inherited from QWindowSurface | |
bool | hasStaticContents () const |
Private Functions | |
void | invalidateBuffer () |
Properties | |
QWSWindowSurfacePrivate * | d_ptr |
Friends | |
class | QWidgetPrivate |
The QWSWindowSurface class provides the drawing area for top-level windows in Qt for Embedded Linux.
This function is under development and subject to change.
Note that this class is only available in Qt for Embedded Linux.
In Qt for Embedded Linux, the default behavior is for each client to render its widgets into memory while the server is responsible for putting the contents of the memory onto the screen. QWSWindowSurface is used by the window system to implement the associated memory allocation.
When a screen update is required, the server runs through all the top-level windows that intersect with the region that is about to be updated, and ensures that the associated clients have updated their memory buffer. Then the server uses the screen driver to copy the content of the memory to the screen. To locate the relevant parts of memory, the driver is provided with the list of top-level windows that intersect with the given region. Associated with each of the top-level windows there is a window surface representing the drawing area of the window.
When deriving from the QWSWindowSurface class, e.g., when Adding an Accelerated Graphics Driver to Qt for Embedded Linux, there are several pure virtual functions that must be implemented. In addition, QWSWindowSurface provides several virtual functions that can be reimplemented to customize the drawing process.
There are in fact two window surface instances for each top-level window; one used by the application when drawing a window, and another used by the server application to perform window compositioning. Implement the attach() to create the server-side representation of the surface. The data() function must be implemented to provide the required data.
Implement the key() function to uniquely identify the surface class, and the isValid() function to determine is a surface corresponds to a given widget.
The geometry() function must be implemented to let the window system determine the area required by the window surface (QWSWindowSurface also provides a corresponding virtual setGeometry() function that is called whenever the area necessary for the top-level window to be drawn, changes). The image() function is called by the window system during window compositioning, and must be implemented to return an image of the top-level window.
Finally, the paintDevice() function must be implemented to return the appropriate paint device, and the scroll() function must be implemented to scroll the given region of the surface the given number of pixels.
When painting onto the surface, the window system will always call the beginPaint() function before any painting operations are performed. Likewise the endPaint() function is automatically called when the painting is done. Reimplement the painterOffset() function to alter the offset that is applied when drawing.
The window system uses the flush() function to put a given region of the widget onto the screen, and the release() function to deallocate the screen region corresponding to this window surface.
QWSWindowSurface provides the window() function returning a pointer to the top-level window the surface is representing. The currently visible region of the associated widget can be retrieved and set using the clipRegion() and setClipRegion() functions, respectively.
When the window system performs the window compositioning, it uses the SurfaceFlag enum describing the surface content. The currently set surface flags can be retrieved and altered using the surfaceFlags() and setSurfaceFlags() functions. In addition, QWSWindowSurface provides the isBuffered(), isOpaque() and isRegionReserved() convenience functions.
Definition at line 68 of file qwindowsurface_qws_p.h.
This enum is used to describe the window surface's contents.
It is used by the screen driver to handle region allocation and composition.
Enumerator | |
---|---|
RegionReserved | |
Buffered | |
Opaque |
Definition at line 113 of file qwindowsurface_qws_p.h.
QWSWindowSurface::QWSWindowSurface | ( | ) |
Constructs an empty surface.
Definition at line 436 of file qwindowsurface_qws.cpp.
QWSWindowSurface::QWSWindowSurface | ( | QWidget * | widget | ) |
Constructs an empty surface for the given top-level widget.
Definition at line 444 of file qwindowsurface_qws.cpp.
QWSWindowSurface::~QWSWindowSurface | ( | ) |
Definition at line 449 of file qwindowsurface_qws.cpp.
|
virtual |
This function is called before painting onto the surface begins, with the region in which the painting will occur.
Reimplemented from QWindowSurface.
Reimplemented in QWSDirectPainterSurface, QWSMemorySurface, and QDirectFBWindowSurface.
Definition at line 472 of file qwindowsurface_qws.cpp.
Referenced by QWSMemorySurface::beginPaint(), QWSDirectPainterSurface::beginPaint(), QWSMemorySurface::image(), and QWSDirectPainterSurface::screen().
const QRegion QWSWindowSurface::clipRegion | ( | ) | const |
Returns the region currently visible on the screen.
Definition at line 539 of file qwindowsurface_qws.cpp.
Referenced by QWidgetBackingStore::beginPaint(), QWidgetPrivate::moveRect(), QWSDirectPainterSurface::region(), QWidgetPrivate::scrollRect(), and QWidget::visibleRegion().
|
virtual |
This function is called after painting onto the surface has ended, with the region in which the painting was performed.
Reimplemented from QWindowSurface.
Reimplemented in QDirectFBWindowSurface.
Definition at line 477 of file qwindowsurface_qws.cpp.
|
virtual |
Flushes the given region from the specified widget onto the screen.
Note that the offset parameter is currently unused.
Implements QWindowSurface.
Reimplemented in QWSDirectPainterSurface, QWSYellowSurface, QDirectFBWindowSurface, and PvrEglWindowSurface.
Definition at line 692 of file qwindowsurface_qws.cpp.
Referenced by QWSYellowSurface::isValid(), and QWSDirectPainterSurface::region().
|
pure virtual |
Implement this function to return an image of the top-level window.
Implemented in QWSDirectPainterSurface, QWSYellowSurface, QWSMemorySurface, QDirectFBWindowSurface, PvrEglWindowSurface, and EGLNullWSWindowSurface.
Referenced by QScreen::blit(), QScreen::compose(), QDirectFBScreen::exposeRegion(), and flush().
|
private |
Definition at line 149 of file qwindowsurface_qws.cpp.
Referenced by effectiveState(), and setGeometry().
|
inline |
Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false.
Definition at line 125 of file qwindowsurface_qws_p.h.
Referenced by QScreen::compose(), QWSWindow::createSurface(), move(), QWSServerPrivate::request_region(), QWidgetPrivate::scrollRect(), setClipRegion(), setGeometry(), QWSServerPrivate::update_regions(), and QWSWindow::~QWSWindow().
|
inline |
Returns true if the QWSWindowSurface::Opaque is set; otherwise returns false.
Definition at line 126 of file qwindowsurface_qws_p.h.
Referenced by flush(), QWSMemorySurface::isValid(), and QWSServerPrivate::request_region().
|
inline |
Returns true if the QWSWindowSurface::RegionReserved is set; otherwise returns false.
Definition at line 122 of file qwindowsurface_qws_p.h.
Referenced by QWSTtyKbPrivate::handleConsoleSwitch(), QWSDirectPainterSurface::permanentState(), QWSServerPrivate::request_region(), and QWSServerPrivate::update_regions().
|
pure virtual |
Implement this function to return true if the surface is a valid surface for the given top-level window; otherwise return false.
Implemented in QWSDirectPainterSurface, QWSYellowSurface, QWSOnScreenSurface, QWSMemorySurface, QDirectFBWindowSurface, PvrEglWindowSurface, and EGLNullWSWindowSurface.
Referenced by QWidgetBackingStore::beginPaint().
|
pure virtual |
Implement this function to return a string that uniquely identifies the class of this surface.
Implemented in QWSDirectPainterSurface, QWSYellowSurface, QWSOnScreenSurface, QWSSharedMemSurface, QWSLocalMemSurface, QDirectFBWindowSurface, PvrEglWindowSurface, and EGLNullWSWindowSurface.
Referenced by PvrEglScreenSurfaceFunctions::createNativeWindow(), QDirectFBScreen::exposeRegion(), QDirectFBScreenPrivate::onWindowEvent(), setGeometry(), QDirectFBScreen::surfaceForWidget(), and QDirectFBScreen::windowForWidget().
|
virtual |
Reimplemented in QWSDirectPainterSurface, and QWSMemorySurface.
Definition at line 503 of file qwindowsurface_qws.cpp.
Referenced by beginPaint(), QScreen::blit(), QScreen::compose(), QWSMemorySurface::image(), and QWSDirectPainterSurface::screen().
|
virtual |
Move the surface with the given offset.
A subclass may reimplement this function to enable accelerated window move. It must return true if the move was successful and no repaint is necessary, false otherwise.
The default implementation updates the QWindowSurface geometry and returns true if the surface is buffered; false otherwise.
This function is called by the window system on the client instance.
Reimplemented in QDirectFBWindowSurface, and PvrEglWindowSurface.
Definition at line 757 of file qwindowsurface_qws.cpp.
Referenced by effectiveState(), and PvrEglWindowSurface::move().
Move the surface with the given offset.
The new visible region after the window move is given by newClip in screen coordinates.
A subclass may reimplement this function to enable accelerated window move. The returned region indicates the area that still needs to be composed on the screen.
The default implementation updates the QWindowSurface geometry and returns the union of the old and new geometry.
This function is called by the window system on the server instance.
Definition at line 778 of file qwindowsurface_qws.cpp.
|
pure virtual |
Implement this function to return the appropriate paint device.
Implements QWindowSurface.
Implemented in QWSDirectPainterSurface, QWSYellowSurface, QWSMemorySurface, QDirectFBWindowSurface, PvrEglWindowSurface, and EGLNullWSWindowSurface.
|
virtual |
Returns the offset to be used when painting.
Reimplemented in QWSOnScreenSurface, and QWSMemorySurface.
Definition at line 464 of file qwindowsurface_qws.cpp.
Referenced by QWidgetBackingStore::beginPaint(), flush(), QWSMemorySurface::image(), QWSMemorySurface::painterOffset(), and QWSOnScreenSurface::painterOffset().
|
virtual |
Implement this function to return the data required for creating a server-side representation of the surface.
Reimplemented in QWSDirectPainterSurface, QWSYellowSurface, QWSOnScreenSurface, QWSSharedMemSurface, QWSLocalMemSurface, QDirectFBWindowSurface, and PvrEglWindowSurface.
Definition at line 488 of file qwindowsurface_qws.cpp.
Referenced by QWSLocalMemSurface::key(), QWSSharedMemSurface::key(), QWSOnScreenSurface::key(), QWSYellowSurface::key(), QWSDirectPainterSurface::key(), and setGeometry().
|
virtual |
Reimplemented in QWSSharedMemSurface, QWSLocalMemSurface, and QDirectFBWindowSurface.
Definition at line 785 of file qwindowsurface_qws.cpp.
Referenced by QWidgetBackingStore::beginPaint(), QWSLocalMemSurface::key(), and QWSSharedMemSurface::key().
void QWSWindowSurface::setClipRegion | ( | const QRegion & | clip | ) |
Sets the region currently visible on the screen to be the given clip region.
Definition at line 550 of file qwindowsurface_qws.cpp.
Referenced by qt_directpainter_region(), setGeometry(), and QETWidget::translateRegionEvent().
|
virtual |
Sets the currently allocated area to be the given rect.
This function is called whenever area covered by the top-level window changes.
Reimplemented from QWindowSurface.
Reimplemented in QWSDirectPainterSurface, QWSSharedMemSurface, QWSLocalMemSurface, QDirectFBWindowSurface, and PvrEglWindowSurface.
Definition at line 612 of file qwindowsurface_qws.cpp.
Referenced by QWidgetBackingStore::beginPaint(), PvrEglScreenSurfaceFunctions::createNativeWindow(), effectiveState(), isServerProcess(), PvrEglWindowSurface::setGeometry(), QDirectFBWindowSurface::setGeometry(), QWSLocalMemSurface::setGeometry(), and QWSSharedMemSurface::setGeometry().
Definition at line 639 of file qwindowsurface_qws.cpp.
|
virtual |
Implement this function to attach a server-side surface instance to the corresponding client side instance using the given data.
Return true if successful; otherwise return false.
Reimplemented in QWSDirectPainterSurface, QWSYellowSurface, QWSOnScreenSurface, QWSSharedMemSurface, QWSLocalMemSurface, QDirectFBWindowSurface, and PvrEglWindowSurface.
Definition at line 498 of file qwindowsurface_qws.cpp.
Referenced by QWSWindow::createSurface(), QWSLocalMemSurface::key(), QWSSharedMemSurface::key(), QWSOnScreenSurface::key(), QWSYellowSurface::key(), QWSDirectPainterSurface::key(), and QWSServerPrivate::request_region().
|
protected |
Sets the surface flags describing the contents of this surface, to be the given flags.
Definition at line 607 of file qwindowsurface_qws.cpp.
Referenced by EGLNullWSWindowSurface::EGLNullWSWindowSurface(), PvrEglWindowSurface::PvrEglWindowSurface(), QDirectFBWindowSurface::QDirectFBWindowSurface(), QWSDirectPainterSurface::QWSDirectPainterSurface(), QWSMemorySurface::QWSMemorySurface(), QWSOnScreenSurface::QWSOnScreenSurface(), QWSYellowSurface::QWSYellowSurface(), QDirectFBWindowSurface::setOpaque(), QDirectFBWindowSurface::setPermanentState(), QWSLocalMemSurface::setPermanentState(), QWSSharedMemSurface::setPermanentState(), QWSDirectPainterSurface::setPermanentState(), and QWSDirectPainterSurface::setReserved().
|
virtual |
Definition at line 493 of file qwindowsurface_qws.cpp.
|
protected |
Definition at line 207 of file qwindowsurface_qws.cpp.
Referenced by QWSDirectPainterSurface::QWSDirectPainterSurface(), and QWSYellowSurface::QWSYellowSurface().
QWSWindowSurface::SurfaceFlags QWSWindowSurface::surfaceFlags | ( | ) | const |
Returns the surface flags describing the contents of this surface.
Definition at line 596 of file qwindowsurface_qws.cpp.
Referenced by QDirectFBWindowSurface::createWindow(), QDirectFBWindowSurface::permanentState(), QWSLocalMemSurface::permanentState(), QWSSharedMemSurface::permanentState(), QDirectFBWindowSurface::setGeometry(), QDirectFBWindowSurface::setOpaque(), and QWSDirectPainterSurface::setPermanentState().
|
virtual |
Definition at line 483 of file qwindowsurface_qws.cpp.
|
virtual |
Reimplemented in QWSDirectPainterSurface, and QWSMemorySurface.
Definition at line 509 of file qwindowsurface_qws.cpp.
Referenced by QScreen::blit(), QScreen::compose(), endPaint(), QWSMemorySurface::image(), and QWSDirectPainterSurface::screen().
int QWSWindowSurface::winId | ( | ) | const |
Definition at line 179 of file qwindowsurface_qws.cpp.
Referenced by QWSDirectPainterSurface::beginPaint(), effectiveState(), flush(), QWSYellowSurface::flush(), QWSDirectPainterSurface::flush(), QWSDirectPainterSurface::QWSDirectPainterSurface(), QWSYellowSurface::QWSYellowSurface(), setGeometry(), QWSDirectPainterSurface::setRegion(), QWSDirectPainterSurface::windowId(), and QWSDirectPainterSurface::~QWSDirectPainterSurface().
|
friend |
Definition at line 136 of file qwindowsurface_qws_p.h.
|
private |
Definition at line 140 of file qwindowsurface_qws_p.h.
Referenced by clipRegion(), flush(), setClipRegion(), setSurfaceFlags(), surfaceFlags(), unlock(), winId(), and ~QWSWindowSurface().