43 #include <QtCore/qdebug.h> 44 #include <QtGui/private/qapplication_p.h> 50 #include <wayland-client.h> 61 int stride = size.
width() * 4;
62 int alloc = stride * size.
height();
63 char filename[] =
"/tmp/wayland-shm-XXXXXX";
64 int fd = mkstemp(filename);
67 if (ftruncate(fd, alloc) < 0) {
73 mmap(NULL, alloc, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
124 for (
int i = 0; i < rects.size(); i++) {
127 waylandWindow->
damage(rect);
136 QWindowSurface::resize(size);
Format
The following image formats are available in Qt.
#define QT_END_NAMESPACE
This macro expands to.
QPointer< QWidget > widget
QRect rect(const QWidget *widget) const
Returns the rectangle for widget in the coordinates of this window surface.
QWaylandShmBuffer * mBuffer
struct wl_visual * argbVisual()
int byteCount() const
Returns the number of bytes occupied by the image data.
int width() const
Returns the width of the rectangle.
virtual QPoint offset(const QWidget *widget) const
Returns the offset of widget in the coordinates of this window surface.
int height() const
Returns the height of the rectangle.
QWaylandShmBuffer(QWaylandDisplay *display, const QSize &size, QImage::Format format)
void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset)
Flushes the given region from the specified widget onto the screen.
int width() const
Returns the width.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Q_GUI_EXPORT EGLDisplay display()
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
static const char * data(const QByteArray &arr)
The QRegion class specifies a clip region for a painter.
WindowType windowType() const
const uchar * constBits() const
Returns a pointer to the first pixel data.
void attach(QWaylandBuffer *buffer)
The QWindowSurface class provides the drawing area for top-level windows.
QPaintDevice * paintDevice()
Implement this function to return the appropriate paint device.
void resize(const QSize &size)
int y() const
Returns the y-coordinate of the rectangle's top edge.
int x() const
Returns the x-coordinate of the rectangle's left edge.
The QPoint class defines a point in the plane using integer precision.
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
QWaylandShmWindowSurface(QWidget *window)
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
QWaylandDisplay * mDisplay
~QWaylandShmWindowSurface()
struct wl_buffer * mBuffer
The QSize class defines the size of a two-dimensional object using integer point precision.
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...
void beginPaint(const QRegion &)
This function is called before painting onto the surface begins, with the region in which the paintin...
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.
struct wl_buffer * createShmBuffer(int fd, int width, int height, uint32_t stride, struct wl_visual *visual)