8b5beb2a553102639e9eb38c8f8f0f6775e8545b RCL_3
authorEckhart Koeppen <eckhart.koppen@nokia.com>
Fri, 16 Apr 2010 11:39:52 +0300
branchRCL_3
changeset 9 740e5562c97f
parent 8 3f74d0d4af4c
child 10 b5b118452c7d
8b5beb2a553102639e9eb38c8f8f0f6775e8545b
.commit-template
.gitignore
.hgignore
VERSION.SHA1
doc/src/howtos/openvg.qdoc
doc/src/platforms/emb-openvg.qdocinc
src/3rdparty/webkit/VERSION
src/3rdparty/webkit/WebCore/ChangeLog
src/3rdparty/webkit/WebCore/WebCore.pro
src/3rdparty/webkit/WebCore/plugins/symbian/PluginViewSymbian.cpp
src/corelib/codecs/qtextcodec.cpp
src/corelib/codecs/qtextcodec.h
src/corelib/kernel/qeventdispatcher_symbian.cpp
src/gui/text/qfont.cpp
src/network/socket/qnativesocketengine_unix.cpp
src/openvg/openvg.pro
src/openvg/qwindowsurface_vg.cpp
src/openvg/qwindowsurface_vgegl.cpp
src/openvg/qwindowsurface_vgegl_p.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.commit-template	Fri Apr 16 11:39:52 2010 +0300
@@ -0,0 +1,10 @@
+# ===[ Subject ]==========[ one line, please wrap at 72 characters ]===|
+
+# ---[ Details ]---------[ remember extra blank line after subject ]---|
+
+# ---[ Fields ]-----------------[ uncomment and edit as applicable ]---|
+
+#Task-number:
+#Reviewed-by:
+
+# ==================================[ please wrap at 72 characters ]===|
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.gitignore	Fri Apr 16 11:39:52 2010 +0300
@@ -0,0 +1,209 @@
+# This file is used to ignore files which are generated in the Qt build system
+# ----------------------------------------------------------------------------
+
+examples/*/*/*
+!examples/*/*/*[.]*
+!examples/*/*/README
+examples/*/*/*[.]app
+demos/*/*
+!demos/*/*[.]*
+demos/*/*[.]app
+config.tests/*/*/*
+!config.tests/*/*/*[.]*
+config.tests/*/*/*[.]app
+
+*~
+*.a
+*.core
+*.moc
+*.o
+*.obj
+*.orig
+*.swp
+*.rej
+*.so
+*.pbxuser
+*.mode1
+*.mode1v3
+*_pch.h.cpp
+*_resource.rc
+.#*
+*.*#
+core
+.qmake.cache
+.qmake.vars
+*.prl
+tags
+.DS_Store
+*.debug
+Makefile*
+!qmake/Makefile.win32*
+!qmake/Makefile.unix
+*.prl
+*.app
+*.pro.user
+bin/Qt*.dll
+bin/assistant*
+bin/designer*
+bin/dumpcpp*
+bin/idc*
+bin/linguist*
+bin/lrelease*
+bin/lupdate*
+bin/lconvert*
+bin/moc*
+bin/pixeltool*
+bin/qmake*
+bin/qdoc3*
+bin/qt3to4*
+bin/qtdemo*
+bin/qttracereplay*
+bin/rcc*
+bin/uic*
+bin/patternist*
+bin/phonon*
+bin/qcollectiongenerator*
+bin/qdbus*
+bin/qhelpconverter*
+bin/qhelpgenerator*
+bin/qtconfig*
+bin/xmlpatterns*
+bin/cetest*
+bin/collectiongenerator
+bin/helpconverter
+bin/helpgenerator
+configure.cache
+config.status
+mkspecs/default
+mkspecs/qconfig.pri
+moc_*.cpp
+qmake/qmake.exe
+qmake/Makefile.bak
+src/corelib/global/qconfig.cpp
+src/corelib/global/qconfig.h
+src/corelib/global/qconfig.h.qmake
+src/tools/uic/qclass_lib_map.h
+ui_*.h
+tests/auto/qprocess/test*/*.exe
+tests/auto/qtcpsocket/stressTest/*.exe
+tests/auto/qprocess/fileWriterProcess/*.exe
+tests/auto/qmake/testdata/quotedfilenames/*.exe
+tests/auto/compilerwarnings/*.exe
+tests/auto/qmake/testdata/quotedfilenames/test.cpp
+tests/auto/qprocess/fileWriterProcess.txt
+.com.apple.timemachine.supported
+tests/auto/qlibrary/libmylib.so*
+tests/auto/qresourceengine/runtime_resource.rcc
+tools/qtestlib/updater/updater*
+tools/activeqt/testcon/testcon.tlb
+translations/*.qm
+qrc_*.cpp
+
+# xemacs temporary files
+*.flc
+
+# Vim temporary files
+.*.swp
+
+# Visual Studio generated files
+*.ib_pdb_index
+*.idb
+*.ilk
+*.pdb
+*.sln
+*.suo
+*.vcproj
+*vcproj.*.*.user
+*.ncb
+
+# MinGW generated files
+*.Debug
+*.Release
+
+# WebKit temp files
+src/3rdparty/webkit/WebCore/mocinclude.tmp
+src/3rdparty/webkit/includes.txt
+src/3rdparty/webkit/includes2.txt
+
+# Symlinks generated by configure
+tools/qvfb/qvfbhdr.h
+tools/qvfb/qlock_p.h
+tools/qvfb/qlock.cpp
+tools/qvfb/qwssignalhandler.cpp
+tools/qvfb/qwssignalhandler_p.h
+.DS_Store
+.pch
+.rcc
+*.app
+config.status
+config.tests/unix/cups/cups
+config.tests/unix/getaddrinfo/getaddrinfo
+config.tests/unix/getifaddrs/getifaddrs
+config.tests/unix/iconv/iconv
+config.tests/unix/ipv6/ipv6
+config.tests/unix/ipv6ifname/ipv6ifname
+config.tests/unix/largefile/largefile
+config.tests/unix/nis/nis
+config.tests/unix/odbc/odbc
+config.tests/unix/openssl/openssl
+config.tests/unix/stl/stl
+config.tests/unix/zlib/zlib
+config.tests/unix/3dnow/3dnow
+config.tests/unix/mmx/mmx
+config.tests/unix/sse/sse
+config.tests/unix/sse2/sse2
+
+
+
+# Directories to ignore
+# ---------------------
+
+debug
+examples/tools/plugandpaint/plugins
+include/*
+include/*/*
+lib/*
+!lib/fonts
+!lib/README
+plugins/*/*
+release
+tmp
+doc-build
+doc/html/*
+doc/qch
+doc-build
+.rcc
+.pch
+.metadata
+
+# Symbian build system generated files
+# ---------------------
+
+ABLD.BAT
+bld.inf
+*.mmp
+*.mk
+*.rss
+*.loc
+!s60main.rss
+*.pkg
+plugin_commonU.def
+*.qtplugin
+*.sis
+*.sisx
+*.lst
+
+# Generated by abldfast.bat from devtools.
+.abldsteps.*
+
+# Carbide project files
+# ---------------------
+.project
+.cproject
+.make.cache
+*.d
+
+qtc-debugging-helper
+src/corelib/lib
+src/network/lib
+src/xml/lib/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Fri Apr 16 11:39:52 2010 +0300
@@ -0,0 +1,2 @@
+syntax: glob
+.git
--- a/VERSION.SHA1	Thu Apr 08 14:19:33 2010 +0300
+++ b/VERSION.SHA1	Fri Apr 16 11:39:52 2010 +0300
@@ -1,1 +1,1 @@
-70947f0f93d948bc89b3b43d00da758a51f1ef84
+8b5beb2a553102639e9eb38c8f8f0f6775e8545b
--- a/doc/src/howtos/openvg.qdoc	Thu Apr 08 14:19:33 2010 +0300
+++ b/doc/src/howtos/openvg.qdoc	Fri Apr 16 11:39:52 2010 +0300
@@ -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
--- a/doc/src/platforms/emb-openvg.qdocinc	Thu Apr 08 14:19:33 2010 +0300
+++ b/doc/src/platforms/emb-openvg.qdocinc	Fri Apr 16 11:39:52 2010 +0300
@@ -259,6 +259,12 @@
         \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
--- a/src/3rdparty/webkit/VERSION	Thu Apr 08 14:19:33 2010 +0300
+++ b/src/3rdparty/webkit/VERSION	Fri Apr 16 11:39:52 2010 +0300
@@ -8,4 +8,8 @@
 
 and has the sha1 checksum
 
+<<<<<<< HEAD
         e9151b11e974f0aa47fd40c225f88f35ced91496
+=======
+        14feb62c96ffe2c37e3e2fdac4e370fdbc76ef62
+>>>>>>> 8f75ee7... Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 14feb62c96ffe2c37e3e2fdac4e370fdbc76ef62 )
--- a/src/3rdparty/webkit/WebCore/ChangeLog	Thu Apr 08 14:19:33 2010 +0300
+++ b/src/3rdparty/webkit/WebCore/ChangeLog	Fri Apr 16 11:39:52 2010 +0300
@@ -1,3 +1,33 @@
+<<<<<<< HEAD
+=======
+2010-04-09  David Leong  <david.leong@nokia.com>
+
+        Reviewed by Simon Hausmann.
+
+        [Qt] Symbian apps crash on exit due to a bad qObject_cast.
+
+        https://bugs.webkit.org/show_bug.cgi?id=37303
+
+        Added check for NULL to avoid the crash.
+
+        * plugins/symbian/PluginViewSymbian.cpp:
+        (WebCore::PluginView::platformDestroy):
+
+2009-11-15  Dave Tapuska  <dtapuska@rim.com>
+
+        Reviewed by George Staikos.
+        
+        Compare UChars single unit at a time as opposed to the uint32_t
+        approach as casting to unaligned addresses may cause a bus failure
+        on ARMv5 and below. This change replicates the same defines that
+        exists in AtomicString.cpp
+
+        https://bugs.webkit.org/show_bug.cgi?id=31475
+        
+        * platform/text/StringHash.h:
+        (WebCore::StringHash::equal):
+
+>>>>>>> 8f75ee7... Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( 14feb62c96ffe2c37e3e2fdac4e370fdbc76ef62 )
 2010-03-25  yael aharon  <yael.aharon@nokia.com>
 
         Reviewed by Laszlo Gombos.
--- a/src/3rdparty/webkit/WebCore/WebCore.pro	Thu Apr 08 14:19:33 2010 +0300
+++ b/src/3rdparty/webkit/WebCore/WebCore.pro	Fri Apr 16 11:39:52 2010 +0300
@@ -203,10 +203,12 @@
 
 !CONFIG(QTDIR_build):!contains(DEFINES, ENABLE_QT_BEARER=.) {
     symbian: {
-        exists($${EPOCROOT}epoc32/release/winscw/udeb/QtBearer.lib)| \
-        exists($${EPOCROOT}epoc32/release/armv5/lib/QtBearer.lib) {
-            DEFINES += ENABLE_QT_BEARER=1
-        }
+        # exists($${EPOCROOT}epoc32/release/winscw/udeb/QtBearer.lib)| \
+        # exists($${EPOCROOT}epoc32/release/armv5/lib/QtBearer.lib) {
+        #     DEFINES += ENABLE_QT_BEARER=1
+        # }
+        # :QTP:Bearer management always enabled
+        DEFINES += ENABLE_QT_BEARER=1
     }
 }
 
--- a/src/3rdparty/webkit/WebCore/plugins/symbian/PluginViewSymbian.cpp	Thu Apr 08 14:19:33 2010 +0300
+++ b/src/3rdparty/webkit/WebCore/plugins/symbian/PluginViewSymbian.cpp	Fri Apr 16 11:39:52 2010 +0300
@@ -453,7 +453,7 @@
 void PluginView::platformDestroy()
 {
     QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient();
-    if (QGraphicsWebView *webView = qobject_cast<QGraphicsWebView*>(client->pluginParent()))
+    if (client && qobject_cast<QGraphicsWebView*>(client->pluginParent()))
         delete static_cast<PluginContainerSymbian*>(platformPluginWidget())->proxy();
     else
         delete platformPluginWidget();
--- a/src/corelib/codecs/qtextcodec.cpp	Thu Apr 08 14:19:33 2010 +0300
+++ b/src/corelib/codecs/qtextcodec.cpp	Fri Apr 16 11:39:52 2010 +0300
@@ -110,6 +110,7 @@
     (QTextCodecFactoryInterface_iid, QLatin1String("/codecs")))
 #endif
 
+
 static char qtolower(register char c)
 { if (c >= 'A' && c <= 'Z') return c + 0x20; return c; }
 static bool qisalnum(register char c)
@@ -224,6 +225,19 @@
 
 Q_GLOBAL_STATIC(QTextCodecCleanup, createQTextCodecCleanup)
 
+bool QTextCodec::validCodecs()
+{
+#ifdef Q_OS_SYMBIAN
+    // If we don't have a trap handler, we're outside of the main() function,
+    // ie. in global constructors or destructors. Don't use codecs in this
+    // case as it would lead to crashes because we don't have a cleanup stack on Symbian
+    return (User::TrapHandler() != NULL);
+#else
+    return true;
+#endif
+}
+
+
 #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
 class QWindowsLocalCodec: public QTextCodec
 {
@@ -684,6 +698,14 @@
     if (all)
         return;
 
+#ifdef Q_OS_SYMBIAN
+    // If we don't have a trap handler, we're outside of the main() function,
+    // ie. in global constructors or destructors. Don't create codecs in this
+    // case as it would lead to crashes because of a missing cleanup stack on Symbian
+    if (User::TrapHandler() == NULL)
+        return;
+#endif
+
 #ifdef Q_DEBUG_TEXTCODEC
     if (destroying_is_ok)
         qWarning("QTextCodec: Creating new codec during codec cleanup");
@@ -986,6 +1008,9 @@
 #endif
     setup();
 
+    if (!validCodecs())
+        return 0;
+
     static QHash <QByteArray, QTextCodec *> cache;
     if (clearCaches & 0x1) {
         cache.clear();
@@ -1027,6 +1052,9 @@
 #endif
     setup();
 
+    if (!validCodecs())
+        return 0;
+
     static QHash <int, QTextCodec *> cache;
     if (clearCaches & 0x2) {
         cache.clear();
@@ -1074,6 +1102,10 @@
     setup();
 
     QList<QByteArray> codecs;
+
+    if (!validCodecs())
+        return codecs;
+
     for (int i = 0; i < all->size(); ++i) {
         codecs += all->at(i)->name();
         codecs += all->at(i)->aliases();
@@ -1112,6 +1144,10 @@
     setup();
 
     QList<int> codecs;
+
+    if (!validCodecs())
+        return codecs;
+
     for (int i = 0; i < all->size(); ++i)
         codecs += all->at(i)->mibEnum();
 
@@ -1165,6 +1201,9 @@
 
 QTextCodec* QTextCodec::codecForLocale()
 {
+    if (!validCodecs())
+        return 0;
+
     if (localeMapper)
         return localeMapper;
 
--- a/src/corelib/codecs/qtextcodec.h	Thu Apr 08 14:19:33 2010 +0300
+++ b/src/corelib/codecs/qtextcodec.h	Fri Apr 16 11:39:52 2010 +0300
@@ -145,12 +145,13 @@
 private:
     friend class QTextCodecCleanup;
     static QTextCodec *cftr;
+    static bool validCodecs();
 };
 Q_DECLARE_OPERATORS_FOR_FLAGS(QTextCodec::ConversionFlags)
 
-inline QTextCodec* QTextCodec::codecForTr() { return cftr; }
+        inline QTextCodec* QTextCodec::codecForTr() { return validCodecs() ? cftr : 0; }
 inline void QTextCodec::setCodecForTr(QTextCodec *c) { cftr = c; }
-inline QTextCodec* QTextCodec::codecForCStrings() { return QString::codecForCStrings; }
+inline QTextCodec* QTextCodec::codecForCStrings() { return validCodecs() ? QString::codecForCStrings : 0; }
 inline void QTextCodec::setCodecForCStrings(QTextCodec *c) { QString::codecForCStrings = c; }
 
 class Q_CORE_EXPORT QTextEncoder {
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp	Thu Apr 08 14:19:33 2010 +0300
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp	Fri Apr 16 11:39:52 2010 +0300
@@ -570,7 +570,13 @@
              * check if socket is in exception set
              * then signal RequestComplete for it
              */
