Qt 4.8
Public Functions | Public Variables | List of all members
QShivaContext Class Reference

Public Functions

void doneCurrent ()
 
bool makeCurrent (ShivaVGWindowSurfacePrivate *surface)
 
 QShivaContext ()
 
 ~QShivaContext ()
 

Public Variables

QSize currentSize
 
ShivaVGWindowSurfacePrivatecurrentSurface
 
bool initialized
 

Detailed Description

Definition at line 60 of file shivavgwindowsurface.cpp.

Constructors and Destructors

◆ QShivaContext()

QShivaContext::QShivaContext ( )

Definition at line 111 of file shivavgwindowsurface.cpp.

112  : initialized(false)
113  , currentSurface(0)
114 {
115 }
ShivaVGWindowSurfacePrivate * currentSurface

◆ ~QShivaContext()

QShivaContext::~QShivaContext ( )

Definition at line 117 of file shivavgwindowsurface.cpp.

118 {
119  if (initialized)
120  vgDestroyContextSH();
121 }

Functions

◆ doneCurrent()

void QShivaContext::doneCurrent ( )

Definition at line 151 of file shivavgwindowsurface.cpp.

Referenced by ShivaVGWindowSurface::flush().

152 {
153  if (currentSurface) {
154  currentSurface->isCurrent = false;
155  currentSurface = 0;
156  }
157 #if defined(Q_WS_X11)
158  glXMakeCurrent(X11->display, 0, 0);
159 #endif
160 }
#define X11
Definition: qt_x11_p.h:724
ShivaVGWindowSurfacePrivate * currentSurface

◆ makeCurrent()

bool QShivaContext::makeCurrent ( ShivaVGWindowSurfacePrivate surface)

Definition at line 123 of file shivavgwindowsurface.cpp.

Referenced by ShivaVGWindowSurface::flush().

124 {
125  if (currentSurface)
126  currentSurface->isCurrent = false;
127  surface->isCurrent = true;
128  currentSurface = surface;
129  currentSize = surface->size;
130 #if defined(Q_WS_X11)
131  glXMakeCurrent(X11->display, surface->drawable, surface->context);
132 #endif
133  if (!initialized) {
134  if (!vgCreateContextSH(currentSize.width(), currentSize.height())) {
135  qWarning("vgCreateContextSH(%d, %d): could not create context", currentSize.width(), currentSize.height());
136  return false;
137  }
138  initialized = true;
139  } else {
140  vgResizeSurfaceSH(currentSize.width(), currentSize.height());
141  }
142 #if defined(QVG_USE_FBO)
143  if (surface->fbo)
144  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, surface->fbo);
145  else
146  glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
147 #endif
148  return true;
149 }
#define GL_FRAMEBUFFER_EXT
#define X11
Definition: qt_x11_p.h:724
int width() const
Returns the width.
Definition: qsize.h:126
ShivaVGWindowSurfacePrivate * currentSurface
Q_CORE_EXPORT void qWarning(const char *,...)
int height() const
Returns the height.
Definition: qsize.h:129

Properties

◆ currentSize

QSize QShivaContext::currentSize

Definition at line 70 of file shivavgwindowsurface.cpp.

Referenced by makeCurrent().

◆ currentSurface

ShivaVGWindowSurfacePrivate* QShivaContext::currentSurface

Definition at line 71 of file shivavgwindowsurface.cpp.

Referenced by doneCurrent(), and makeCurrent().

◆ initialized

bool QShivaContext::initialized

Definition at line 69 of file shivavgwindowsurface.cpp.

Referenced by makeCurrent(), and ~QShivaContext().


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