2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Invert patter image to white for dark colors.

This commit is contained in:
John Preston
2021-09-07 00:15:38 +03:00
parent 4273167aa2
commit b6cd9c2911
4 changed files with 56 additions and 17 deletions

View File

@@ -985,6 +985,9 @@ void MainMenu::refreshMenu() {
}
void MainMenu::refreshBackground() {
if (IsFilledCover()) {
return;
}
const auto fill = QSize(st::mainMenuWidth, st::mainMenuCoverHeight);
const auto intensityText = IntensityOfColor(st::mainMenuCoverFg->c);
const auto background = Window::Theme::Background();
@@ -995,14 +998,14 @@ void MainMenu::refreshBackground() {
fill,
prepared.size());
auto backgroundImage = paper.isPattern()
auto backgroundImage = /*paper.isPattern()
? Ui::GenerateBackgroundImage(
fill * cIntRetinaFactor(),
paper.backgroundColors(),
paper.gradientRotation(),
paper.patternOpacity(),
[&](QPainter &p) { p.drawImage(rects.to, prepared, rects.from); })
: QImage(
: */QImage(
fill * cIntRetinaFactor(),
QImage::Format_ARGB32_Premultiplied);
QPainter p(&backgroundImage);
@@ -1019,20 +1022,20 @@ void MainMenu::refreshBackground() {
};
// Solid color.
if (const auto color = background->colorForFill()) {
const auto intensity = IntensityOfColor(*color);
p.fillRect(QRect(QPoint(), fill), *color);
if (std::abs(intensity - intensityText) < kMinDiffIntensity) {
drawShadow(p);
}
_background = backgroundImage;
return;
}
//if (const auto color = background->colorForFill()) {
// const auto intensity = IntensityOfColor(*color);
// p.fillRect(QRect(QPoint(), fill), *color);
// if (std::abs(intensity - intensityText) < kMinDiffIntensity) {
// drawShadow(p);
// }
// _background = backgroundImage;
// return;
//}
// Background image.
if (!paper.isPattern()) {
//if (!paper.isPattern()) {
p.drawImage(rects.to, prepared, rects.from);
}
//}
// Cut off the part of the background that is under text.
const QRect underText(