-            qWarning("exception on %d", i.key()->socket());
+            qWarning("exception on %d [will close the socket handle - hack]", i.key()->socket());
+            // quick fix; there is a bug
+            // when doing read on socket
+            // errors not preoperly mapped
+            // after offline-ing the device
+            // on some devices we do get exception
+            ::close(i.key()->socket());
             toRemove.append(i.key());
             TRequestStatus *status = i.value();
             QEventDispatcherSymbian::RequestComplete(d->threadData->symbian_thread_handle, status, KErrNone);
--- a/src/gui/text/qfont.cpp	Thu Apr 08 14:19:33 2010 +0300
+++ b/src/gui/text/qfont.cpp	Fri Apr 16 11:39:52 2010 +0300
@@ -2612,8 +2612,10 @@
     } QT_CATCH (const std::bad_alloc &) {
         // no cache - just ignore
     }
-    if (cache && cache->hasLocalData())
+    if (cache && cache->hasLocalData()) {
+        cache->localData()->clear();
         cache->setLocalData(0);
+        }
 }
 #endif // QT_NO_THREAD
 
--- a/src/network/socket/qnativesocketengine_unix.cpp	Thu Apr 08 14:19:33 2010 +0300
+++ b/src/network/socket/qnativesocketengine_unix.cpp	Fri Apr 16 11:39:52 2010 +0300
@@ -601,10 +601,15 @@
     // Peek 0 bytes into the next message. The size of the message may
     // well be 0, so we can't check recvfrom's return value.
     ssize_t readBytes;
