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

#include <shivavgwindowsurface.h>

Inheritance diagram for ShivaVGWindowSurface:
QWindowSurface QPaintDevice

Public Functions

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...
 
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...
 
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...
 
QPaintEnginepaintEngine () const
 
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 setGeometry (const QRect &rect)
 Sets the currently allocated area to be the given rect. More...
 
 ShivaVGWindowSurface (QWidget *window)
 
virtual ~ShivaVGWindowSurface ()
 
- 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 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...
 
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...
 
- Public Functions inherited from QPaintDevice
int colorCount () const
 
int depth () const
 
virtual int devType () const
 
virtual HDC getDC () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
QT_DEPRECATED int numColors () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
virtual void releaseDC (HDC hdc) const
 
int width () const
 
int widthMM () const
 
virtual ~QPaintDevice ()
 

Protected Functions

int metric (PaintDeviceMetric metric) const
 
- Protected Functions inherited from QWindowSurface
bool hasStaticContents () const
 
- Protected Functions inherited from QPaintDevice
 QPaintDevice ()
 

Properties

ShivaVGWindowSurfacePrivated_ptr
 

Additional Inherited Members

- Public Types inherited from QWindowSurface
enum  WindowSurfaceFeature { PartialUpdates = 0x00000001, PreservedContents = 0x00000002, StaticContents = 0x00000004, AllFeatures = 0xffffffff }
 
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric {
  PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM,
  PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY,
  PdmPhysicalDpiX, PdmPhysicalDpiY
}
 
- Static Public Functions inherited from QPaintDevice
static QWSDisplayqwsDisplay ()
 
- Protected Variables inherited from QPaintDevice
ushort painters
 

Detailed Description

Definition at line 51 of file shivavgwindowsurface.h.

Constructors and Destructors

◆ ShivaVGWindowSurface()

ShivaVGWindowSurface::ShivaVGWindowSurface ( QWidget window)

Definition at line 252 of file shivavgwindowsurface.cpp.

254 {
255 }
QWindowSurface(QWidget *window, bool setDefaultSurface=true)
Constructs an empty surface for the given top-level window.
ShivaVGWindowSurfacePrivate * d_ptr

◆ ~ShivaVGWindowSurface()

ShivaVGWindowSurface::~ShivaVGWindowSurface ( )
virtual

Definition at line 257 of file shivavgwindowsurface.cpp.

258 {
259  if (d_ptr->isCurrent) {
260  shivaContext()->doneCurrent();
261  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
262  }
263 #if defined(Q_WS_X11)
264  if (d_ptr->context)
265  glXDestroyContext(X11->display, d_ptr->context);
266 #endif
267  delete d_ptr;
268 }
#define GL_FRAMEBUFFER_EXT
#define X11
Definition: qt_x11_p.h:724
ShivaVGWindowSurfacePrivate * d_ptr

Functions

◆ beginPaint()

void ShivaVGWindowSurface::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 332 of file shivavgwindowsurface.cpp.

333 {
334  // Nothing to do here.
335  Q_UNUSED(region);
336 }
#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

◆ endPaint()

void ShivaVGWindowSurface::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 338 of file shivavgwindowsurface.cpp.

339 {
340  // Nothing to do here.
341  Q_UNUSED(region);
342 }
#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

◆ flush()

void ShivaVGWindowSurface::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 279 of file shivavgwindowsurface.cpp.

