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

#include <qwaylandglwindowsurface.h>

Inheritance diagram for QWaylandGLWindowSurface:
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...
 
 QWaylandGLWindowSurface (QWidget *window)
 
void resize (const QSize &size)
 
 ~QWaylandGLWindowSurface ()
 
- 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

QWaylandDisplaymDisplay
 
QGLFramebufferObjectmPaintDevice
 

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 51 of file qwaylandglwindowsurface.h.

Constructors and Destructors

◆ QWaylandGLWindowSurface()

QWaylandGLWindowSurface::QWaylandGLWindowSurface ( QWidget window)

Definition at line 136 of file qwaylandglwindowsurface.cpp.

137  : QWindowSurface(window)
139  , mPaintDevice(0)
140 {
141 
142 }
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
QGLFramebufferObject * mPaintDevice
QWindowSurface(QWidget *window, bool setDefaultSurface=true)
Constructs an empty surface for the given top-level window.
static QWaylandScreen * waylandScreenFromWidget(QWidget *widget)

◆ ~QWaylandGLWindowSurface()

QWaylandGLWindowSurface::~QWaylandGLWindowSurface ( )

Definition at line 144 of file qwaylandglwindowsurface.cpp.

145 {
146  delete mPaintDevice;
147 }
QGLFramebufferObject * mPaintDevice

Functions

◆ beginPaint()

void QWaylandGLWindowSurface::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 154 of file qwaylandglwindowsurface.cpp.

155 {
156  window()->platformWindow()->glContext()->makeCurrent();
157  glClearColor(0,0,0,0xff);
158  glClear(GL_COLOR_BUFFER_BIT);
159 }
#define GL_COLOR_BUFFER_BIT
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.

◆ flush()

void QWaylandGLWindowSurface::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 161 of file qwaylandglwindowsurface.cpp.

162 {
163  Q_UNUSED(offset);
164  Q_UNUSED(region);
165  QWaylandWindow *ww = (QWaylandWindow *) widget->platformWindow();
166 
167  if (mPaintDevice->isBound())
169 
170  QRect rect(0,0,size().width(),size().height());
171  QGLContext *ctx = QGLContext::fromPlatformGLContext(ww->glContext());
173  ww->glContext()->swapBuffers();
174 }
QSize size() const
Returns the size of the texture attached to this framebuffer object.
GLuint texture() const
Returns the texture id for the texture attached as the default rendering target in this framebuffer o...
QRect rect(const QWidget *widget) const
Returns the rectangle for widget in the coordinates of this window surface.
static void blitTexture(QGLContext *ctx, GLuint texture, const QSize &viewport, const QSize &texSize, const QRect &targetRect, const QRect &sourceRect)
QGLFramebufferObject * mPaintDevice
virtual void swapBuffers()=0
Reimplement in subclass to native swap buffers calls.
The QGLContext class encapsulates an OpenGL rendering context.
Definition: qgl.h:310
virtual QPlatformGLContext * glContext() const
Reimplement to return the glContext associated with the window.
#define ctx
Definition: qgl.cpp:6094
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
bool release()
Switches rendering back to the default, windowing system provided framebuffer.
bool isBound() const
Returns true if the framebuffer object is currently bound to a context, otherwise false is returned...
#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

◆ paintDevice()

QPaintDevice * QWaylandGLWindowSurface::paintDevice ( )
virtual

Implement this function to return the appropriate paint device.

Implements QWindowSurface.

Definition at line 149 of file qwaylandglwindowsurface.cpp.

150 {
151  return mPaintDevice;
152 }
QGLFramebufferObject * mPaintDevice

◆ resize()

void QWaylandGLWindowSurface::resize ( const QSize size)

Definition at line 176 of file qwaylandglwindowsurface.cpp.

177 {
178  QWindowSurface::resize(size);
179  window()->platformWindow()->glContext()->makeCurrent();
180  delete mPaintDevice;
182 }
The QGLFramebufferObject class encapsulates an OpenGL framebuffer object.
QGLFramebufferObject * mPaintDevice
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.

Properties

◆ mDisplay

QWaylandDisplay* QWaylandGLWindowSurface::mDisplay
private

Definition at line 65 of file qwaylandglwindowsurface.h.

◆ mPaintDevice

QGLFramebufferObject* QWaylandGLWindowSurface::mPaintDevice
private

Definition at line 66 of file qwaylandglwindowsurface.h.

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


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