2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Replaced MatrixRowShift with layout utils.

This commit is contained in:
23rd
2021-07-23 02:11:27 +03:00
committed by John Preston
parent a153059b38
commit 73bb1382b1
4 changed files with 32 additions and 27 deletions

View File

@@ -8,15 +8,20 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "layout/layout_utils.h"
namespace Layout {
namespace {
constexpr auto kMatrixRowShift = 40000;
} // namespace
Layout::Position IndexToPosition(int index) {
return {
(index >= 0) ? (index / MatrixRowShift) : -1,
(index >= 0) ? (index % MatrixRowShift) : -1 };
(index >= 0) ? (index / kMatrixRowShift) : -1,
(index >= 0) ? (index % kMatrixRowShift) : -1 };
}
int PositionToIndex(int row, int column) {
return row * MatrixRowShift + column;
return row * kMatrixRowShift + column;
}
int PositionToIndex(const Layout::Position &position) {