Make shadows work for windows 100% width or height
Summary: Clients provide shadows as 9 images, which then get split into relevant quads. To work out the full width we need the size of an item on the left, the middle and the right. Some elements can be legitiamtely missing so to work out the width of the left edge we need to consider all 3 of topleft,left,bottomleft. Currently we checked both corners in case one was missing, but it's legitimate for both to be missing if the shadow stretches the whole way. BUG: 380825 Test Plan: Shadow on panel, rest looks the same Reviewers: #plasma, mart Reviewed By: #plasma, mart Subscribers: graesslin, mart, plasma-devel, kwin, #kwin Tags: #plasma Differential Revision: https://phabricator.kde.org/D6164
This commit is contained in:
parent
3b9ccc65a3
commit
b7cb301deb
1 changed files with 12 additions and 13 deletions
|
@ -2248,12 +2248,12 @@ void SceneOpenGLShadow::buildQuads()
|
|||
const QRectF outerRect(QPointF(-leftOffset(), -topOffset()),
|
||||
QPointF(topLevel()->width() + rightOffset(), topLevel()->height() + bottomOffset()));
|
||||
|
||||
const int width = qMax(topLeft.width(), bottomLeft.width()) +
|
||||
qMax(top.width(), bottom.width()) +
|
||||
qMax(topRight.width(), bottomRight.width());
|
||||
const int height = qMax(topLeft.height(), topRight.height()) +
|
||||
qMax(left.height(), right.height()) +
|
||||
qMax(bottomLeft.height(), bottomRight.height());
|
||||
const int width = std::max({topLeft.width(), left.width(), bottomLeft.width()}) +
|
||||
std::max(top.width(), bottom.width()) +
|
||||
std::max({topRight.width(), right.width(), bottomRight.width()});
|
||||
const int height = std::max({topLeft.height(), top.height(), topRight.height()}) +
|
||||
std::max(left.height(), right.height()) +
|
||||
std::max({bottomLeft.height(), bottom.height(), bottomRight.height()});
|
||||
|
||||
qreal tx1(0.0), tx2(0.0), ty1(0.0), ty2(0.0);
|
||||
|
||||
|
@ -2355,13 +2355,12 @@ bool SceneOpenGLShadow::prepareBackend()
|
|||
const QSize topLeft(shadowPixmap(ShadowElementTopLeft).size());
|
||||
const QSize bottomRight(shadowPixmap(ShadowElementBottomRight).size());
|
||||
|
||||
const int width = qMax(topLeft.width(), bottomLeft.width()) +
|
||||
qMax(top.width(), bottom.width()) +
|
||||
qMax(topRight.width(), bottomRight.width());
|
||||
|
||||
const int height = qMax(topRight.height(), topLeft.height()) +
|
||||
qMax(left.height(), right.height()) +
|
||||
qMax(bottomLeft.height(), bottomRight.height());
|
||||
const int width = std::max({topLeft.width(), left.width(), bottomLeft.width()}) +
|
||||
std::max(top.width(), bottom.width()) +
|
||||
std::max({topRight.width(), right.width(), bottomRight.width()});
|
||||
const int height = std::max({topLeft.height(), top.height(), topRight.height()}) +
|
||||
std::max(left.height(), right.height()) +
|
||||
std::max({bottomLeft.height(), bottom.height(), bottomRight.height()});
|
||||
|
||||
if (width == 0 || height == 0) {
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue