Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
1dd6575d
Commit
1dd6575d
authored
Mar 29, 2022
by
Vlad Zahorodnii
Browse files
Compute valid opaque region at surface commit time
This allows us to simplify rendering code in the compositor.
parent
a1d61bb6
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/wayland/surface_interface.cpp
View file @
1dd6575d
...
...
@@ -581,17 +581,27 @@ void SurfaceInterfacePrivate::applyState(SurfaceState *next)
}
else
{
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
{
surfaceSize
=
QSize
();
implicitSurfaceSize
=
QSize
();
bufferSize
=
QSize
();
inputRegion
=
QRegion
();
opaqueRegion
=
QRegion
();
}
surfaceToBufferMatrix
=
buildSurfaceToBufferMatrix
();
bufferToSurfaceMatrix
=
surfaceToBufferMatrix
.
inverted
();
inputRegion
=
current
.
input
&
QRect
(
QPoint
(
0
,
0
),
surfaceSize
);
if
(
opaqueRegionChanged
)
{
Q_EMIT
q
->
opaqueChanged
(
current
.
opaque
);
Q_EMIT
q
->
opaqueChanged
(
opaque
Region
);
}
if
(
oldInputRegion
!=
inputRegion
)
{
Q_EMIT
q
->
inputChanged
(
inputRegion
);
...
...
@@ -715,7 +725,7 @@ QRegion SurfaceInterface::damage() const
QRegion
SurfaceInterface
::
opaque
()
const
{
return
d
->
current
.
opaque
;
return
d
->
opaque
Region
;
}
QRegion
SurfaceInterface
::
input
()
const
...
...
src/wayland/surface_interface_p.h
View file @
1dd6575d
...
...
@@ -107,6 +107,7 @@ public:
QSize
implicitSurfaceSize
;
QSize
surfaceSize
;
QRegion
inputRegion
;
QRegion
opaqueRegion
;
ClientBuffer
*
bufferRef
=
nullptr
;
bool
mapped
=
false
;
bool
hasCacheState
=
false
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment