diff options
author | Giulio Camuffo <giulio.camuffo@jollamobile.com> | 2014-05-21 13:02:03 +0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-21 12:33:11 +0200 |
commit | 813af13f665de9655f74830a99ab7ed45ebc9865 (patch) | |
tree | 5116de66bcd62080f04c2ccbf36dd32dceec68a6 /src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp | |
parent | 9550e25c2b0dc152b378635f9515a04a5234672b (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/client/wayland-egl/qwaylandeglwindow.cpp')
-rw-r--r-- | src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp | 12 |
1 files changed, 8 insertions, 4 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); } |