mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Fix single-colored patterns.
This commit is contained in:
parent
aaf0015be4
commit
b4eb9a0827
2 changed files with 13 additions and 3 deletions
|
@ -983,9 +983,8 @@ void SetupChatBackground(
|
|||
}, tile->lifetime());
|
||||
|
||||
const auto shown = [=] {
|
||||
return !background->prepared().isNull()
|
||||
&& !background->colorForFill()
|
||||
&& background->gradientForFill().isNull();
|
||||
return !background->paper().isPattern()
|
||||
&& !background->colorForFill();
|
||||
};
|
||||
tile->toggle(shown(), anim::type::instant);
|
||||
|
||||
|
|
|
@ -151,6 +151,17 @@ void SectionWidget::PaintBackground(
|
|||
const auto &prepared = background->prepared();
|
||||
if (prepared.isNull()) {
|
||||
return;
|
||||
} else if (background->paper().isPattern()) {
|
||||
const auto w = prepared.width() * fill.height() / prepared.height();
|
||||
const auto cx = qCeil(fill.width() / float64(w));
|
||||
const auto cols = (cx / 2) * 2 + 1;
|
||||
const auto xshift = (fill.width() - w * cols) / 2;
|
||||
for (auto i = 0; i != cols; ++i) {
|
||||
p.drawImage(
|
||||
QRect(xshift + i * w, 0, w, fill.height()),
|
||||
prepared,
|
||||
QRect(QPoint(), prepared.size()));
|
||||
}
|
||||
} else if (background->tile()) {
|
||||
const auto &tiled = background->preparedForTiled();
|
||||
const auto left = clip.left();
|
||||
|
|
Loading…
Add table
Reference in a new issue