summaryrefslogtreecommitdiffstats
path: root/src/hardwareintegration
diff options
context:
space:
mode:
authorGiulio Camuffo <giulio.camuffo@jollamobile.com>2014-05-21 13:02:03 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-21 12:33:11 +0200
commit813af13f665de9655f74830a99ab7ed45ebc9865 (patch)
tree5116de66bcd62080f04c2ccbf36dd32dceec68a6 /src/hardwareintegration
parent9550e25c2b0dc152b378635f9515a04a5234672b (diff)
Don't create an invalidated surface when not needed
After invalidateSurface() is called we don't want to recreate the EGLSurface on setGeometry() until makeCurrent is called Change-Id: Ide10ecf3bff40a01fa1ed249986a631c77c2bf63 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/hardwareintegration')
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp12
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h2
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp2
3 files changed, 10 insertions, 6 deletions
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
index fc7aca384..7cdbdf893 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
@@ -64,7 +64,7 @@ QWaylandEglWindow::QWaylandEglWindow(QWindow *window)
, m_resize(false)
, m_format(q_glFormatFromConfig(m_clientBufferIntegration->eglDisplay(), m_eglConfig))
{
- create();
+ updateSurface(true);
}
QWaylandEglWindow::~QWaylandEglWindow()
@@ -87,10 +87,14 @@ QWaylandWindow::WindowType QWaylandEglWindow::windowType() const
void QWaylandEglWindow::setGeometry(const QRect &rect)
{
QWaylandWindow::setGeometry(rect);
- create();
+ // If the surface was invalidated through invalidateSurface() and
+ // we're now getting a resize we don't want to create it again.
+ // Just resize the wl_egl_window, the EGLSurface will be created
+ // the next time makeCurrent is called.
+ updateSurface(false);
}
-void QWaylandEglWindow::create()
+void QWaylandEglWindow::updateSurface(bool create)
{
createDecoration();
QMargins margins = frameMargins();
@@ -125,7 +129,7 @@ void QWaylandEglWindow::create()
m_waylandEglWindow = wl_egl_window_create(object(), sizeWithMargins.width(), sizeWithMargins.height());
}
- if (!m_eglSurface) {
+ if (!m_eglSurface && create) {
EGLNativeWindowType eglw = (EGLNativeWindowType) m_waylandEglWindow;
m_eglSurface = eglCreateWindowSurface(m_clientBufferIntegration->eglDisplay(), m_eglConfig, eglw, 0);
}
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h
index 6c6c77e09..298dd7d25 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.h
@@ -58,7 +58,7 @@ public:
~QWaylandEglWindow();
WindowType windowType() const;
- void create();
+ void updateSurface(bool create);
virtual void setGeometry(const QRect &rect);
QRect contentsRect() const;
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
index 5e62c9fa8..dffd812c7 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
@@ -114,7 +114,7 @@ bool QWaylandGLContext::makeCurrent(QPlatformSurface *surface)
EGLSurface eglSurface = window->eglSurface();
if (!eglSurface) {
- window->create();
+ window->updateSurface(true);
eglSurface = window->eglSurface();
}
if (!eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context)) {