summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-19 06:45:23 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-19 06:45:23 (GMT)
commit4676dd62871da2b58452ebda477a04c25158bec4 (patch)
tree07347beee8f7258be45459b859307556d0e8f3ec /src/gui
parentec5120f85225a0bf732908e0890ff9d483a01870 (diff)
parentdce762752b64be82c9592b4bed69101f4e7c9be2 (diff)
downloadQt-4676dd62871da2b58452ebda477a04c25158bec4.zip
Qt-4676dd62871da2b58452ebda477a04c25158bec4.tar.gz
Qt-4676dd62871da2b58452ebda477a04c25158bec4.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Some QWindowSurface implementations might implement flush as a buffer Set EGL_SWAP_BEHAVIOR to EGL_BUFFER_PRESERVED for regular QWidgets Cleanup & remove unused function overloads from QEgl* APIs QScrollArea: Excessive scrolling in focusNextPrevChild()
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/egl/qegl.cpp58
-rw-r--r--src/gui/egl/qegl_p.h5
-rw-r--r--src/gui/egl/qeglcontext_p.h6
-rw-r--r--src/gui/egl/qeglproperties.cpp17
-rw-r--r--src/gui/egl/qeglproperties_p.h2
-rw-r--r--src/gui/painting/qbackingstore.cpp70
-rw-r--r--src/gui/painting/qbackingstore_p.h4
-rw-r--r--src/gui/painting/qwindowsurface.cpp28
-rw-r--r--src/gui/painting/qwindowsurface_p.h2
-rw-r--r--src/gui/widgets/qscrollarea.cpp4
10 files changed, 86 insertions, 110 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 0fe5cbe..bf9f530 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -484,42 +484,6 @@ bool QEglContext::swapBuffers(EGLSurface surface)
return ok;
}
-// Wait for native rendering operations to complete before starting
-// to use OpenGL/OpenVG operations.
-void QEglContext::waitNative()
-{
-#ifdef EGL_CORE_NATIVE_ENGINE
- eglWaitNative(EGL_CORE_NATIVE_ENGINE);
-#endif
-}
-
-// Wait for client OpenGL/OpenVG operations to complete before
-// using native rendering operations.
-void QEglContext::waitClient()
-{
-#ifdef EGL_OPENGL_ES_API
- if (apiType == QEgl::OpenGL) {
- eglBindAPI(EGL_OPENGL_ES_API);
- eglWaitClient();
- }
-#else
- if (apiType == QEgl::OpenGL)
- eglWaitGL();
-#endif
-#ifdef EGL_OPENVG_API
- if (apiType == QEgl::OpenVG) {
- eglBindAPI(EGL_OPENVG_API);
- eglWaitClient();
- }
-#endif
-}
-
-// Query the value of a configuration attribute.
-bool QEglContext::configAttrib(int name, EGLint *value) const
-{
- return eglGetConfigAttrib(QEgl::display(), cfg, name, value);
-}
-
int QEglContext::configAttrib(int name) const
{
EGLint value;
@@ -530,12 +494,6 @@ int QEglContext::configAttrib(int name) const
return EGL_DONT_CARE;
}
-QEglProperties QEglContext::configProperties() const
-{
- return QEglProperties(config());
-}
-
-
typedef EGLImageKHR (EGLAPIENTRY *_eglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint*);
typedef EGLBoolean (EGLAPIENTRY *_eglDestroyImageKHR)(EGLDisplay, EGLImageKHR);
@@ -673,22 +631,6 @@ QString QEgl::errorString(EGLint code)
}
}
-QString QEgl::errorString()
-{
- return errorString(error());
-}
-
-void QEgl::clearError()
-{
- eglGetError();
-}
-
-EGLint QEgl::error()
-{
- return eglGetError();
-}
-
-
// Dump all of the EGL configurations supported by the system.
void QEgl::dumpAllConfigs()
{
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index 6345d5d..83bdb5e 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -182,10 +182,7 @@ namespace QEgl {
Q_GUI_EXPORT void dumpAllConfigs();
- Q_GUI_EXPORT void clearError();
- Q_GUI_EXPORT EGLint error();
- Q_GUI_EXPORT QString errorString(EGLint code);
- Q_GUI_EXPORT QString errorString();
+ Q_GUI_EXPORT QString errorString(EGLint code = eglGetError());
Q_GUI_EXPORT QString extensions();
Q_GUI_EXPORT bool hasExtension(const char* extensionName);
diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h
index 7eec7eb..ccde00d 100644
--- a/src/gui/egl/qeglcontext_p.h
+++ b/src/gui/egl/qeglcontext_p.h
@@ -85,10 +85,6 @@ public:
bool lazyDoneCurrent();
bool swapBuffers(EGLSurface surface);
- void waitNative();
- void waitClient();
-
- bool configAttrib(int name, EGLint *value) const;
int configAttrib(int name) const;
EGLContext context() const { return ctx; }
@@ -99,8 +95,6 @@ public:
EGLConfig config() const { return cfg; }
void setConfig(EGLConfig config) { cfg = config; }
- QEglProperties configProperties() const;
-
private:
QEgl::API apiType;
EGLContext ctx;
diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp
index b34d2c3..3638de5 100644
--- a/src/gui/egl/qeglproperties.cpp
+++ b/src/gui/egl/qeglproperties.cpp
@@ -241,6 +241,9 @@ void QEglProperties::setRenderableType(QEgl::API api)
// reductions in complexity are possible.
bool QEglProperties::reduceConfiguration()
{
+ if (value(EGL_SWAP_BEHAVIOR) != EGL_DONT_CARE)
+ removeValue(EGL_SWAP_BEHAVIOR);
+
#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
// For OpenVG, we sometimes try to create a surface using a pre-multiplied format. If we can't
// find a config which supports pre-multiplied formats, remove the flag on the surface type:
@@ -292,20 +295,6 @@ static void addTag(QString& str, const QString& tag)
str += tag;
}
-void QEglProperties::dumpAllConfigs()
-{
- EGLint count = 0;
- eglGetConfigs(QEgl::display(), 0, 0, &count);
- if (count < 1)
- return;
-
- EGLConfig *configs = new EGLConfig [count];
- eglGetConfigs(QEgl::display(), configs, count, &count);
- for (EGLint index = 0; index < count; ++index)
- qWarning() << QEglProperties(configs[index]).toString();
- delete [] configs;
-}
-
// Convert a property list to a string suitable for debug output.
QString QEglProperties::toString() const
{
diff --git a/src/gui/egl/qeglproperties_p.h b/src/gui/egl/qeglproperties_p.h
index eebcf72..b1f9642 100644
--- a/src/gui/egl/qeglproperties_p.h
+++ b/src/gui/egl/qeglproperties_p.h
@@ -90,8 +90,6 @@ public:
QString toString() const;
- static void dumpAllConfigs();
-
private:
QVarLengthArray<int> props;
};
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 8de9eaa..f9cd59b 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -263,7 +263,7 @@ bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *wi
{
const QPoint pos(tlwOffset + widget->mapTo(tlw, rect.topLeft()));
const QRect tlwRect(QRect(pos, rect.size()));
- if (dirty.intersects(tlwRect))
+ if (fullUpdatePending || dirty.intersects(tlwRect))
return false; // We don't want to scroll junk.
return windowSurface->scroll(tlwRect, dx, dy);
}
@@ -402,7 +402,7 @@ QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const
const bool widgetDirty = widget && widget != tlw;
const QRect tlwRect(topLevelRect());
const QRect surfaceGeometry(windowSurface->geometry());
- if (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size()) {
+ if (fullUpdatePending || (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size())) {
if (widgetDirty) {
const QRect dirtyTlwRect = QRect(QPoint(), tlwRect.size());
const QPoint offset(widget->mapTo(tlw, QPoint()));
@@ -555,6 +555,18 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up
return;
}
+ if (fullUpdatePending) {
+ if (updateImmediately)
+ sendUpdateRequest(tlw, updateImmediately);
+ return;
+ }
+
+ if (!windowSurface->hasPartialUpdateSupport()) {
+ fullUpdatePending = true;
+ sendUpdateRequest(tlw, updateImmediately);
+ return;
+ }
+
const QPoint offset = widget->mapTo(tlw, QPoint());
const QRect widgetRect = widget->d_func()->effectiveRectFor(widget->rect());
if (qt_region_strictContains(dirty, widgetRect.translated(offset))) {
@@ -638,6 +650,18 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, bool upd
return;
}
+ if (fullUpdatePending) {
+ if (updateImmediately)
+ sendUpdateRequest(tlw, updateImmediately);
+ return;
+ }
+
+ if (!windowSurface->hasPartialUpdateSupport()) {
+ fullUpdatePending = true;
+ sendUpdateRequest(tlw, updateImmediately);
+ return;
+ }
+
const QRect widgetRect = widget->d_func()->effectiveRectFor(rect);
const QRect translatedRect(widgetRect.translated(widget->mapTo(tlw, QPoint())));
if (qt_region_strictContains(dirty, translatedRect)) {
@@ -833,6 +857,7 @@ void QWidgetBackingStore::updateLists(QWidget *cur)
QWidgetBackingStore::QWidgetBackingStore(QWidget *topLevel)
: tlw(topLevel), dirtyOnScreenWidgets(0), hasDirtyFromPreviousSync(false)
+ , fullUpdatePending(0)
{
windowSurface = tlw->windowSurface();
if (!windowSurface)
@@ -1122,6 +1147,7 @@ void QWidgetBackingStore::sync()
for (int i = 0; i < dirtyWidgets.size(); ++i)
resetWidget(dirtyWidgets.at(i));
dirtyWidgets.clear();
+ fullUpdatePending = false;
}
return;
}
@@ -1132,28 +1158,28 @@ void QWidgetBackingStore::sync()
const QRect surfaceGeometry(windowSurface->geometry());
bool repaintAllWidgets = false;
- if (inTopLevelResize || surfaceGeometry != tlwRect) {
- if ((inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) {
- if (hasStaticContents()) {
- // Repaint existing dirty area and newly visible area.
- const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
- const QRegion staticRegion(staticContents(0, clipRect));
- QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height());
- newVisible -= staticRegion;
- dirty += newVisible;
- windowSurface->setStaticContents(staticRegion);
- } else {
- // Repaint everything.
- dirty = QRegion(0, 0, tlwRect.width(), tlwRect.height());
- for (int i = 0; i < dirtyWidgets.size(); ++i)
- resetWidget(dirtyWidgets.at(i));
- dirtyWidgets.clear();
- repaintAllWidgets = true;
- }
+ if ((fullUpdatePending || inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) {
+ if (hasStaticContents()) {
+ // Repaint existing dirty area and newly visible area.
+ const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
+ const QRegion staticRegion(staticContents(0, clipRect));
+ QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height());
+ newVisible -= staticRegion;
+ dirty += newVisible;
+ windowSurface->setStaticContents(staticRegion);
+ } else {
+ // Repaint everything.
+ dirty = QRegion(0, 0, tlwRect.width(), tlwRect.height());
+ for (int i = 0; i < dirtyWidgets.size(); ++i)
+ resetWidget(dirtyWidgets.at(i));
+ dirtyWidgets.clear();
+ repaintAllWidgets = true;
}
- windowSurface->setGeometry(tlwRect);
}
+ if (inTopLevelResize || surfaceGeometry != tlwRect)
+ windowSurface->setGeometry(tlwRect);
+
if (updatesDisabled)
return;
@@ -1212,6 +1238,8 @@ void QWidgetBackingStore::sync()
}
dirtyWidgets.clear();
+ fullUpdatePending = false;
+
if (toClean.isEmpty()) {
// Nothing to repaint. However, we might have newly exposed areas on the
// screen if this function was called from sync(QWidget *, QRegion)), so
diff --git a/src/gui/painting/qbackingstore_p.h b/src/gui/painting/qbackingstore_p.h
index 02c0f7c..6510b57 100644
--- a/src/gui/painting/qbackingstore_p.h
+++ b/src/gui/painting/qbackingstore_p.h
@@ -91,6 +91,7 @@ public:
inline bool isDirty() const
{
return !(dirtyWidgets.isEmpty() && dirty.isEmpty() && !hasDirtyFromPreviousSync
+ && !fullUpdatePending
#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_MANAGER)
&& !hasDirtyWindowDecoration()
#endif
@@ -115,7 +116,8 @@ private:
#ifdef Q_BACKINGSTORE_SUBSURFACES
QList<QWindowSurface*> subSurfaces;
#endif
- bool hasDirtyFromPreviousSync;
+ uint hasDirtyFromPreviousSync : 1;
+ uint fullUpdatePending : 1;
QPoint tlwOffset;
diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp
index 8bd6344..e18ea3f 100644
--- a/src/gui/painting/qwindowsurface.cpp
+++ b/src/gui/painting/qwindowsurface.cpp
@@ -49,13 +49,19 @@ QT_BEGIN_NAMESPACE
class QWindowSurfacePrivate
{
public:
- QWindowSurfacePrivate(QWidget *w) : window(w), staticContentsSupport(false) {}
+ QWindowSurfacePrivate(QWidget *w)
+ : window(w)
+ , staticContentsSupport(0)
+ , partialUpdateSupport(1)
+ {
+ }
QWidget *window;
QRect geometry;
QRegion staticContents;
QList<QImage*> bufferImages;
- bool staticContentsSupport;
+ uint staticContentsSupport : 1;
+ uint partialUpdateSupport : 1;
};
/*!
@@ -284,6 +290,10 @@ bool QWindowSurface::hasStaticContentsSupport() const
void QWindowSurface::setStaticContentsSupport(bool enable)
{
+ if (enable && !d_ptr->partialUpdateSupport) {
+ qWarning("QWindowSurface::setStaticContentsSupport: static contents support requires partial update support");
+ return;
+ }
d_ptr->staticContentsSupport = enable;
}
@@ -302,6 +312,20 @@ bool QWindowSurface::hasStaticContents() const
return d_ptr->staticContentsSupport && !d_ptr->staticContents.isEmpty();
}
+bool QWindowSurface::hasPartialUpdateSupport() const
+{
+ return d_ptr->partialUpdateSupport;
+}
+
+void QWindowSurface::setPartialUpdateSupport(bool enable)
+{
+ if (!enable && d_ptr->staticContentsSupport) {
+ qWarning("QWindowSurface::setPartialUpdateSupport: static contents support requires partial update support");
+ return;
+ }
+ d_ptr->partialUpdateSupport = enable;
+}
+
void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)
{
// make sure we don't detach
diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h
index 0a453af..e6ee5f6 100644
--- a/src/gui/painting/qwindowsurface_p.h
+++ b/src/gui/painting/qwindowsurface_p.h
@@ -90,6 +90,7 @@ public:
inline QRect rect(const QWidget *widget) const;
bool hasStaticContentsSupport() const;
+ bool hasPartialUpdateSupport() const;
void setStaticContents(const QRegion &region);
QRegion staticContents() const;
@@ -97,6 +98,7 @@ public:
protected:
bool hasStaticContents() const;
void setStaticContentsSupport(bool enable);
+ void setPartialUpdateSupport(bool enable);
private:
QWindowSurfacePrivate *d_ptr;
diff --git a/src/gui/widgets/qscrollarea.cpp b/src/gui/widgets/qscrollarea.cpp
index 6b81d9f..38e799e 100644
--- a/src/gui/widgets/qscrollarea.cpp
+++ b/src/gui/widgets/qscrollarea.cpp
@@ -482,14 +482,14 @@ void QScrollArea::ensureWidgetVisible(QWidget *childWidget, int xmargin, int yma
d->hbar->setValue(focusRect.center().x() - d->viewport->width() / 2);
else if (focusRect.right() > visibleRect.right())
d->hbar->setValue(focusRect.right() - d->viewport->width());
- else
+ else if (focusRect.left() < visibleRect.left())
d->hbar->setValue(focusRect.left());
if (focusRect.height() > visibleRect.height())
d->vbar->setValue(focusRect.center().y() - d->viewport->height() / 2);
else if (focusRect.bottom() > visibleRect.bottom())
d->vbar->setValue(focusRect.bottom() - d->viewport->height());
- else
+ else if (focusRect.top() < visibleRect.top())
d->vbar->setValue(focusRect.top());
}