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

Method paintRow

Telegram/SourceFiles/boxes/peer_list_box.cpp:1844–1993  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1842}
1843
1844crl::time PeerListContent::paintRow(
1845 Painter &p,
1846 crl::time now,
1847 RowIndex index) {
1848 const auto row = getRow(index);
1849 Assert(row != nullptr);
1850
1851 const auto &st = row->computeSt(_st.item);
1852
1853 row->lazyInitialize(st);
1854 const auto outerWidth = width();
1855
1856 auto refreshStatusAt = row->refreshStatusTime();
1857 if (refreshStatusAt > 0 && now >= refreshStatusAt) {
1858 row->refreshStatus();
1859 refreshStatusAt = row->refreshStatusTime();
1860 }
1861 const auto refreshStatusIn = (refreshStatusAt > 0)
1862 ? std::max(refreshStatusAt - now, crl::time(1))
1863 : 0;
1864
1865 const auto peer = row->special() ? nullptr : row->peer().get();
1866 const auto active = (_contexted.index.value >= 0)
1867 ? _contexted
1868 : (_pressed.index.value >= 0)
1869 ? _pressed
1870 : _selected;
1871 const auto selected = (active.index == index)
1872 && (!active.element || !row->elementOnlySelect(active.element));
1873
1874 if (_mode == Mode::Custom) {
1875 _controller->customRowPaint(p, now, row, selected);
1876 return refreshStatusIn;
1877 }
1878
1879 const auto opacity = row->opacity();
1880 const auto &bg = selected
1881 ? st.button.textBgOver
1882 : st.button.textBg;
1883 if (opacity < 1.) {
1884 p.setOpacity(opacity);
1885 }
1886 const auto guard = gsl::finally([&] {
1887 if (opacity < 1.) {
1888 p.setOpacity(1.);
1889 }
1890 });
1891
1892 p.fillRect(0, 0, outerWidth, _rowHeight, bg);
1893 row->paintRipple(p, st, 0, 0, outerWidth);
1894 row->paintUserpic(
1895 p,
1896 st,
1897 st.photoPosition.x(),
1898 st.photoPosition.y(),
1899 outerWidth);
1900
1901 p.setPen(st::contactsNameFg);

Callers

nothing calls this directly

Calls 15

refreshStatusTimeMethod · 0.80
specialMethod · 0.80
customRowPaintMethod · 0.80
checkedRatioMethod · 0.80
isSearchResultMethod · 0.80
lazyInitializeMethod · 0.45
refreshStatusMethod · 0.45
getMethod · 0.45
peerMethod · 0.45
elementOnlySelectMethod · 0.45
opacityMethod · 0.45
setOpacityMethod · 0.45

Tested by

no test coverage detected