40 return size.width() /
static_cast<float>(size.height());
50 , expanding{expanding}
148 newSize =
lastFrame->getSourceDimensions().size();
153 if (!qFuzzyCompare(newRatio,
ratio) && isVisible()) {
174 QPainter painter(
this);
175 painter.fillRect(painter.viewport(), Qt::black);
177 QImage frame =
lastFrame->toQImage(rect().size());
180 painter.drawImage(
boundingRect, frame, frame.rect(), Qt::NoFormatConversion);
183 QPixmap drawnAvatar =
avatar;
185 if (drawnAvatar.isNull())
189 painter.drawPixmap(
boundingRect, drawnAvatar, drawnAvatar.rect());
197 QWidget::resizeEvent(event);
215 QSize usableSize = contentsRect().size();
216 int possibleWidth = usableSize.height() *
ratio;
218 if (possibleWidth > usableSize.width())
219 size = (QSize(usableSize.width(), usableSize.width() /
ratio));
221 size = (QSize(possibleWidth, usableSize.height()));
223 pos.setX(width() / 2 - size.width() / 2);
224 pos.setY(height() / 2 - size.height() / 2);
225 boundingRect.setRect(pos.x(), pos.y(), size.width(), size.height());
234 bool expected =
false;
235 while (!
frameLock.compare_exchange_weak(expected,
true))