}
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);
}
}
}
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;
}
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;
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()
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);
{
// ### createWinId() ??
-#ifndef Q_BACKINGSTORE_SUBSURFACES
if (!isTopLevel())
return;
-#endif
Q_D(QWidget);
delete bs->windowSurface;
bs->windowSurface = surface;
}
-#ifdef Q_BACKINGSTORE_SUBSURFACES
- else {
- bs->subSurfaces.append(surface);
- }
- bs->subSurfaces.removeOne(oldSurface);
-#endif
}
/*!
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;
}
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.
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.
windowSurface->endPaint(cleaned);
#endif
-#ifdef Q_BACKINGSTORE_SUBSURFACES
- flush(static_cast<QWSWindowSurface *>(windowSurface)->window(), windowSurface);
-#else
flush();
-#endif
}
/*!
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)
// 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.
}
#endif
-#ifndef Q_BACKINGSTORE_SUBSURFACES
BeginPaintInfo beginPaintInfo;
beginPaint(toClean, windowSurface, &beginPaintInfo);
if (beginPaintInfo.nothingToPaint) {
dirty = QRegion();
return;
}
-#endif
// Must do this before sending any paint events because
// the size may change in the paint event.
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
}
/*!