summaryrefslogtreecommitdiffstats
path: root/src/openvg
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2010-04-13 15:37:06 (GMT)
committerJason Barron <jbarron@trolltech.com>2010-04-14 07:32:22 (GMT)
commit779123b79cc27599f73a61b2f2055a32cc15230a (patch)
tree176d78d8c18308c57f4b8e20d968cf30f2e0fd85 /src/openvg
parent67f6618f887b3c524f9da58de8136d474881d29f (diff)
downloadQt-779123b79cc27599f73a61b2f2055a32cc15230a.zip
Qt-779123b79cc27599f73a61b2f2055a32cc15230a.tar.gz
Qt-779123b79cc27599f73a61b2f2055a32cc15230a.tar.bz2
Implement OpenVG buffer scrolling and enable it on Symbian.
Add support for accelerated scrolling in the "direct" window surface implementation. Using vgCopyPixels(), the already rasterized content on the surface can be shifted to a new location such that only a portion of the suqsequent frame needs to be repainted instead of the entire frame. This only works when the "preserved" EGL swap behavior is enabled and the impact on performance is highly dependant on the specific hardware platform in use. Task-number: QT-2972 Reviewed-by: Rhys Weatherley
Diffstat (limited to 'src/openvg')
-rw-r--r--src/openvg/openvg.pro2
-rw-r--r--src/openvg/qwindowsurface_vg.cpp5
-rw-r--r--src/openvg/qwindowsurface_vgegl.cpp27
-rw-r--r--src/openvg/qwindowsurface_vgegl_p.h4
4 files changed, 36 insertions, 2 deletions
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 &region)
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;