From e54d2ffcd43727edf518977dd1c8c05d91f5ab74 Mon Sep 17 00:00:00 2001 From: liujie01 Date: Tue, 6 Dec 2022 17:13:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=86=E8=A7=92=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98:=E5=8D=8A=E9=80=8F=E6=98=8E?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=9C=86=E8=A7=92=E5=A4=84=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E7=BB=98=E5=88=B6blur=E7=89=B9=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/effects/blur/blur.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/effects/blur/blur.cpp b/src/effects/blur/blur.cpp index 8ad95be1e..f4335c24e 100644 --- a/src/effects/blur/blur.cpp +++ b/src/effects/blur/blur.cpp @@ -11,6 +11,7 @@ #include "blurshader.h" // KConfigSkeleton #include "blurconfig.h" +#include "ubr/ubreffect.h" #include #include @@ -18,6 +19,7 @@ #include #include #include +#include #include // for ceil() #include @@ -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(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();