OSDN Git Service

remove qws support leftovers
authorIvailo Monev <xakepa10@laimg.moc>
Fri, 1 May 2020 19:02:30 +0000 (19:02 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Fri, 1 May 2020 19:02:30 +0000 (19:02 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/gui/kernel/qwidget.cpp
src/gui/kernel/qwidget_p.h
src/gui/painting/qbackingstore.cpp
src/gui/painting/qbackingstore_p.h

index 95cbfd3..490261f 100644 (file)
@@ -4769,11 +4769,8 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
     }
 
     if (recursive && !children.isEmpty()) {
-        paintSiblingsRecursive(pdev, children, children.size() - 1, rgn, offset, flags & ~DrawAsRoot
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-                                , q->windowSurface()
-#endif
-                                , sharedPainter, backingStore);
+        paintSiblingsRecursive(pdev, children, children.size() - 1, rgn, offset, flags & ~DrawAsRoot,
+                               sharedPainter, backingStore);
     }
 }
 
@@ -4862,11 +4859,8 @@ void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset,
 }
 
 void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectList& siblings, int index, const QRegion &rgn,
-                                            const QPoint &offset, int flags
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-                                            , const QWindowSurface *currentSurface
-#endif
-                                            , QPainter *sharedPainter, QWidgetBackingStore *backingStore)
+                                            const QPoint &offset, int flags,
+                                            QPainter *sharedPainter, QWidgetBackingStore *backingStore)
 {
     QWidget *w = 0;
     QRect boundingRect;
@@ -4882,13 +4876,8 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis
             }
 
             if (qRectIntersects(boundingRect, x->d_func()->effectiveRectFor(x->data->crect))) {
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-                if (x->windowSurface() == currentSurface)
-#endif
-                {
-                    w = x;
-                    break;
-                }
+                w = x;
+                break;
             }
         }
         --index;
@@ -4904,11 +4893,8 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis
         QRegion wr(rgn);
         if (wd->isOpaque)
             wr -= hasMask ? wd->extra->mask.translated(widgetPos) : w->data->crect;
