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

Animated transition on pattern-on-gradient resize.

This commit is contained in:
John Preston
2021-08-13 21:18:06 +03:00
parent b9a9520ef5
commit 3dadcd9352
17 changed files with 213 additions and 135 deletions

View File

@@ -988,10 +988,11 @@ void MainMenu::refreshBackground() {
const auto intensityText = IntensityOfColor(st::mainMenuCoverFg->c);
const auto background = Window::Theme::Background();
const auto &paper = background->paper();
const auto &pixmap = background->pixmap();
const auto &prepared = background->prepared();
QRect to, from;
const auto rects = Window::Theme::ComputeBackgroundRects(fill, pixmap.size());
const auto rects = Window::Theme::ComputeBackgroundRects(
fill,
prepared.size());
auto backgroundImage = !paper.backgroundColors().empty()
? Data::GenerateWallPaper(
@@ -999,7 +1000,7 @@ void MainMenu::refreshBackground() {
paper.backgroundColors(),
paper.gradientRotation(),
paper.patternOpacity(),
[&](QPainter &p) { p.drawPixmap(to, pixmap, from); })
[&](QPainter &p) { p.drawImage(rects.to, prepared, rects.from); })
: QImage(
fill * cIntRetinaFactor(),
QImage::Format_ARGB32_Premultiplied);
@@ -1029,7 +1030,7 @@ void MainMenu::refreshBackground() {
// Background image.
if (!paper.isPattern()) {
p.drawPixmap(to, pixmap, from);
p.drawImage(rects.to, prepared, rects.from);
}
// Cut off the part of the background that is under text.