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
c11da495
Commit
c11da495
authored
Nov 04, 2020
by
Vlad Zahorodnii
Browse files
scene: Simplify decoration quad generation code
parent
d91da41c
Changes
2
Hide whitespace changes
Inline
Side-by-side
scene.cpp
View file @
c11da495
...
...
@@ -977,27 +977,13 @@ WindowQuadList Scene::Window::buildQuads(bool force) const
}
if
(
!
toplevel
->
frameMargins
().
isNull
())
{
AbstractClient
*
client
=
dynamic_cast
<
AbstractClient
*>
(
toplevel
);
QRegion
center
=
toplevel
->
transparentRect
();
const
QRegion
decoration
=
decorationShape
();
qreal
decorationScale
=
1.0
;
QRect
rects
[
4
];
bool
isShadedClient
=
false
;
if
(
client
)
{
if
(
AbstractClient
*
client
=
qobject_cast
<
AbstractClient
*>
(
toplevel
)
)
{
client
->
layoutDecorationRects
(
rects
[
0
],
rects
[
1
],
rects
[
2
],
rects
[
3
]);
decorationScale
=
client
->
screenScale
();
isShadedClient
=
client
->
isShade
()
||
center
.
isEmpty
();
}
if
(
isShadedClient
)
{
const
QRect
bounding
=
rects
[
0
]
|
rects
[
1
]
|
rects
[
2
]
|
rects
[
3
];
*
ret
+=
makeDecorationQuads
(
rects
,
bounding
,
decorationScale
);
}
else
{
*
ret
+=
makeDecorationQuads
(
rects
,
decoration
,
decorationScale
);
}
*
ret
+=
makeDecorationQuads
(
rects
,
decorationShape
());
}
if
(
m_shadow
&&
toplevel
->
wantsShadowToBeRendered
())
{
*
ret
<<
m_shadow
->
shadowQuads
();
...
...
@@ -1007,10 +993,11 @@ WindowQuadList Scene::Window::buildQuads(bool force) const
return
*
ret
;
}
WindowQuadList
Scene
::
Window
::
makeDecorationQuads
(
const
QRect
*
rects
,
const
QRegion
&
region
,
qreal
textureScale
)
const
WindowQuadList
Scene
::
Window
::
makeDecorationQuads
(
const
QRect
*
rects
,
const
QRegion
&
region
)
const
{
WindowQuadList
list
;
const
qreal
textureScale
=
toplevel
->
screenScale
();
const
int
padding
=
1
;
const
QPoint
topSpritePosition
(
padding
,
padding
);
...
...
scene.h
View file @
c11da495
...
...
@@ -389,7 +389,7 @@ public:
template
<
typename
T
>
T
*
previousWindowPixmap
()
const
;
protected:
WindowQuadList
makeDecorationQuads
(
const
QRect
*
rects
,
const
QRegion
&
region
,
qreal
textureScale
=
1.0
)
const
;
WindowQuadList
makeDecorationQuads
(
const
QRect
*
rects
,
const
QRegion
&
region
)
const
;
WindowQuadList
makeContentsQuads
()
const
;
/**
* @brief Factory method to create a WindowPixmap.
...
...
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