Qt 4.8
Public Functions | Properties | List of all members
QWaylandShmWindowSurface Class Reference

#include <qwaylandshmsurface.h>

Inheritance diagram for QWaylandShmWindowSurface:
QWindowSurface

Public Functions

void beginPaint (const QRegion &)
 This function is called before painting onto the surface begins, with the region in which the painting will occur. More...
 
void flush (QWidget *widget, const QRegion &region, const QPoint &offset)
 Flushes the given region from the specified widget onto the screen. More...
 
QPaintDevicepaintDevice ()
 Implement this function to return the appropriate paint device. More...
 
 QWaylandShmWindowSurface (QWidget *window)
 
void resize (const QSize &size)
 
 ~QWaylandShmWindowSurface ()
 
- Public Functions inherited from QWindowSurface
virtual QImagebuffer (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 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 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...
 
virtual void setGeometry (const QRect &rect)
 Sets the currently allocated area to be the given rect. More...
 
void setStaticContents (const QRegion &region)
 
QRegion staticContents () const
 
QWidgetwindow () const
 Returns a pointer to the top-level window associated with this surface. More...
 
virtual ~QWindowSurface ()
 Destroys this surface. More...
 

Properties

QWaylandShmBuffermBuffer
 
QWaylandDisplaymDisplay
 

Additional Inherited Members

- Public Types inherited from QWindowSurface
enum  WindowSurfaceFeature { PartialUpdates = 0x00000001, PreservedContents = 0x00000002, StaticContents = 0x00000004, AllFeatures = 0xffffffff }
 
- Protected Functions inherited from QWindowSurface
bool hasStaticContents () const
 

Detailed Description

Definition at line 65 of file qwaylandshmsurface.h.

Constructors and Destructors

◆ QWaylandShmWindowSurface()

QWaylandShmWindowSurface::QWaylandShmWindowSurface ( QWidget window)

Definition at line 94 of file qwaylandshmsurface.cpp.

95  : QWindowSurface(window)
96  , mBuffer(0)
98 {
99 }
QWaylandShmBuffer * mBuffer
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
QWindowSurface(QWidget *window, bool setDefaultSurface=true)
Constructs an empty surface for the given top-level window.
QWaylandDisplay * mDisplay
static QWaylandScreen * waylandScreenFromWidget(QWidget *widget)

◆ ~QWaylandShmWindowSurface()

QWaylandShmWindowSurface::~QWaylandShmWindowSurface ( )

Definition at line 101 of file qwaylandshmsurface.cpp.

102 {
103 }

Functions

◆ beginPaint()

void QWaylandShmWindowSurface::beginPaint ( const QRegion region)
virtual

This function is called before painting onto the surface begins, with the region in which the painting will occur.

See also
endPaint(), paintDevice()

Reimplemented from QWindowSurface.

Definition at line 110 of file qwaylandshmsurface.cpp.

111 {
112  QWaylandShmWindow *waylandWindow = static_cast<QWaylandShmWindow *>(window()->platformWindow());
113  Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm);
114  waylandWindow->waitForFrameSync();
115 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
WindowType windowType() const
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.

◆ flush()

void QWaylandShmWindowSurface::flush ( QWidget widget,
const QRegion region,
const QPoint offset 
)
virtual

Flushes the given region from the specified widget onto the screen.

Note that the offset parameter is currently unused.

Implements QWindowSurface.

Definition at line 117 of file qwaylandshmsurface.cpp.

118 {
119  Q_UNUSED(widget);
120  Q_UNUSED(offset);
121  QWaylandShmWindow *waylandWindow = static_cast<QWaylandShmWindow *>(window()->platformWindow());
122  Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm);
123  QVector<QRect> rects = region.rects();
124  for (int i = 0; i < rects.size(); i++) {
125  const QRect rect = rects.at(i);
126  wl_buffer_damage(mBuffer->buffer(),rect.x(),rect.y(),rect.width(),rect.height());
127  waylandWindow->damage(rect);
128  }
129 }
QRect rect(const QWidget *widget) const
Returns the rectangle for widget in the coordinates of this window surface.
QWaylandShmBuffer * mBuffer
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
WindowType windowType() const
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Definition: qregion.cpp:4412
wl_buffer * buffer()
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void damage(const QRect &rect)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.

◆ paintDevice()

QPaintDevice * QWaylandShmWindowSurface::paintDevice ( )
virtual

Implement this function to return the appropriate paint device.

Implements QWindowSurface.

Definition at line 105 of file qwaylandshmsurface.cpp.

106 {
107  return mBuffer->image();
108 }
QWaylandShmBuffer * mBuffer

◆ resize()

void QWaylandShmWindowSurface::resize ( const QSize size)

Definition at line 131 of file qwaylandshmsurface.cpp.

132 {
133  QWaylandShmWindow *waylandWindow = static_cast<QWaylandShmWindow *>(window()->platformWindow());
134  Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm);
135 
136  QWindowSurface::resize(size);
138 
139  if (mBuffer != NULL && mBuffer->size() == size)
140  return;
141 
142  if (mBuffer != NULL)
143  delete mBuffer;
144 
145  mBuffer = new QWaylandShmBuffer(mDisplay, size, format);
146 
147  waylandWindow->attach(mBuffer);
148 }
Format
The following image formats are available in Qt.
Definition: qimage.h:91
QWaylandShmBuffer * mBuffer
virtual QImage::Format format() const =0
Reimplement in subclass to return the image format which corresponds to the screen format...
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static QPlatformScreen * platformScreenForWidget(const QWidget *widget)
WindowType windowType() const
void attach(QWaylandBuffer *buffer)
QWaylandDisplay * mDisplay
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.

Properties

◆ mBuffer

QWaylandShmBuffer* QWaylandShmWindowSurface::mBuffer
private

Definition at line 77 of file qwaylandshmsurface.h.

Referenced by flush(), paintDevice(), and resize().

◆ mDisplay

QWaylandDisplay* QWaylandShmWindowSurface::mDisplay
private

Definition at line 78 of file qwaylandshmsurface.h.

Referenced by resize().


The documentation for this class was generated from the following files: