Fix calculation of the shadow size in the OpenGL compositor
Summary: This change addresses the problem of the incorrectly rendered shadows when opening a window (e.g. Kickoff) a second time. In case of e.g. Kickoff not all elements are set, thus e.g. left might be 0, but right has a value. So for calculating the height the maximum of the values must be used. Test Plan: Opened Kickoff and systray a few times Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D1792
This commit is contained in:
parent
d16d77f7fe
commit
2cc47004c3
1 changed files with 13 additions and 4 deletions
|
@ -2276,8 +2276,12 @@ void SceneOpenGLShadow::buildQuads()
|
|||
const QRectF outerRect(QPointF(-leftOffset(), -topOffset()),
|
||||
QPointF(topLevel()->width() + rightOffset(), topLevel()->height() + bottomOffset()));
|
||||
|
||||
const qreal width = topLeft.width() + top.width() + topRight.width();
|
||||
const qreal height = topLeft.height() + left.height() + bottomLeft.height();
|
||||
const int width = qMax(topLeft.width(), bottomLeft.width()) +
|
||||
qMax(top.width(), bottom.width()) +
|
||||
qMax(topRight.width(), bottomRight.width());
|
||||
const int height = qMax(topLeft.height(), bottomLeft.height()) +
|
||||
qMax(left.height(), right.height()) +
|
||||
qMax(bottomLeft.height(), bottomRight.height());
|
||||
|
||||
qreal tx1(0.0), tx2(0.0), ty1(0.0), ty2(0.0);
|
||||
|
||||
|
@ -2377,9 +2381,14 @@ bool SceneOpenGLShadow::prepareBackend()
|
|||
const QSize bottomLeft(shadowPixmap(ShadowElementBottomLeft).size());
|
||||
const QSize left(shadowPixmap(ShadowElementLeft).size());
|
||||
const QSize topLeft(shadowPixmap(ShadowElementTopLeft).size());
|
||||
const QSize bottomRight(shadowPixmap(ShadowElementBottomRight).size());
|
||||
|
||||
const int width = topLeft.width() + top.width() + topRight.width();
|
||||
const int height = topLeft.height() + left.height() + bottomLeft.height();
|
||||
const int width = qMax(topLeft.width(), bottomLeft.width()) +
|
||||
qMax(top.width(), bottom.width()) +
|
||||
qMax(topRight.width(), bottomRight.width());
|
||||
const int height = qMax(topLeft.height(), bottomLeft.height()) +
|
||||
qMax(left.height(), right.height()) +
|
||||
qMax(bottomLeft.height(), bottomRight.height());
|
||||
|
||||
if (width == 0 || height == 0) {
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue