mirror of https://gitee.com/openkylin/kwin.git
修复圆角显示问题:半透明窗口圆角处不再绘制blur特效
This commit is contained in:
parent
12a53b86c7
commit
e54d2ffcd4
|
@ -11,6 +11,7 @@
|
|||
#include "blurshader.h"
|
||||
// KConfigSkeleton
|
||||
#include "blurconfig.h"
|
||||
#include "ubr/ubreffect.h"
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QMatrix4x4>
|
||||
|
@ -18,6 +19,7 @@
|
|||
#include <QTime>
|
||||
#include <QTimer>
|
||||
#include <QWindow>
|
||||
#include <QPainterPath>
|
||||
#include <cmath> // for ceil()
|
||||
|
||||
#include <KWaylandServer/surface_interface.h>
|
||||
|
@ -604,7 +606,22 @@ void BlurEffect::drawWindow(EffectWindow *w, int mask, const QRegion ®ion, Wi
|
|||
{
|
||||
const QRect screen = GLRenderTarget::virtualScreenGeometry();
|
||||
if (shouldBlur(w, mask, data)) {
|
||||
QRegion shape = region & blurRegion(w).translated(w->pos()) & screen;
|
||||
QRegion ubrRegion = w->geometry();
|
||||
bool shouldNotClip = w->isDesktop() || w->isDock() || w->isFullScreen();
|
||||
if (!w->data(UBREffect::DataRole::IgnoreUBR).isValid() && !shouldNotClip) {
|
||||
QVector4D ubr = qvariant_cast<QVector4D>(w->data(UBREffect::DataRole::UnityBorderRadius));
|
||||
if (!ubr.isNull()) {
|
||||
if (ubr.x() == ubr.y() && ubr.y() == ubr.z() && ubr.z() == ubr.w()) {
|
||||
QPainterPath ubrPath;
|
||||
ubrPath.addRoundedRect(w->geometry(), ubr.x(), ubr.x());
|
||||
ubrRegion = ubrPath.toFillPolygon().toPolygon();
|
||||
} else {
|
||||
// FIXME: implement unregular ubr blur region.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QRegion shape = region & blurRegion(w).translated(w->pos()) & screen & ubrRegion;
|
||||
|
||||
// let's do the evil parts - someone wants to blur behind a transformed window
|
||||
const bool translated = data.xTranslation() || data.yTranslation();
|
||||
|
|
Loading…
Reference in New Issue