diff options
author | Andy Nichols <andy.nichols@qt.io> | 2016-12-07 14:14:31 +0100 |
---|---|---|
committer | Andy Nichols <andy.nichols@qt.io> | 2016-12-13 15:43:32 +0000 |
commit | 9fbc5aa8866bbc19cc0db9f5f247276f36f3e283 (patch) | |
tree | 058118c873d3cf922bed91ddc1c0aba30bb42632 /src/plugins/scenegraph/openvg/qopenvgoffscreensurface.cpp | |
parent | 4cdeeea8e2fd90b984c49edeb3765d2079487d79 (diff) |
OpenVG: Fix Recursive Layers
OpenVG also needed to ping-pong between two offscreen surfaces like the
OpenGL renderer.
Change-Id: I41f671d98d361eb114be5c00ebfe62710a971aaa
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/plugins/scenegraph/openvg/qopenvgoffscreensurface.cpp')
-rw-r--r-- | src/plugins/scenegraph/openvg/qopenvgoffscreensurface.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/scenegraph/openvg/qopenvgoffscreensurface.cpp b/src/plugins/scenegraph/openvg/qopenvgoffscreensurface.cpp index 3a4643ab5a..80af227fb4 100644 --- a/src/plugins/scenegraph/openvg/qopenvgoffscreensurface.cpp +++ b/src/plugins/scenegraph/openvg/qopenvgoffscreensurface.cpp @@ -39,6 +39,9 @@ #include "qopenvgoffscreensurface.h" +#include <QtGui/QImage> +#include <QDebug> + QT_BEGIN_NAMESPACE QOpenVGOffscreenSurface::QOpenVGOffscreenSurface(const QSize &size) @@ -79,6 +82,7 @@ QOpenVGOffscreenSurface::~QOpenVGOffscreenSurface() { vgDestroyImage(m_image); eglDestroySurface(m_display, m_renderTarget); + eglDestroyContext(m_display, m_context); } void QOpenVGOffscreenSurface::makeCurrent() @@ -98,7 +102,6 @@ void QOpenVGOffscreenSurface::doneCurrent() EGLContext currentContext = eglGetCurrentContext(); if (m_context == currentContext) { eglMakeCurrent(m_display, m_previousDrawSurface, m_previousReadSurface, m_previousContext); - m_context = EGL_NO_CONTEXT; m_previousContext = EGL_NO_CONTEXT; m_previousReadSurface = EGL_NO_SURFACE; m_previousDrawSurface = EGL_NO_SURFACE; @@ -110,4 +113,11 @@ void QOpenVGOffscreenSurface::swapBuffers() eglSwapBuffers(m_display, m_renderTarget); } +QImage QOpenVGOffscreenSurface::readbackQImage() +{ + QImage readbackImage(m_size, QImage::Format_ARGB32_Premultiplied); + vgGetImageSubData(m_image, readbackImage.bits(), readbackImage.bytesPerLine(), VG_sARGB_8888_PRE, 0, 0, m_size.width(), m_size.height()); + return readbackImage; +} + QT_END_NAMESPACE |