summaryrefslogtreecommitdiffstats
path: root/src/openvg
diff options
context:
space:
mode:
authorJason Barron <jason.barron@nokia.com>2010-09-27 08:54:38 (GMT)
committerJason Barron <jason.barron@nokia.com>2010-10-07 07:22:26 (GMT)
commit83567e2dd93ad46cff2b3b611e298148e7d60f62 (patch)
tree068f9c89a35502d5f473b28c565215305a3edf84 /src/openvg
parent45134e5dda238e42b89a407464911ac05f214cac (diff)
downloadQt-83567e2dd93ad46cff2b3b611e298148e7d60f62.zip
Qt-83567e2dd93ad46cff2b3b611e298148e7d60f62.tar.gz
Qt-83567e2dd93ad46cff2b3b611e298148e7d60f62.tar.bz2
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')
-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 e3f52f4e..37e5f40 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");
}
}