diff --git a/Telegram/SourceFiles/calls/calls_panel.cpp b/Telegram/SourceFiles/calls/calls_panel.cpp index 8b05348d6..f334c4e78 100644 --- a/Telegram/SourceFiles/calls/calls_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_panel.cpp @@ -606,6 +606,24 @@ void Panel::initLayout() { } void Panel::initBottomShadow() { + auto image = QImage( + QSize(1, st::callBottomShadowSize) * cIntRetinaFactor(), + QImage::Format_ARGB32_Premultiplied); + const auto colorFrom = uint32(0); + const auto colorTill = uint32(74); + const auto rows = image.height(); + const auto step = (uint64(colorTill - colorFrom) << 32) / rows; + auto accumulated = uint64(); + auto bytes = image.bits(); + for (auto y = 0; y != rows; ++y) { + accumulated += step; + const auto color = (colorFrom + uint32(accumulated >> 32)) << 24; + for (auto x = 0; x != image.width(); ++x) { + *(reinterpret_cast(bytes) + x) = color; + } + bytes += image.bytesPerLine(); + } + _bottomShadow = Images::PixmapFast(std::move(image)); } void Panel::showControls() { @@ -826,6 +844,23 @@ void Panel::paint(QRect clip) { auto hq = PainterHighQualityEnabler(p); p.drawImage(incoming, frame); } + const auto shadowArea = QRect( + 0, + widget()->height() - st::callBottomShadowSize, + widget()->width(), + st::callBottomShadowSize); + const auto fill = shadowArea.intersected(incoming); + if (!fill.isEmpty()) { + const auto factor = cIntRetinaFactor(); + p.drawPixmap( + fill, + _bottomShadow, + QRect( + 0, + factor * (fill.y() - shadowArea.y()), + factor, + factor * fill.height())); + } } _call->videoIncoming()->markFrameShown();