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

#include <qbbglwindowsurface.h>

Inheritance diagram for QBBGLWindowSurface:
QWindowSurface

Public Functions

virtual void beginPaint (const QRegion &region)
 This function is called before painting onto the surface begins, with the region in which the painting will occur. More...
 
virtual void endPaint (const QRegion &region)
 This function is called after painting onto the surface has ended, with the region in which the painting was performed. More...
 
virtual QWindowSurface::WindowSurfaceFeatures features () const
 
virtual void flush (QWidget *widget, const QRegion &region, const QPoint &offset)
 Flushes the given region from the specified widget onto the screen. More...
 
virtual QPaintDevicepaintDevice ()
 Implement this function to return the appropriate paint device. More...
 
 QBBGLWindowSurface (QWidget *window)
 
virtual void resize (const QSize &size)
 
virtual ~QBBGLWindowSurface ()
 
- 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...
 
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

QBBGLPaintDevicemPaintDevice
 
QBBGLContextmPlatformGlContext
 

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 71 of file qbbglwindowsurface.h.

Constructors and Destructors

◆ QBBGLWindowSurface()

QBBGLWindowSurface::QBBGLWindowSurface ( QWidget window)

Definition at line 83 of file qbbglwindowsurface.cpp.

84  : QWindowSurface(window)
85 {
86 #if defined(QBBGLWINDOWSURFACE_DEBUG)
87  qDebug() << "QBBGLWindowSurface::QBBGLWindowSurface - w=" << window;
88 #endif
89 
90  // extract GL context associated with window
91  mPlatformGlContext = static_cast<QBBGLContext*>(window->platformWindow()->glContext());
92 
93  // create an OpenGL paint device
95 }
Q_CORE_EXPORT void qDebug(const char *,...)
QBBGLPaintDevice * mPaintDevice
QWindowSurface(QWidget *window, bool setDefaultSurface=true)
Constructs an empty surface for the given top-level window.
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.
QBBGLContext * mPlatformGlContext

◆ ~QBBGLWindowSurface()

QBBGLWindowSurface::~QBBGLWindowSurface ( )
virtual

Definition at line 97 of file qbbglwindowsurface.cpp.

98 {
99 #if defined(QBBGLWINDOWSURFACE_DEBUG)
100  qDebug() << "QBBGLWindowSurface::~QBBGLWindowSurface - w=" << window();
101 #endif
102 
103  // cleanup OpenGL paint device
104  delete mPaintDevice;
105 }
Q_CORE_EXPORT void qDebug(const char *,...)
QBBGLPaintDevice * mPaintDevice
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.

Functions

◆ beginPaint()

void QBBGLWindowSurface::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 134 of file qbbglwindowsurface.cpp.

135 {
136  Q_UNUSED(region);
137 
138 #if defined(QBBGLWINDOWSURFACE_DEBUG)
139  qDebug() << "QBBGLWindowSurface::beginPaint - w=" << window();
140 #endif
141 
142  // resize EGL surface if window surface resized
143  QSize s = size();
144  if (s != mPlatformGlContext->surfaceSize()) {
146  }
147 }
QSize surfaceSize() const
Definition: qbbglcontext.h:72
Q_CORE_EXPORT void qDebug(const char *,...)
void resizeSurface(const QSize &size)
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
#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.
QBBGLContext * mPlatformGlContext

◆ endPaint()

void QBBGLWindowSurface::endPaint ( const QRegion region)
virtual

This function is called after painting onto the surface has ended, with the region in which the painting was performed.

See also
beginPaint(), paintDevice()

Reimplemented from QWindowSurface.

Definition at line 149 of file qbbglwindowsurface.cpp.

150 {
151  Q_UNUSED(region);
152 #if defined(QBBGLWINDOWSURFACE_DEBUG)
153  qDebug() << "QBBGLWindowSurface::endPaint - w=" << window();
154 #endif
155 }
Q_CORE_EXPORT void qDebug(const char *,...)
#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.

◆ features()

QWindowSurface::WindowSurfaceFeatures QBBGLWindowSurface::features ( ) const
virtual

Reimplemented from QWindowSurface.

Definition at line 157 of file qbbglwindowsurface.cpp.

158 {
159  // force full frame updates on every paint
160  return 0;
161 }

◆ flush()

void QBBGLWindowSurface::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 107 of file qbbglwindowsurface.cpp.

108 {
109  Q_UNUSED(widget);
110  Q_UNUSED(region);
111  Q_UNUSED(offset);
112 
113 #if defined(QBBGLWINDOWSURFACE_DEBUG)
114  qDebug() << "QBBGLWindowSurface::flush - w=" << window();
115 #endif
116 
117  // update the display with newly rendered content
119 }
virtual void swapBuffers()
Reimplement in subclass to native swap buffers calls.
Q_CORE_EXPORT void qDebug(const char *,...)
#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.
QBBGLContext * mPlatformGlContext

◆ paintDevice()

virtual QPaintDevice* QBBGLWindowSurface::paintDevice ( )
inlinevirtual

Implement this function to return the appropriate paint device.

Implements QWindowSurface.

Definition at line 77 of file qbbglwindowsurface.h.

77 { return mPaintDevice; }
QBBGLPaintDevice * mPaintDevice

◆ resize()

void QBBGLWindowSurface::resize ( const QSize size)
virtual

Definition at line 121 of file qbbglwindowsurface.cpp.

122 {
123 #if defined(QBBGLWINDOWSURFACE_DEBUG)
124  qDebug() << "QBBGLWindowSurface::resize - w=" << window() << ", s=" << size;
125 #endif
126 
127  // call parent method
128  QWindowSurface::resize(size);
129 
130  // NOTE: defer resizing window buffers until next paint as
131  // resize() can be called multiple times before a paint occurs
132 }
Q_CORE_EXPORT void qDebug(const char *,...)
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.

Properties

◆ mPaintDevice

QBBGLPaintDevice* QBBGLWindowSurface::mPaintDevice
private

Definition at line 87 of file qbbglwindowsurface.h.

Referenced by QBBGLWindowSurface(), and ~QBBGLWindowSurface().

◆ mPlatformGlContext

QBBGLContext* QBBGLWindowSurface::mPlatformGlContext
private

Definition at line 86 of file qbbglwindowsurface.h.

Referenced by beginPaint(), flush(), and QBBGLWindowSurface().


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