summaryrefslogtreecommitdiffstats
path: root/src/openvg/qwindowsurface_vgegl.cpp
diff options
context:
space:
mode:
authorJason Barron <jason.barron@nokia.com>2010-09-27 10:54:38 +0200
committerJason Barron <jason.barron@nokia.com>2010-10-07 09:22:26 +0200
commit83567e2dd93ad46cff2b3b611e298148e7d60f62 (patch)
tree068f9c89a35502d5f473b28c565215305a3edf84 /src/openvg/qwindowsurface_vgegl.cpp
parent45134e5dda238e42b89a407464911ac05f214cac (diff)
Minor OpenVG optimization when setting the EGL surface attribute.
Calling eglGetError() is expensive so we should avoid doing it unless we know there actually is an error. The function returns EGL_FALSE upon error so we can test for that instead of using eglGetError(). Reviewed-by: Jani Hautakangas
Diffstat (limited to 'src/openvg/qwindowsurface_vgegl.cpp')
-rw-r--r--src/openvg/qwindowsurface_vgegl.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp
index e3f52f4ee5..37e5f40be1 100644
--- a/src/openvg/qwindowsurface_vgegl.cpp
+++ b/src/openvg/qwindowsurface_vgegl.cpp
@@ -709,10 +709,9 @@ QEglContext *QVGEGLWindowSurfaceDirect::ensureContext(QWidget *widget)
#if !defined(QVG_NO_PRESERVED_SWAP)
// Try to force the surface back buffer to preserve its contents.
if (needToSwap) {
- eglGetError(); // Clear error state first.
- eglSurfaceAttrib(QEgl::display(), windowSurface,
+ bool succeeded = eglSurfaceAttrib(QEgl::display(), windowSurface,
EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
- if (eglGetError() != EGL_SUCCESS) {
+ if (!succeeded && eglGetError() != EGL_SUCCESS) {
qWarning("QVG: could not enable preserved swap");
}
}