Show video paused icon.

This commit is contained in:
John Preston 2021-06-08 14:50:41 +04:00
parent 7878552e7d
commit 5970f3de9e
7 changed files with 49 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View file

@ -1248,3 +1248,4 @@ groupCallNiceTooltipLabel: FlatLabel(defaultImportantTooltipLabel) {
} }
} }
groupCallNiceTooltipTop: 4px; groupCallNiceTooltipTop: 4px;
groupCallPaused: icon {{ "calls/video_large_paused", groupCallVideoTextFg }};

View file

@ -32,7 +32,7 @@ constexpr auto kBlurOpacity = 0.65;
constexpr auto kDitherNoiseAmount = 0.002; constexpr auto kDitherNoiseAmount = 0.002;
constexpr auto kMinCameraVisiblePart = 0.75; constexpr auto kMinCameraVisiblePart = 0.75;
constexpr auto kQuads = 7; constexpr auto kQuads = 8;
constexpr auto kQuadVertices = kQuads * 4; constexpr auto kQuadVertices = kQuads * 4;
constexpr auto kQuadValues = kQuadVertices * 4; constexpr auto kQuadValues = kQuadVertices * 4;
constexpr auto kValues = kQuadValues + 8; // Blur texture coordinates. constexpr auto kValues = kQuadValues + 8; // Blur texture coordinates.
@ -370,6 +370,7 @@ void Viewport::RendererGL::init(
}), }),
FragmentShader({ FragmentShader({
FragmentSampleARGB32Texture(), FragmentSampleARGB32Texture(),
FragmentGlobalOpacity(),
})); }));
validateNoiseTexture(f, 0); validateNoiseTexture(f, 0);
@ -569,6 +570,17 @@ void Viewport::RendererGL::paintTile(
texCoords.end()); texCoords.end());
} }
// Paused.
const auto &pauseIcon = st::groupCallPaused;
const auto pausedIcon = _buttons.texturedRect(
QRect(
geometry.x() + (geometry.width() - pauseIcon.width()) / 2,
geometry.y() + (geometry.height() - pauseIcon.height()) / 2,
pauseIcon.width(),
pauseIcon.height()),
_paused);
const auto pausedRect = transformRect(pausedIcon.geometry);
// Pin. // Pin.
const auto pin = _buttons.texturedRect( const auto pin = _buttons.texturedRect(
tile->pinInner().translated(x, y), tile->pinInner().translated(x, y),
@ -708,6 +720,19 @@ void Viewport::RendererGL::paintTile(
nameRect.left(), nameRect.bottom(), nameRect.left(), nameRect.bottom(),
name.texture.left(), name.texture.top(), name.texture.left(), name.texture.top(),
// Paused icon.
pausedRect.left(), pausedRect.top(),
pausedIcon.texture.left(), pausedIcon.texture.bottom(),
pausedRect.right(), pausedRect.top(),
pausedIcon.texture.right(), pausedIcon.texture.bottom(),
pausedRect.right(), pausedRect.bottom(),
pausedIcon.texture.right(), pausedIcon.texture.top(),
pausedRect.left(), pausedRect.bottom(),
pausedIcon.texture.left(), pausedIcon.texture.top(),
}; };
_frameBuffer->bind(); _frameBuffer->bind();
@ -779,7 +804,7 @@ void Viewport::RendererGL::paintTile(
const auto pinVisible = _owner->wide() const auto pinVisible = _owner->wide()
&& (pin.geometry.bottom() > y); && (pin.geometry.bottom() > y);
if (nameShift == fullNameShift && !pinVisible) { if (nameShift == fullNameShift && !pinVisible && paused == 0.) {
return; return;
} }
@ -796,15 +821,17 @@ void Viewport::RendererGL::paintTile(
f.glActiveTexture(GL_TEXTURE0); f.glActiveTexture(GL_TEXTURE0);
_buttons.bind(f); _buttons.bind(f);
if (paused > 0) {
_imageProgram->setUniformValue("g_opacity", GLfloat(paused));
FillTexturedRectangle(f, &*_imageProgram, 30);
}
_imageProgram->setUniformValue("g_opacity", GLfloat(1.f));
if (pinVisible) { if (pinVisible) {
FillTexturedRectangle(f, &*_imageProgram, 14); FillTexturedRectangle(f, &*_imageProgram, 14);
FillTexturedRectangle(f, &*_imageProgram, 18); FillTexturedRectangle(f, &*_imageProgram, 18);
} }
if (paused > 0.) {
}
if (nameShift == fullNameShift) { if (nameShift == fullNameShift) {
return; return;
} }
@ -1052,6 +1079,7 @@ void Viewport::RendererGL::ensureButtonsImage() {
const auto pinOffSize = VideoTile::PinInnerSize(false); const auto pinOffSize = VideoTile::PinInnerSize(false);
const auto backSize = VideoTile::BackInnerSize(); const auto backSize = VideoTile::BackInnerSize();
const auto muteSize = st::groupCallVideoCrossLine.icon.size(); const auto muteSize = st::groupCallVideoCrossLine.icon.size();
const auto pausedSize = st::groupCallPaused.size();
const auto fullSize = QSize( const auto fullSize = QSize(
std::max({ std::max({
@ -1059,11 +1087,13 @@ void Viewport::RendererGL::ensureButtonsImage() {
pinOffSize.width(), pinOffSize.width(),
backSize.width(), backSize.width(),
2 * muteSize.width(), 2 * muteSize.width(),
pausedSize.width(),
}), }),
(pinOnSize.height() (pinOnSize.height()
+ pinOffSize.height() + pinOffSize.height()
+ backSize.height() + backSize.height()
+ muteSize.height())); + muteSize.height()
+ pausedSize.height()));
const auto imageSize = fullSize * factor; const auto imageSize = fullSize * factor;
auto image = _buttons.takeImage(); auto image = _buttons.takeImage();
if (image.size() != imageSize) { if (image.size() != imageSize) {
@ -1085,9 +1115,8 @@ void Viewport::RendererGL::ensureButtonsImage() {
&_pinBackground, &_pinBackground,
&_pinIcon); &_pinIcon);
_pinOff = QRect( const auto pinOffTop = pinOnSize.height();
QPoint(0, pinOnSize.height()) * factor, _pinOff = QRect(QPoint(0, pinOffTop) * factor, pinOffSize * factor);
pinOffSize * factor);
VideoTile::PaintPinButton( VideoTile::PaintPinButton(
p, p,
false, false,
@ -1097,9 +1126,8 @@ void Viewport::RendererGL::ensureButtonsImage() {
&_pinBackground, &_pinBackground,
&_pinIcon); &_pinIcon);
_back = QRect( const auto backTop = pinOffTop + pinOffSize.height();
QPoint(0, pinOnSize.height() + pinOffSize.height()) * factor, _back = QRect(QPoint(0, backTop) * factor, backSize * factor);
backSize * factor);
VideoTile::PaintBackButton( VideoTile::PaintBackButton(
p, p,
0, 0,
@ -1107,9 +1135,7 @@ void Viewport::RendererGL::ensureButtonsImage() {
fullSize.width(), fullSize.width(),
&_pinBackground); &_pinBackground);
const auto muteTop = pinOnSize.height() const auto muteTop = backTop + backSize.height();
+ pinOffSize.height()
+ backSize.height();
_muteOn = QRect(QPoint(0, muteTop) * factor, muteSize * factor); _muteOn = QRect(QPoint(0, muteTop) * factor, muteSize * factor);
_muteIcon.paint(p, { 0, muteTop }, 1.); _muteIcon.paint(p, { 0, muteTop }, 1.);
@ -1117,6 +1143,10 @@ void Viewport::RendererGL::ensureButtonsImage() {
QPoint(muteSize.width(), muteTop) * factor, QPoint(muteSize.width(), muteTop) * factor,
muteSize * factor); muteSize * factor);
_muteIcon.paint(p, { muteSize.width(), muteTop }, 0.); _muteIcon.paint(p, { muteSize.width(), muteTop }, 0.);
const auto pausedTop = muteTop + muteSize.height();
_paused = QRect(QPoint(0, pausedTop) * factor, pausedSize * factor);
st::groupCallPaused.paint(p, 0, pausedTop, fullSize.width());
} }
_buttons.setImage(std::move(image)); _buttons.setImage(std::move(image));
} }

View file

@ -155,6 +155,7 @@ private:
QRect _back; QRect _back;
QRect _muteOn; QRect _muteOn;
QRect _muteOff; QRect _muteOff;
QRect _paused;
Ui::GL::Image _names; Ui::GL::Image _names;
std::vector<TileData> _tileData; std::vector<TileData> _tileData;

View file

@ -232,6 +232,7 @@ void Viewport::RendererSW::paintTileControls(
if (_pausedFrame) { if (_pausedFrame) {
p.fillRect(x, y, width, height, QColor(0, 0, 0, kShadowMaxAlpha)); p.fillRect(x, y, width, height, QColor(0, 0, 0, kShadowMaxAlpha));
st::groupCallPaused.paintInCenter(p, { x, y, width, height });
} }
const auto shown = _owner->_controlsShownRatio; const auto shown = _owner->_controlsShownRatio;