-        paintSiblingsRecursive(pdev, siblings, --index, wr, offset, flags
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-                               , currentSurface
-#endif
-                               , sharedPainter, backingStore);
+        paintSiblingsRecursive(pdev, siblings, --index, wr, offset, flags,
+                               sharedPainter, backingStore);
     }
 
     if (w->updatesEnabled()
@@ -8777,22 +8763,6 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
     if (desktopWidget)
         parent = 0;
 
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-    QTLWExtra *extra = d->maybeTopData();
-    QWindowSurface *windowSurface = (extra ? extra->windowSurface : 0);
-    if (newParent && windowSurface) {
-        QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore();
-        if (oldBs)
-            oldBs->subSurfaces.removeAll(windowSurface);
-
-        if (parent) {
-            QWidgetBackingStore *newBs = parent->d_func()->maybeBackingStore();
-            if (newBs)
-                newBs->subSurfaces.append(windowSurface);
-        }
-    }
-#endif
-
     if (QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore()) {
         if (newParent)
             oldBs->removeDirtyWidget(this);
@@ -10212,10 +10182,8 @@ void QWidget::setWindowSurface(QWindowSurface *surface)
 {
     // ### createWinId() ??
 
-#ifndef Q_BACKINGSTORE_SUBSURFACES
     if (!isTopLevel())
         return;
-#endif
 
     Q_D(QWidget);
 
@@ -10236,12 +10204,6 @@ void QWidget::setWindowSurface(QWindowSurface *surface)
             delete bs->windowSurface;
         bs->windowSurface = surface;
     }
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-    else {
-        bs->subSurfaces.append(surface);
-    }
-    bs->subSurfaces.removeOne(oldSurface);
-#endif
 }
 
 /*!
@@ -10259,23 +10221,6 @@ QWindowSurface *QWidget::windowSurface() const
 
     QWidgetBackingStore *bs = d->maybeBackingStore();
 
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-    if (bs && bs->subSurfaces.isEmpty())
-        return bs->windowSurface;
-
-    if (!isTopLevel()) {
-        const QWidget *w = parentWidget();
-        while (w) {
-            QTLWExtra *extra = w->d_func()->maybeTopData();
-            if (extra && extra->windowSurface)
-                return extra->windowSurface;
-            if (w->isTopLevel())
-                break;
-            w = w->parentWidget();
-        }
-    }
-#endif // Q_BACKINGSTORE_SUBSURFACES
-
     return bs ? bs->windowSurface : 0;
 }
 
index f11a11e..03a5ce9 100644 (file)
@@ -317,11 +317,8 @@ public:
 
 
     void paintSiblingsRecursive(QPaintDevice *pdev, const QObjectList& children, int index,
-                                const QRegion &rgn, const QPoint &offset, int flags
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-                                , const QWindowSurface *currentSurface
-#endif
-                                , QPainter *sharedPainter, QWidgetBackingStore *backingStore);
+                                const QRegion &rgn, const QPoint &offset, int flags,
+                                QPainter *sharedPainter, QWidgetBackingStore *backingStore);
 
 
     QPainter *beginSharedPainter();
index de69766..7e509dd 100644 (file)
 
 QT_BEGIN_NAMESPACE
 
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-/*
-   A version of QRect::intersects() that does not normalize the rects.
-*/
-static inline bool qRectIntersects(const QRect &r1, const QRect &r2)
-{
-    return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right())
-            && qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom()));
-}
-#endif
-
 /**
  * Flushes the contents of the \a windowSurface into the screen area of \a widget.
  * \a tlwOffset is the position of the top level widget relative to the window surface.
@@ -213,16 +202,6 @@ bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *wi
     return windowSurface->scroll(tlwRect, dx, dy);
 }
 
-void QWidgetBackingStore::releaseBuffer()
-{
-    if (windowSurface)
-        windowSurface->setGeometry(QRect());
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-    for (int i = 0; i < subSurfaces.size(); ++i)
-        subSurfaces.at(i)->setGeometry(QRect());
-#endif
-}
-
 /*!
     Prepares the window surface to paint a\ toClean region and updates the
     BeginPaintInfo struct accordingly.
@@ -262,11 +241,7 @@ void QWidgetBackingStore::endPaint(const QRegion &cleaned, QWindowSurface *windo
     windowSurface->endPaint(cleaned);
 #endif
 
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-    flush(static_cast<QWSWindowSurface *>(windowSurface)->window(), windowSurface);
-#else
     flush();
-#endif
 }
 
 /*!
@@ -645,12 +620,6 @@ void QWidgetBackingStore::updateLists(QWidget *cur)
 
     if (cur->testAttribute(Qt::WA_StaticContents))
         addStaticWidget(cur);
-
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-    QTLWExtra *extra = cur->d_func()->maybeTopData();
-    if (extra && extra->windowSurface && cur != tlw)
-        subSurfaces.append(extra->windowSurface);
-#endif
 }
 
 QWidgetBackingStore::QWidgetBackingStore(QWidget *topLevel)
@@ -663,9 +632,6 @@ QWidgetBackingStore::QWidgetBackingStore(QWidget *topLevel)
 
     // The QWindowSurface constructor will call QWidget::setWindowSurface(),
     // but automatically created surfaces should not be added to the topdata.
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-    Q_ASSERT(topLevel->d_func()->topData()->windowSurface == windowSurface);
-#endif
     topLevel->d_func()->topData()->windowSurface = 0;
 
     // Ensure all existing subsurfaces and static widgets are added to their respective lists.
@@ -1020,7 +986,6 @@ void QWidgetBackingStore::sync()
     }
 #endif
 
-#ifndef Q_BACKINGSTORE_SUBSURFACES
     BeginPaintInfo beginPaintInfo;
     beginPaint(toClean, windowSurface, &beginPaintInfo);
     if (beginPaintInfo.nothingToPaint) {
@@ -1029,7 +994,6 @@ void QWidgetBackingStore::sync()
         dirty = QRegion();
         return;
     }
-#endif
 
     // Must do this before sending any paint events because
     // the size may change in the paint event.
@@ -1052,90 +1016,19 @@ void QWidgetBackingStore::sync()
         QRegion toBePainted(wd->dirty);
         resetWidget(w);
 
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-        QWindowSurface *subSurface = w->windowSurface();
-        BeginPaintInfo beginPaintInfo;
-
-        QPoint off = w->mapTo(tlw, QPoint());
-        toBePainted.translate(off);
-        beginPaint(toBePainted, subSurface, &beginPaintInfo);
-        toBePainted.translate(-off);
-
-        if (beginPaintInfo.nothingToPaint)
-            continue;
-
-        if (beginPaintInfo.windowSurfaceRecreated) {
-            // Eep the window surface has changed. The old one may have been
-            // deleted, in which case we will segfault on the call to
-            // painterOffset() below. Use the new window surface instead.
-            subSurface = w->windowSurface();
-        }
-
-        QPoint offset(tlwOffset);
-        if (subSurface == windowSurface)
-            offset += w->mapTo(tlw, QPoint());
-        else
-            offset = static_cast<QWSWindowSurface*>(subSurface)->painterOffset();
-        wd->drawWidget(subSurface->paintDevice(), toBePainted, offset, flags, 0, this);
-
-        endPaint(toBePainted, subSurface, &beginPaintInfo);
-#else
         QPoint offset(tlwOffset);
         if (w != tlw)
             offset += w->mapTo(tlw, QPoint());
         wd->drawWidget(windowSurface->paintDevice(), toBePainted, offset, flags, 0, this);
-#endif
     }
 
     // Paint the rest with composition.
-#ifndef Q_BACKINGSTORE_SUBSURFACES
     if (repaintAllWidgets || !dirtyCopy.isEmpty()) {
         const int flags = QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawRecursive;
         tlw->d_func()->drawWidget(windowSurface->paintDevice(), dirtyCopy, tlwOffset, flags, 0, this);
     }
 
     endPaint(toClean, windowSurface, &beginPaintInfo);
-#else
-    if (!repaintAllWidgets && dirtyCopy.isEmpty())
-        return; // Nothing more to paint.
-
-    QList<QWindowSurface *> surfaceList(subSurfaces);
-    surfaceList.prepend(windowSurface);
-    const QRect dirtyBoundingRect(dirtyCopy.boundingRect());
-
-    // Loop through all window surfaces (incl. the top-level surface) and
-    // repaint those intersecting with the bounding rect of the dirty region.
-    for (int i = 0; i < surfaceList.size(); ++i) {
-        QWindowSurface *subSurface = surfaceList.at(i);
-        QWidget *w = subSurface->window();
-        QWidgetPrivate *wd = w->d_func();
-
-        const QRect clipRect = wd->clipRect().translated(w->mapTo(tlw, QPoint()));
-        if (!qRectIntersects(dirtyBoundingRect, clipRect))
-            continue;
-
-        toClean = dirtyCopy;
-        BeginPaintInfo beginPaintInfo;
-        beginPaint(toClean, subSurface, &beginPaintInfo);
-        if (beginPaintInfo.nothingToPaint)
-            continue;
-
-        if (beginPaintInfo.windowSurfaceRecreated) {
-            // Eep the window surface has changed. The old one may have been
-            // deleted, in which case we will segfault on the call to
-            // painterOffset() below. Use the new window surface instead.
-            subSurface = w->windowSurface();
-        }
-
-        int flags = QWidgetPrivate::DrawRecursive;
-        if (w == tlw)
-            flags |= QWidgetPrivate::DrawAsRoot;
-        const QPoint painterOffset = static_cast<QWSWindowSurface*>(subSurface)->painterOffset();
-        wd->drawWidget(subSurface->paintDevice(), toClean, painterOffset, flags, 0, this);
-
-        endPaint(toClean, subSurface, &beginPaintInfo);
-    }
-#endif
 }
 
 /*!
index 056d510..3c2fa0d 100644 (file)
@@ -96,9 +96,6 @@ private:
     QVector<QWidget *> dirtyOnScreenWidgets;
     QList<QWidget *> staticWidgets;
     QWindowSurface *windowSurface;
-#ifdef Q_BACKINGSTORE_SUBSURFACES
-    QList<QWindowSurface*> subSurfaces;
-#endif
     bool fullUpdatePending;
 
     QPoint tlwOffset;
@@ -107,7 +104,6 @@ private:
     static void unflushPaint(QWidget *widget, const QRegion &rgn);
 
     bool bltRect(const QRect &rect, int dx, int dy, QWidget *widget);
-    void releaseBuffer();
 
     void beginPaint(QRegion &toClean, QWindowSurface *windowSurface, BeginPaintInfo *returnInfo);
     void endPaint(const QRegion &cleaned, QWindowSurface *windowSurface, BeginPaintInfo *beginPaintInfo);