mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/telegramdesktop/tdesktop
synced 2026-09-20 08:03:45 +08:00
Replaced qFloor with int(std::floor()).
This commit is contained in:
@@ -1019,7 +1019,12 @@ void ShareBox::Inner::repaintChatAtIndex(int index) {
|
||||
|
||||
auto row = index / _columnCount;
|
||||
auto column = index % _columnCount;
|
||||
update(style::rtlrect(_rowsLeft + qFloor(column * _rowWidthReal), row * _rowHeight, _rowWidth, _rowHeight, width()));
|
||||
update(style::rtlrect(
|
||||
_rowsLeft + int(std::floor(column * _rowWidthReal)),
|
||||
row * _rowHeight,
|
||||
_rowWidth,
|
||||
_rowHeight,
|
||||
width()));
|
||||
}
|
||||
|
||||
ShareBox::Inner::Chat *ShareBox::Inner::getChatAtIndex(int index) {
|
||||
@@ -1192,7 +1197,8 @@ void ShareBox::Inner::paintChat(
|
||||
Painter &p,
|
||||
not_null<Chat*> chat,
|
||||
int index) {
|
||||
auto x = _rowsLeft + qFloor((index % _columnCount) * _rowWidthReal);
|
||||
auto x = _rowsLeft
|
||||
+ int(std::floor((index % _columnCount) * _rowWidthReal));
|
||||
auto y = _rowsTop + (index / _columnCount) * _rowHeight;
|
||||
|
||||
auto outerWidth = width();
|
||||
@@ -1329,14 +1335,16 @@ void ShareBox::Inner::mouseMoveEvent(QMouseEvent *e) {
|
||||
void ShareBox::Inner::updateUpon(const QPoint &pos) {
|
||||
auto x = pos.x(), y = pos.y();
|
||||
auto row = (y - _rowsTop) / _rowHeight;
|
||||
auto column = qFloor((x - _rowsLeft) / _rowWidthReal);
|
||||
auto column = int(std::floor((x - _rowsLeft) / _rowWidthReal));
|
||||
|
||||
if (column < 0 || column >= _columnCount) {
|
||||
_upon = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
auto left = _rowsLeft + qFloor(column * _rowWidthReal) + st::shareColumnSkip / 2;
|
||||
auto left = _rowsLeft
|
||||
+ int(std::floor(column * _rowWidthReal))
|
||||
+ st::shareColumnSkip / 2;
|
||||
auto top = _rowsTop + row * _rowHeight + st::sharePhotoTop;
|
||||
auto xupon = (x >= left) && (x < left + (_rowWidth - st::shareColumnSkip));
|
||||
auto yupon = (y >= top) && (y < top + _st.item.checkbox.imageRadius * 2 + st::shareNameTop + _st.item.nameStyle.font->height * 2);
|
||||
@@ -1361,8 +1369,8 @@ void ShareBox::Inner::selectActive() {
|
||||
void ShareBox::Inner::resizeEvent(QResizeEvent *e) {
|
||||
_columnSkip = (width() - _columnCount * _st.item.checkbox.imageRadius * 2) / float64(_columnCount + 1);
|
||||
_rowWidthReal = _st.item.checkbox.imageRadius * 2 + _columnSkip;
|
||||
_rowsLeft = qFloor(_columnSkip / 2);
|
||||
_rowWidth = qFloor(_rowWidthReal);
|
||||
_rowsLeft = int(std::floor(_columnSkip / 2));
|
||||
_rowWidth = int(std::floor(_rowWidthReal));
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
@@ -2076,8 +2076,12 @@ not_null<Lottie::MultiPlayer*> StickerSetBox::Inner::getLottiePlayer() {
|
||||
int32 StickerSetBox::Inner::stickerFromGlobalPos(const QPoint &p) const {
|
||||
QPoint l(mapFromGlobal(p));
|
||||
if (rtl()) l.setX(width() - l.x());
|
||||
int32 row = (l.y() >= _padding.top()) ? qFloor((l.y() - _padding.top()) / _singleSize.height()) : -1;
|
||||
int32 col = (l.x() >= _padding.left()) ? qFloor((l.x() - _padding.left()) / _singleSize.width()) : -1;
|
||||
int32 row = (l.y() >= _padding.top())
|
||||
? int(std::floor((l.y() - _padding.top()) / _singleSize.height()))
|
||||
: -1;
|
||||
int32 col = (l.x() >= _padding.left())
|
||||
? int(std::floor((l.x() - _padding.left()) / _singleSize.width()))
|
||||
: -1;
|
||||
if (row >= 0 && col >= 0 && col < _perRow) {
|
||||
int32 result = row * _perRow + col;
|
||||
// _elements, not _pack: premium stickers are skipped from _elements
|
||||
@@ -2098,7 +2102,8 @@ void StickerSetBox::Inner::paintEvent(QPaintEvent *e) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32 from = qFloor(e->rect().top() / _singleSize.height()), to = qFloor(e->rect().bottom() / _singleSize.height()) + 1;
|
||||
int32 from = int(std::floor(e->rect().top() / _singleSize.height()));
|
||||
int32 to = int(std::floor(e->rect().bottom() / _singleSize.height())) + 1;
|
||||
|
||||
_pathGradient->startFrame(0, width(), width() / 2);
|
||||
|
||||
|
||||
@@ -434,8 +434,9 @@ FingerprintBadge SetupFingerprintBadge(
|
||||
}
|
||||
|
||||
if (entry.position >= kEmojiInCarousel) {
|
||||
entry.position -= qFloor(entry.position / kEmojiInCarousel)
|
||||
* kEmojiInCarousel;
|
||||
const auto turns
|
||||
= int(std::floor(entry.position / kEmojiInCarousel));
|
||||
entry.position -= turns * kEmojiInCarousel;
|
||||
}
|
||||
while (entry.position >= 1.) {
|
||||
Assert(!entry.sliding.empty());
|
||||
|
||||
@@ -4020,7 +4020,11 @@ void EmojiListWidget::updateSelected() {
|
||||
} else if (p.y() >= info.rowsTop && p.y() < info.rowsBottom) {
|
||||
auto sx = (rtl() ? width() - p.x() : p.x()) - _rowsLeft;
|
||||
if (sx >= 0 && sx < _columnCount * _singleSize.width()) {
|
||||
const auto index = qFloor((p.y() - info.rowsTop) / _singleSize.height()) * _columnCount + qFloor(sx / _singleSize.width());
|
||||
const auto rowIndex = int(std::floor(
|
||||
(p.y() - info.rowsTop) / _singleSize.height()));
|
||||
const auto columnIndex
|
||||
= int(std::floor(sx / _singleSize.width()));
|
||||
const auto index = rowIndex * _columnCount + columnIndex;
|
||||
if (index < info.count) {
|
||||
newSelected = OverEmoji{ .section = section, .index = index };
|
||||
}
|
||||
|
||||
@@ -1173,7 +1173,9 @@ void FieldAutocomplete::Inner::paintEvent(QPaintEvent *e) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int32 from = qFloor(e->rect().top() / st::mentionHeight), to = qFloor(e->rect().bottom() / st::mentionHeight) + 1;
|
||||
int32 from = int(std::floor(e->rect().top() / st::mentionHeight));
|
||||
int32 to = int(std::floor(e->rect().bottom() / st::mentionHeight))
|
||||
+ 1;
|
||||
int32 last = !_mrows->empty()
|
||||
? _mrows->size()
|
||||
: !_hrows->empty()
|
||||
|
||||
@@ -3687,8 +3687,10 @@ void StickersListWidget::updateSelected() {
|
||||
newSelected = OverGroupAdd{};
|
||||
}
|
||||
} else {
|
||||
const auto rowIndex = qFloor(yOffset / _singleSize.height());
|
||||
const auto columnIndex = qFloor(sx / _singleSize.width());
|
||||
const auto rowIndex
|
||||
= int(std::floor(yOffset / _singleSize.height()));
|
||||
const auto columnIndex
|
||||
= int(std::floor(sx / _singleSize.width()));
|
||||
const auto index = rowIndex * _columnCount + columnIndex;
|
||||
if (index >= 0 && index < set.stickers.size()) {
|
||||
auto overDelete = false;
|
||||
|
||||
@@ -2917,8 +2917,8 @@ void OverlayWidget::zoomOut(std::optional<QPoint> anchor) {
|
||||
auto newZoom = _zoom;
|
||||
const auto full = _fullScreenVideo ? _zoomToScreen : _zoomToDefault;
|
||||
if (newZoom == kZoomToScreenLevel) {
|
||||
if (qFloor(full) >= -kMaxZoomLevel) {
|
||||
newZoom = qFloor(full);
|
||||
if (int(std::floor(full)) >= -kMaxZoomLevel) {
|
||||
newZoom = int(std::floor(full));
|
||||
}
|
||||
} else {
|
||||
if (newZoom > full && (newZoom - 1 < full || (full < -kMaxZoomLevel && newZoom == -kMaxZoomLevel))) {
|
||||
@@ -2937,7 +2937,7 @@ void OverlayWidget::zoomReset() {
|
||||
auto newZoom = _zoom;
|
||||
const auto full = _fullScreenVideo ? _zoomToScreen : _zoomToDefault;
|
||||
if (_zoom == 0) {
|
||||
if (qFloor(full) == int(std::ceil(full))
|
||||
if (int(std::floor(full)) == int(std::ceil(full))
|
||||
&& qRound(full) >= -kMaxZoomLevel
|
||||
&& qRound(full) <= kMaxZoomLevel) {
|
||||
newZoom = qRound(full);
|
||||
|
||||
@@ -498,8 +498,8 @@ void SectionWidget::PaintBackground(
|
||||
const auto bottom = clip.top() + clip.height();
|
||||
const auto w = tiled.width() / float64(style::DevicePixelRatio());
|
||||
const auto h = tiled.height() / float64(style::DevicePixelRatio());
|
||||
const auto sx = qFloor(left / w);
|
||||
const auto sy = qFloor(top / h);
|
||||
const auto sx = int(std::floor(left / w));
|
||||
const auto sy = int(std::floor(top / h));
|
||||
const auto cx = int(std::ceil(right / w));
|
||||
const auto cy = int(std::ceil(bottom / h));
|
||||
for (auto i = sx; i < cx; ++i) {
|
||||
|
||||
Submodule Telegram/lib_ui updated: 672d04b164...a7fec59f14
Reference in New Issue
Block a user