diff options
Diffstat (limited to 'src/opengl/qwindowsurface_gl.cpp')
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index cdd234a..47f36dd 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -314,7 +314,7 @@ QPaintEngine *QGLWindowSurfaceGLPaintDevice::paintEngine() const QGLWindowSurface::QGLWindowSurface(QWidget *window) : QWindowSurface(window), d_ptr(new QGLWindowSurfacePrivate) { - Q_ASSERT(window->isTopLevel()); +// Q_ASSERT(window->isTopLevel()); d_ptr->pb = 0; d_ptr->fbo = 0; d_ptr->ctx = 0; @@ -397,6 +397,8 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) setPartialUpdateSupport(false); // Force full-screen updates else setPartialUpdateSupport(true); +#else + setPartialUpdateSupport(false); #endif widgetPrivate->extraData()->glContext = ctx; @@ -505,8 +507,13 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); Q_ASSERT(parent); +#if !defined(Q_WS_QPA) if (!geometry().isValid()) return; +#else + if (!size().isValid()) + return; +#endif // Needed to support native child-widgets... hijackWindow(parent); @@ -728,19 +735,31 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & } +#if !defined(Q_WS_QPA) void QGLWindowSurface::setGeometry(const QRect &rect) { QWindowSurface::setGeometry(rect); d_ptr->geometry_updated = true; } - +#else +void QGLWindowSurface::resize(const QSize &size) +{ + QWindowSurface::resize(size); + d_ptr->geometry_updated = true; +} +#endif void QGLWindowSurface::updateGeometry() { if (!d_ptr->geometry_updated) return; d_ptr->geometry_updated = false; - QRect rect = geometry(); +#ifdef Q_WS_QPA + QSize surfSize = size(); +#else + QSize surfSize = geometry().size(); +#endif + hijackWindow(window()); QGLContext *ctx = reinterpret_cast<QGLContext *>(window()->d_func()->extraData()->glContext); @@ -750,18 +769,18 @@ void QGLWindowSurface::updateGeometry() { const GLenum target = GL_TEXTURE_2D; - if (rect.width() <= 0 || rect.height() <= 0) + if (surfSize.width() <= 0 || surfSize.height() <= 0) return; - if (d_ptr->size == rect.size()) + if (d_ptr->size == surfSize) return; - d_ptr->size = rect.size(); + d_ptr->size = surfSize; if (d_ptr->ctx) { #ifndef QT_OPENGL_ES_2 if (d_ptr->destructive_swap_buffers) - initializeOffscreenTexture(rect.size()); + initializeOffscreenTexture(surfSize); #endif return; } @@ -784,10 +803,10 @@ void QGLWindowSurface::updateGeometry() { if (QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit) format.setSamples(8); - d_ptr->fbo = new QGLFramebufferObject(rect.size(), format); + d_ptr->fbo = new QGLFramebufferObject(surfSize, format); if (d_ptr->fbo->isValid()) { - qDebug() << "Created Window Surface FBO" << rect.size() + qDebug() << "Created Window Surface FBO" << surfSize << "with samples" << d_ptr->fbo->format().samples(); return; } else { @@ -808,7 +827,7 @@ void QGLWindowSurface::updateGeometry() { delete d_ptr->pb; - d_ptr->pb = new QGLPixelBuffer(rect.width(), rect.height(), + d_ptr->pb = new QGLPixelBuffer(surfSize.width(), surfSize.height(), QGLFormat(QGL::SampleBuffers | QGL::StencilBuffer | QGL::DepthBuffer), qt_gl_share_widget()); @@ -818,7 +837,7 @@ void QGLWindowSurface::updateGeometry() { glGenTextures(1, &d_ptr->pb_tex_id); glBindTexture(target, d_ptr->pb_tex_id); - glTexImage2D(target, 0, GL_RGBA, rect.width(), rect.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); + glTexImage2D(target, 0, GL_RGBA, surfSize.width(), surfSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); @@ -842,7 +861,7 @@ void QGLWindowSurface::updateGeometry() { #ifndef QT_OPENGL_ES_2 if (d_ptr->destructive_swap_buffers) - initializeOffscreenTexture(rect.size()); + initializeOffscreenTexture(surfSize); #endif qDebug() << "QGLWindowSurface: Using plain widget as window surface" << this;; |