forked from github_mirror/framelesshelper
Minor improvement
We could return in paintBackground(), so we may miss to call restore() Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
28c64a3725
commit
4b66c244fc
|
@ -177,14 +177,10 @@ void QtAcrylicEffectHelper::paintWindowBackground(QPainter *painter, const QRegi
|
||||||
if (!checkWindow()) {
|
if (!checkWindow()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO: should we limit it to Win32 only? Or should we do something about the
|
|
||||||
// acrylic brush instead?
|
|
||||||
if (Utilities::disableExtraProcessingForBlur()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setClipRegion(clip);
|
painter->setClipRegion(clip);
|
||||||
paintBackground(painter, clip.boundingRect());
|
paintBackground(painter, clip.boundingRect());
|
||||||
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtAcrylicEffectHelper::paintWindowBackground(QPainter *painter, const QRect &rect)
|
void QtAcrylicEffectHelper::paintWindowBackground(QPainter *painter, const QRect &rect)
|
||||||
|
@ -197,14 +193,10 @@ void QtAcrylicEffectHelper::paintWindowBackground(QPainter *painter, const QRect
|
||||||
if (!checkWindow()) {
|
if (!checkWindow()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO: should we limit it to Win32 only? Or should we do something about the
|
|
||||||
// acrylic brush instead?
|
|
||||||
if (Utilities::disableExtraProcessingForBlur()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setClipRegion({rect});
|
painter->setClipRegion({rect});
|
||||||
paintBackground(painter, rect);
|
paintBackground(painter, rect);
|
||||||
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtAcrylicEffectHelper::paintBackground(QPainter *painter, const QRect &rect)
|
void QtAcrylicEffectHelper::paintBackground(QPainter *painter, const QRect &rect)
|
||||||
|
@ -217,6 +209,11 @@ void QtAcrylicEffectHelper::paintBackground(QPainter *painter, const QRect &rect
|
||||||
if (!checkWindow()) {
|
if (!checkWindow()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// TODO: should we limit it to Win32 only? Or should we do something about the
|
||||||
|
// acrylic brush instead?
|
||||||
|
if (Utilities::disableExtraProcessingForBlur()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (Utilities::shouldUseTraditionalBlur()) {
|
if (Utilities::shouldUseTraditionalBlur()) {
|
||||||
const QPainter::CompositionMode mode = painter->compositionMode();
|
const QPainter::CompositionMode mode = painter->compositionMode();
|
||||||
painter->setCompositionMode(QPainter::CompositionMode_Clear);
|
painter->setCompositionMode(QPainter::CompositionMode_Clear);
|
||||||
|
@ -230,7 +227,6 @@ void QtAcrylicEffectHelper::paintBackground(QPainter *painter, const QRect &rect
|
||||||
painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
|
painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
|
||||||
painter->setOpacity(1);
|
painter->setOpacity(1);
|
||||||
painter->fillRect(rect, m_acrylicBrush);
|
painter->fillRect(rect, m_acrylicBrush);
|
||||||
painter->restore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtAcrylicEffectHelper::paintWindowFrame(QPainter *painter, const QRect &rect)
|
void QtAcrylicEffectHelper::paintWindowFrame(QPainter *painter, const QRect &rect)
|
||||||
|
|
Loading…
Reference in New Issue