2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Fix single-colored patterns.

This commit is contained in:
John Preston
2021-08-20 16:24:26 +03:00
parent aaf0015be4
commit b4eb9a0827
2 changed files with 13 additions and 3 deletions

View File

@@ -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();