diff options
Diffstat (limited to 'src')
-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 |
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 ®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; |