, platformGLContext(0)
, shareContext(0)
, screen(0)
+ , surface(0)
{
}
QPlatformGLContext *platformGLContext;
QGuiGLContext *shareContext;
QScreen *screen;
+ QSurface *surface;
static void setCurrentContext(QGuiGLContext *context);
};
if (d->platformGLContext->makeCurrent(surface->surfaceHandle())) {
QGuiGLContextPrivate::setCurrentContext(this);
+ d->surface = surface;
return true;
}
d->platformGLContext->doneCurrent();
QGuiGLContextPrivate::setCurrentContext(0);
+
+ d->surface = 0;
+}
+
+/*!
+ Returns the surface the context is current for.
+*/
+QSurface *QGuiGLContext::surface() const
+{
+ Q_D(const QGuiGLContext);
+ return d->surface;
}
+
void QGuiGLContext::swapBuffers(QSurface *surface)
{
Q_D(QGuiGLContext);
void swapBuffers(QSurface *surface);
void (*getProcAddress(const QByteArray &procName)) ();
+ QSurface *surface() const;
+
static QGuiGLContext *currentContext();
QPlatformGLContext *handle() const;
return;
const QGLContext *ctx = QGLContext::currentContext();
- if (!ctx)
+ if (!ctx || !ctx->contextHandle())
return;
- const int height = ctx->device()->height();
+ QSurface *surface = ctx->contextHandle()->surface();
+
+ const int height = static_cast<QWindow *>(surface)->height();
const int sh = source ? source->height() : height;
const int th = target ? target->height() : height;