MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / paintPaper

Method paintPaper

Telegram/SourceFiles/boxes/background_box.cpp:690–722  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

688}
689
690void BackgroundBox::Inner::paintPaper(
691 QPainter &p,
692 const Paper &paper,
693 int column,
694 int row) const {
695 const auto x = st::backgroundPadding + column * (st::backgroundSize.width() + st::backgroundPadding);
696 const auto y = st::backgroundPadding + row * (st::backgroundSize.height() + st::backgroundPadding);
697 validatePaperThumbnail(paper);
698 if (!paper.thumbnail.isNull()) {
699 p.drawPixmap(x, y, paper.thumbnail);
700 }
701
702 const auto over = !v::is_null(_overDown) ? _overDown : _over;
703 if (paper.data.id() == _currentId) {
704 const auto checkLeft = x + st::backgroundSize.width() - st::overviewCheckSkip - st::overviewCheck.size;
705 const auto checkTop = y + st::backgroundSize.height() - st::overviewCheckSkip - st::overviewCheck.size;
706 _check->paint(p, checkLeft, checkTop, width());
707 } else if (!forChannel()
708 && Data::IsCloudWallPaper(paper.data)
709 && !Data::IsDefaultWallPaper(paper.data)
710 && !Data::IsLegacy2DefaultWallPaper(paper.data)
711 && !Data::IsLegacy3DefaultWallPaper(paper.data)
712 && !v::is_null(over)
713 && (&paper == &_papers[getSelectionIndex(over)])) {
714 const auto deleteSelected = v::is<DeleteSelected>(over);
715 const auto deletePos = QPoint(x + st::backgroundSize.width() - st::stickerPanDeleteIconBg.width(), y);
716 p.setOpacity(deleteSelected ? st::stickerPanDeleteOpacityBgOver : st::stickerPanDeleteOpacityBg);
717 st::stickerPanDeleteIconBg.paint(p, deletePos, width());
718 p.setOpacity(deleteSelected ? st::stickerPanDeleteOpacityFgOver : st::stickerPanDeleteOpacityFg);
719 st::stickerPanDeleteIconFg.paint(p, deletePos, width());
720 p.setOpacity(1.);
721 }
722}
723
724void BackgroundBox::Inner::mouseMoveEvent(QMouseEvent *e) {
725 const auto newOver = [&] {

Callers

nothing calls this directly

Calls 10

IsCloudWallPaperFunction · 0.85
IsDefaultWallPaperFunction · 0.85
widthMethod · 0.45
heightMethod · 0.45
isNullMethod · 0.45
idMethod · 0.45
paintMethod · 0.45
setOpacityMethod · 0.45

Tested by

no test coverage detected