| 337 | } |
| 338 | |
| 339 | void SectionWidget::PaintBackground( |
| 340 | not_null<Window::SessionController*> controller, |
| 341 | not_null<Ui::ChatTheme*> theme, |
| 342 | not_null<QWidget*> widget, |
| 343 | QRect clip) { |
| 344 | if (const auto id = theme->background().giftId) { |
| 345 | const auto fillHeight = controller->content()->height(); |
| 346 | const auto fill = QSize(widget->width(), fillHeight); |
| 347 | const auto &state = theme->backgroundState(fill); |
| 348 | const auto make = [&] { |
| 349 | return MakeWrappedEmoji<Ui::Text::LimitedLoopsEmoji>( |
| 350 | controller->session().data().customEmojiManager().create( |
| 351 | id, |
| 352 | crl::guard(widget, [=] { widget->update(); }), |
| 353 | Data::CustomEmojiSizeTag::Isolated), |
| 354 | 1); |
| 355 | }; |
| 356 | if (!state.was.gift) { |
| 357 | state.was.gift = make(); |
| 358 | } |
| 359 | if (!state.now.gift) { |
| 360 | state.now.gift = make(); |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | PaintBackground( |
| 365 | theme, |
| 366 | widget, |
| 367 | controller->content()->height(), |
| 368 | controller->content()->backgroundFromY(), |
| 369 | clip, |
| 370 | controller->isGifPausedAtLeastFor(GifPauseReason::Any)); |
| 371 | } |
| 372 | |
| 373 | void SectionWidget::PaintBackground( |
| 374 | not_null<Ui::ChatTheme*> theme, |
nothing calls this directly
no test coverage detected