core/window: premultiply background colors

Apparently these are supposed to be premultiplied. Some docs would be nice.
This commit is contained in:
outfoxxed 2024-09-10 00:01:17 -07:00
parent 2c485e415d
commit 19d74595d6
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
2 changed files with 14 additions and 21 deletions

View file

@ -287,16 +287,23 @@ QuickshellScreenInfo* ProxyWindowBase::screen() const {
return QuickshellTracked::instance()->screenInfo(qscreen);
}
QColor ProxyWindowBase::color() const {
if (this->window == nullptr) return this->mColor;
else return this->window->color();
}
QColor ProxyWindowBase::color() const { return this->mColor; }
void ProxyWindowBase::setColor(QColor color) {
this->mColor = color;
if (this->window == nullptr) {
this->mColor = color;
emit this->colorChanged();
} else this->window->setColor(color);
if (color != this->mColor) emit this->colorChanged();
} else {
auto premultiplied = QColor::fromRgbF(
color.redF() * color.alphaF(),
color.greenF() * color.alphaF(),
color.blueF() * color.alphaF(),
color.alphaF()
);
this->window->setColor(premultiplied);
}
}
PendingRegion* ProxyWindowBase::mask() const { return this->mMask; }