mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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());
|
}, tile->lifetime());
|
||||||
|
|
||||||
const auto shown = [=] {
|
const auto shown = [=] {
|
||||||
return !background->prepared().isNull()
|
return !background->paper().isPattern()
|
||||||
&& !background->colorForFill()
|
&& !background->colorForFill();
|
||||||
&& background->gradientForFill().isNull();
|
|
||||||
};
|
};
|
||||||
tile->toggle(shown(), anim::type::instant);
|
tile->toggle(shown(), anim::type::instant);
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,17 @@ void SectionWidget::PaintBackground(
|
||||||
const auto &prepared = background->prepared();
|
const auto &prepared = background->prepared();
|
||||||
if (prepared.isNull()) {
|
if (prepared.isNull()) {
|
||||||
return;
|
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()) {
|
} else if (background->tile()) {
|
||||||
const auto &tiled = background->preparedForTiled();
|
const auto &tiled = background->preparedForTiled();
|
||||||
const auto left = clip.left();
|
const auto left = clip.left();
|
||||||
|
|
Loading…
Add table
Reference in a new issue