+#ifdef Q_OS_SYMBIAN
+    char c;
+    readBytes = ::recvfrom(socketDescriptor, &c, 1, MSG_PEEK, &storage.a, &storageSize);
+#else
     do {
         char c;
         readBytes = ::recvfrom(socketDescriptor, &c, 1, MSG_PEEK, &storage.a, &storageSize);
     } while (readBytes == -1 && errno == EINTR);
+#endif
 
     // If there's no error, or if our buffer was too small, there must be a
     // pending datagram.
@@ -661,11 +666,17 @@
     sz = sizeof(aa);
 
     ssize_t recvFromResult = 0;
+#ifdef Q_OS_SYMBIAN
+    char c;
+    recvFromResult = ::recvfrom(socketDescriptor, maxSize ? data : &c, maxSize ? maxSize : 1,
+                                0, &aa.a, &sz);
+#else
     do {
         char c;
         recvFromResult = ::recvfrom(socketDescriptor, maxSize ? data : &c, maxSize ? maxSize : 1,
                                     0, &aa.a, &sz);
     } while (recvFromResult == -1 && errno == EINTR);
+#endif
 
     if (recvFromResult == -1) {
         setError(QAbstractSocket::NetworkError, ReceiveDatagramErrorString);
@@ -832,17 +843,17 @@
     // ignore the SIGPIPE signal
     qt_ignore_sigpipe();
 
+    ssize_t writtenBytes;
+#ifdef Q_OS_SYMBIAN
+    // Symbian does not support signals natively and Open C returns EINTR when moving to offline
+    writtenBytes = ::write(socketDescriptor, data, len);
+#else
     // loop while ::write() returns -1 and errno == EINTR, in case
     // of an interrupting signal.
-    ssize_t writtenBytes;
     do {
-#ifdef Q_OS_SYMBIAN
-	    writtenBytes = ::write(socketDescriptor, data, len);
-#else
         writtenBytes = qt_safe_write(socketDescriptor, data, len);
+    } while (writtenBytes < 0 && errno == EINTR);
 #endif
-        // writtenBytes = QT_WRITE(socketDescriptor, data, len); ### TODO S60: Should this line be removed or the one above it?
-    } while (writtenBytes < 0 && errno == EINTR);
 
     if (writtenBytes < 0) {
         switch (errno) {
@@ -882,13 +893,13 @@
     }
 
     ssize_t r = 0;
-    do {
 #ifdef Q_OS_SYMBIAN
-        r = ::read(socketDescriptor, data, maxSize);
+    r = ::read(socketDescriptor, data, maxSize);
 #else
+    do {
         r = qt_safe_read(socketDescriptor, data, maxSize);
+    } while (r == -1 && errno == EINTR);
 #endif
-    } while (r == -1 && errno == EINTR);
 
     if (r < 0) {
         r = -1;
--- a/src/openvg/openvg.pro	Thu Apr 08 14:19:33 2010 +0300
+++ b/src/openvg/openvg.pro	Fri Apr 16 11:39:52 2010 +0300
@@ -33,7 +33,7 @@
         qwindowsurface_vgegl.cpp
 }
 
-symbian: DEFINES += QVG_RECREATE_ON_SIZE_CHANGE QVG_SCISSOR_CLIP 
+symbian: DEFINES += QVG_RECREATE_ON_SIZE_CHANGE QVG_SCISSOR_CLIP QVG_BUFFER_SCROLLING 
 
 include(../qbase.pri)
 
--- a/src/openvg/qwindowsurface_vg.cpp	Thu Apr 08 14:19:33 2010 +0300
+++ b/src/openvg/qwindowsurface_vg.cpp	Fri Apr 16 11:39:52 2010 +0300
@@ -57,6 +57,7 @@
 {
     // 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 @@
 
 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)
--- a/src/openvg/qwindowsurface_vgegl.cpp	Thu Apr 08 14:19:33 2010 +0300
+++ b/src/openvg/qwindowsurface_vgegl.cpp	Fri Apr 16 11:39:52 2010 +0300
@@ -659,6 +659,7 @@
 #endif
         windowSurface = context->createSurface(widget, &surfaceProps);
         isPaintingActive = false;
+        needToSwap = true;
     }
 #else
     if (context && size != newSize) {
@@ -710,20 +711,21 @@
             needToSwap = false;
         }
 #endif
-#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(QEglContext::display(), surface,
-                             EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
-            if (eglGetError() != EGL_SUCCESS) {
-                qWarning("QVG: could not enable preserved swap");
-            }
-        }
-#endif
         windowSurface = surface;
         isPaintingActive = false;
     }
+
+#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(QEglContext::display(), windowSurface,
+                EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
+        if (eglGetError() != EGL_SUCCESS) {
+            qWarning("QVG: could not enable preserved swap");
+        }
+    }
+#endif
     return context;
 }
 
@@ -756,6 +758,33 @@
     }
 }
 
+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
--- a/src/openvg/qwindowsurface_vgegl_p.h	Thu Apr 08 14:19:33 2010 +0300
+++ b/src/openvg/qwindowsurface_vgegl_p.h	Fri Apr 16 11:39:52 2010 +0300
@@ -77,6 +77,8 @@
         (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 @@
     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;