280 {
281  Q_UNUSED(region);
282  Q_UNUSED(offset);
283  QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget();
284  d_ptr->ensureContext(parent);
285  QShivaContext *context = shivaContext();
286  if (!d_ptr->isCurrent)
287  context->makeCurrent(d_ptr);
288 #if defined(QVG_USE_FBO)
289  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
290  if (d_ptr->fbo) {
291  static GLfloat const vertices[][2] = {
292  {-1, -1}, {1, -1}, {1, 1}, {-1, 1}
293  };
294  static GLfloat const texCoords[][2] = {
295  {0, 0}, {1, 0}, {1, 1}, {0, 1}
296  };
297  glMatrixMode(GL_PROJECTION);
298  glLoadIdentity();
299  glMatrixMode(GL_MODELVIEW);
300  glLoadIdentity();
301  glVertexPointer(2, GL_FLOAT, 0, vertices);
302  glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
303  glBindTexture(GL_TEXTURE_2D, d_ptr->texture);
304  glEnable(GL_TEXTURE_2D);
305  glEnableClientState(GL_VERTEX_ARRAY);
306  glEnableClientState(GL_TEXTURE_COORD_ARRAY);
307  glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
308  glDisableClientState(GL_TEXTURE_COORD_ARRAY);
309  glDisableClientState(GL_VERTEX_ARRAY);
310  glDisable(GL_TEXTURE_2D);
311  glBindTexture(GL_TEXTURE_2D, 0);
312  }
313 #endif
314 #if defined(Q_WS_X11)
315  glXSwapBuffers(X11->display, d_ptr->drawable);
316 #endif
317  context->doneCurrent();
318 }
QPointer< QWidget > widget
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define GL_FRAMEBUFFER_EXT
#define X11
Definition: qt_x11_p.h:724
#define GL_TEXTURE_2D
bool makeCurrent(ShivaVGWindowSurfacePrivate *surface)
QWidget * nativeParentWidget() const
Returns the native parent for this widget, i.
Definition: qwidget.cpp:4514
#define GL_TRIANGLE_FAN
#define GL_FLOAT
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
void ensureContext(QWidget *widget)
#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
ShivaVGWindowSurfacePrivate * d_ptr

◆ metric()

int ShivaVGWindowSurface::metric ( PaintDeviceMetric  metric) const
protectedvirtual

Reimplemented from QPaintDevice.

Definition at line 353 of file shivavgwindowsurface.cpp.

354 {
355  return qt_paint_device_metric(window(), met);
356 }
friend Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, PaintDeviceMetric metric)
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.

◆ paintDevice()

QPaintDevice * ShivaVGWindowSurface::paintDevice ( )
virtual

Implement this function to return the appropriate paint device.

Implements QWindowSurface.

Definition at line 270 of file shivavgwindowsurface.cpp.

271 {
273  shivaContext()->makeCurrent(d_ptr);
274  glClearDepth(0.0f);
276  return this;
277 }
#define GL_STENCIL_BUFFER_BIT
#define GL_DEPTH_BUFFER_BIT
void ensureContext(QWidget *widget)
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.
ShivaVGWindowSurfacePrivate * d_ptr

◆ paintEngine()

QPaintEngine * ShivaVGWindowSurface::paintEngine ( ) const
virtual

Implements QPaintDevice.

Definition at line 346 of file shivavgwindowsurface.cpp.

347 {
348  if (!d_ptr->engine)
349  d_ptr->engine = sharedPaintEngine();
350  return d_ptr->engine;
351 }
ShivaVGWindowSurfacePrivate * d_ptr

◆ scroll()

bool ShivaVGWindowSurface::scroll ( const QRegion area,
int  dx,
int  dy 
)
virtual

Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative.

Returns true if the area was scrolled successfully; false otherwise.

Reimplemented from QWindowSurface.

Definition at line 327 of file shivavgwindowsurface.cpp.

328 {
329  return QWindowSurface::scroll(area, dx, dy);
330 }
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...

◆ setGeometry()

void ShivaVGWindowSurface::setGeometry ( const QRect rect)
virtual

Sets the currently allocated area to be the given rect.

This function is called whenever area covered by the top-level window changes.

See also
geometry()

Reimplemented from QWindowSurface.

Definition at line 320 of file shivavgwindowsurface.cpp.

321 {
323  d_ptr->needsResize = true;
324  d_ptr->size = rect.size();
325 }
virtual void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
ShivaVGWindowSurfacePrivate * d_ptr

Properties

◆ d_ptr

ShivaVGWindowSurfacePrivate* ShivaVGWindowSurface::d_ptr
private

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