Add top window controls shadow.

This commit is contained in:
John Preston 2020-08-14 12:59:03 +04:00
parent fbe02dbb8d
commit 1b60829da8
6 changed files with 44 additions and 17 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

View file

@ -370,3 +370,4 @@ callTitle: WindowTitle(defaultWindowTitle) {
closeIconActive: callTitleCloseIcon;
closeIconActiveOver: callTitleCloseIconOver;
}
callTitleShadow: icon {{ "calls_shadow_controls", windowShadowFg }};

View file

@ -626,6 +626,45 @@ void Panel::initBottomShadow() {
_bottomShadow = Images::PixmapFast(std::move(image));
}
void Panel::fillTopShadow(QPainter &p, QRect incoming) {
#ifdef Q_OS_WIN
const auto width = widget()->width();
const auto position = QPoint(width - st::callTitleShadow.width(), 0);
const auto shadowArea = QRect(
position,
st::callTitleShadow.size());
const auto fill = shadowArea.intersected(incoming);
if (fill.isEmpty()) {
return;
}
p.save();
p.setClipRect(fill);
st::callTitleShadow.paint(p, position, width);
p.restore();
#endif // Q_OS_WIN
}
void Panel::fillBottomShadow(QPainter &p, QRect incoming) {
const auto shadowArea = QRect(
0,
widget()->height() - st::callBottomShadowSize,
widget()->width(),
st::callBottomShadowSize);
const auto fill = shadowArea.intersected(incoming);
if (fill.isEmpty()) {
return;
}
const auto factor = cIntRetinaFactor();
p.drawPixmap(
fill,
_bottomShadow,
QRect(
0,
factor * (fill.y() - shadowArea.y()),
factor,
factor * fill.height()));
}
void Panel::showControls() {
Expects(_call != nullptr);
@ -844,23 +883,8 @@ 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()));
}
fillBottomShadow(p, incoming);
fillTopShadow(p, incoming);
}
_call->videoIncoming()->markFrameShown();

View file

@ -95,6 +95,8 @@ private:
void startDurationUpdateTimer(crl::time currentDuration);
void fillFingerprint();
void setIncomingSize(QSize size);
void fillTopShadow(QPainter &p, QRect incoming);
void fillBottomShadow(QPainter &p, QRect incoming);
void refreshOutgoingPreviewInBody(State state);
void toggleFullScreen(bool fullscreen);