diff options
-rw-r--r-- | doc/src/howtos/openvg.qdoc | 10 | ||||
-rw-r--r-- | doc/src/platforms/emb-openvg.qdocinc | 6 | ||||
-rw-r--r-- | src/openvg/openvg.pro | 2 | ||||
-rw-r--r-- | src/openvg/qwindowsurface_vg.cpp | 5 | ||||
-rw-r--r-- | src/openvg/qwindowsurface_vgegl.cpp | 27 | ||||
-rw-r--r-- | src/openvg/qwindowsurface_vgegl_p.h | 4 |
6 files changed, 52 insertions, 2 deletions
diff --git a/doc/src/howtos/openvg.qdoc b/doc/src/howtos/openvg.qdoc index 9c805bb..f70ed54 100644 --- a/doc/src/howtos/openvg.qdoc +++ b/doc/src/howtos/openvg.qdoc @@ -295,6 +295,16 @@ Convolution, colorize, drop shadow, and blur filters are accelerated using OpenVG operations. + \section2 Scrolling + + By default, accelerated scrolling is not enabled because the impact on + performance is very much tied to the hardware platform. To enable + accelerated scrolling, you should ensure that QVG_BUFFER_SCROLLING is + defined when compiling the QtOpenVG module. + + You should only enable this feature if vgCopyPixels() is known to be + efficient on your hardware platform. + \section1 Known issues Performance of copying the contents of an OpenVG-rendered window to the diff --git a/doc/src/platforms/emb-openvg.qdocinc b/doc/src/platforms/emb-openvg.qdocinc index 37ccb9c..2f9cc21 100644 --- a/doc/src/platforms/emb-openvg.qdocinc +++ b/doc/src/platforms/emb-openvg.qdocinc @@ -259,6 +259,12 @@ at present. \o Convolution, colorize, drop shadow, and blur filters are accelerated using OpenVG operations. + \row + \o Scrolling + \o Accelerated scrolling is implemented but disabled by default +unless QVG_BUFFER_SCROLLING is defined. This should only be enabled on +OpenVG engines where vgCopyPixels() is known to be efficient. + \endtable \section2 Known issues diff --git a/src/openvg/openvg.pro b/src/openvg/openvg.pro index 3790492..883f0f3 100644 --- a/src/openvg/openvg.pro +++ b/src/openvg/openvg.pro @@ -33,7 +33,7 @@ contains(QT_CONFIG, egl) { qwindowsurface_vgegl.cpp } -symbian: DEFINES += QVG_RECREATE_ON_SIZE_CHANGE +symbian: DEFINES += QVG_RECREATE_ON_SIZE_CHANGE QVG_BUFFER_SCROLLING include(../qbase.pri) diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp index 83b0764..c19d5d1 100644 --- a/src/openvg/qwindowsurface_vg.cpp +++ b/src/openvg/qwindowsurface_vg.cpp @@ -57,6 +57,7 @@ QVGWindowSurface::QVGWindowSurface(QWidget *window) { // Create the default type of EGL window surface for windows. d_ptr = new QVGEGLWindowSurfaceDirect(this); + setStaticContentsSupport(d_ptr->supportsStaticContents()); } QVGWindowSurface::QVGWindowSurface @@ -89,7 +90,9 @@ void QVGWindowSurface::setGeometry(const QRect &rect) bool QVGWindowSurface::scroll(const QRegion &area, int dx, int dy) { - return QWindowSurface::scroll(area, dx, dy); + if (!d_ptr->scroll(window(), area, dx, dy)) + return QWindowSurface::scroll(area, dx, dy); + return true; } void QVGWindowSurface::beginPaint(const QRegion ®ion) diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp index 46a905f..99b614b 100644 --- a/src/openvg/qwindowsurface_vgegl.cpp +++ b/src/openvg/qwindowsurface_vgegl.cpp @@ -758,6 +758,33 @@ void QVGEGLWindowSurfaceDirect::endPaint } } +bool QVGEGLWindowSurfaceDirect::supportsStaticContents() const +{ +#if defined(QVG_BUFFER_SCROLLING) && !defined(QVG_NO_PRESERVED_SWAP) + return true; +#else + return QVGEGLWindowSurfacePrivate::supportsStaticContents(); +#endif +} + +bool QVGEGLWindowSurfaceDirect::scroll(QWidget *widget, const QRegion& area, int dx, int dy) +{ +#ifdef QVG_BUFFER_SCROLLING + QEglContext *context = ensureContext(widget); + if (context) { + context->makeCurrent(windowSurface); + QRect scrollRect = area.boundingRect(); + int sx = scrollRect.x(); + int sy = size.height() - scrollRect.y() - scrollRect.height(); + vgSeti(VG_SCISSORING, VG_FALSE); + vgCopyPixels(sx + dx, sy - dy, sx, sy, scrollRect.width(), scrollRect.height()); + context->lazyDoneCurrent(); + return true; + } +#endif + return false; +} + QT_END_NAMESPACE #endif diff --git a/src/openvg/qwindowsurface_vgegl_p.h b/src/openvg/qwindowsurface_vgegl_p.h index aa0c648..892fd9d 100644 --- a/src/openvg/qwindowsurface_vgegl_p.h +++ b/src/openvg/qwindowsurface_vgegl_p.h @@ -77,6 +77,8 @@ public: (QWidget *widget, const QRegion& region, QImage *image = 0) = 0; virtual VGImage surfaceImage() const; virtual QSize surfaceSize() const = 0; + virtual bool supportsStaticContents() const { return false; } + virtual bool scroll(QWidget *, const QRegion&, int, int) { return false; } private: QVGPaintEngine *engine; @@ -128,6 +130,8 @@ public: void beginPaint(QWidget *widget); void endPaint(QWidget *widget, const QRegion& region, QImage *image); QSize surfaceSize() const { return size; } + bool supportsStaticContents() const; + bool scroll(QWidget *widget, const QRegion& area, int dx, int dy); protected: QEglContext *context; |