| 1842 | } |
| 1843 | |
| 1844 | crl::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); |
nothing calls this directly
no test coverage detected