Compute valid opaque region at surface commit time
This allows us to simplify rendering code in the compositor.
This commit is contained in:
parent
a1d61bb6e8
commit
1dd6575d76
2 changed files with 14 additions and 3 deletions
|
@ -581,17 +581,27 @@ void SurfaceInterfacePrivate::applyState(SurfaceState *next)
|
||||||
} else {
|
} else {
|
||||||
surfaceSize = implicitSurfaceSize;
|
surfaceSize = implicitSurfaceSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QRect surfaceRect(QPoint(0, 0), surfaceSize);
|
||||||
|
inputRegion = current.input & surfaceRect;
|
||||||
|
|
||||||
|
if (!current.buffer->hasAlphaChannel()) {
|
||||||
|
opaqueRegion = surfaceRect;
|
||||||
|
} else {
|
||||||
|
opaqueRegion = current.opaque & surfaceRect;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
surfaceSize = QSize();
|
surfaceSize = QSize();
|
||||||
implicitSurfaceSize = QSize();
|
implicitSurfaceSize = QSize();
|
||||||
bufferSize = QSize();
|
bufferSize = QSize();
|
||||||
|
inputRegion = QRegion();
|
||||||
|
opaqueRegion = QRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
surfaceToBufferMatrix = buildSurfaceToBufferMatrix();
|
surfaceToBufferMatrix = buildSurfaceToBufferMatrix();
|
||||||
bufferToSurfaceMatrix = surfaceToBufferMatrix.inverted();
|
bufferToSurfaceMatrix = surfaceToBufferMatrix.inverted();
|
||||||
inputRegion = current.input & QRect(QPoint(0, 0), surfaceSize);
|
|
||||||
if (opaqueRegionChanged) {
|
if (opaqueRegionChanged) {
|
||||||
Q_EMIT q->opaqueChanged(current.opaque);
|
Q_EMIT q->opaqueChanged(opaqueRegion);
|
||||||
}
|
}
|
||||||
if (oldInputRegion != inputRegion) {
|
if (oldInputRegion != inputRegion) {
|
||||||
Q_EMIT q->inputChanged(inputRegion);
|
Q_EMIT q->inputChanged(inputRegion);
|
||||||
|
@ -715,7 +725,7 @@ QRegion SurfaceInterface::damage() const
|
||||||
|
|
||||||
QRegion SurfaceInterface::opaque() const
|
QRegion SurfaceInterface::opaque() const
|
||||||
{
|
{
|
||||||
return d->current.opaque;
|
return d->opaqueRegion;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRegion SurfaceInterface::input() const
|
QRegion SurfaceInterface::input() const
|
||||||
|
|
|
@ -107,6 +107,7 @@ public:
|
||||||
QSize implicitSurfaceSize;
|
QSize implicitSurfaceSize;
|
||||||
QSize surfaceSize;
|
QSize surfaceSize;
|
||||||
QRegion inputRegion;
|
QRegion inputRegion;
|
||||||
|
QRegion opaqueRegion;
|
||||||
ClientBuffer *bufferRef = nullptr;
|
ClientBuffer *bufferRef = nullptr;
|
||||||
bool mapped = false;
|
bool mapped = false;
|
||||||
bool hasCacheState = false;
|
bool hasCacheState = false;
|
||||||
|
|
Loading…
Reference in a new issue