mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-08 08:04:08 +02:00
Use unique_id for tiles instead of PeerData*.
This commit is contained in:
parent
e1614a280f
commit
0771fc14db
3 changed files with 14 additions and 8 deletions
|
@ -89,8 +89,6 @@ public:
|
||||||
[[nodiscard]] rpl::producer<VideoQualityRequest> qualityRequests() const;
|
[[nodiscard]] rpl::producer<VideoQualityRequest> qualityRequests() const;
|
||||||
[[nodiscard]] rpl::producer<bool> mouseInsideValue() const;
|
[[nodiscard]] rpl::producer<bool> mouseInsideValue() const;
|
||||||
|
|
||||||
[[nodiscard]] uint32 defaultFramebufferObject() const;
|
|
||||||
|
|
||||||
[[nodiscard]] rpl::lifetime &lifetime();
|
[[nodiscard]] rpl::lifetime &lifetime();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -136,8 +134,8 @@ private:
|
||||||
[[nodiscard]] Ui::GL::ChosenRenderer chooseRenderer(
|
[[nodiscard]] Ui::GL::ChosenRenderer chooseRenderer(
|
||||||
Ui::GL::Capabilities capabilities);
|
Ui::GL::Capabilities capabilities);
|
||||||
|
|
||||||
bool _opengl = false;
|
|
||||||
PanelMode _mode = PanelMode();
|
PanelMode _mode = PanelMode();
|
||||||
|
bool _opengl = false;
|
||||||
bool _geometryStaleAfterModeChange = false;
|
bool _geometryStaleAfterModeChange = false;
|
||||||
const std::unique_ptr<Ui::RpWidgetWrap> _content;
|
const std::unique_ptr<Ui::RpWidgetWrap> _content;
|
||||||
std::vector<std::unique_ptr<VideoTile>> _tiles;
|
std::vector<std::unique_ptr<VideoTile>> _tiles;
|
||||||
|
|
|
@ -936,13 +936,15 @@ void Viewport::RendererGL::validateDatas() {
|
||||||
if (width > available) {
|
if (width > available) {
|
||||||
available = width;
|
available = width;
|
||||||
}
|
}
|
||||||
const auto peer = tiles[i]->row()->peer();
|
const auto id = quintptr(tiles[i]->track().get());
|
||||||
const auto j = ranges::find(_tileData, peer, &TileData::peer);
|
const auto j = ranges::find(_tileData, id, &TileData::id);
|
||||||
if (j != end(_tileData)) {
|
if (j != end(_tileData)) {
|
||||||
j->stale = false;
|
j->stale = false;
|
||||||
const auto index = (j - begin(_tileData));
|
const auto index = (j - begin(_tileData));
|
||||||
_tileDataIndices[i] = index;
|
_tileDataIndices[i] = index;
|
||||||
if (peer->nameVersion != j->nameVersion
|
const auto peer = tiles[i]->row()->peer();
|
||||||
|
if (peer != j->peer
|
||||||
|
|| peer->nameVersion != j->nameVersion
|
||||||
|| width != j->nameRect.width()) {
|
|| width != j->nameRect.width()) {
|
||||||
const auto nameTop = index * nameHeight;
|
const auto nameTop = index * nameHeight;
|
||||||
j->nameRect = QRect(0, nameTop, width, nameHeight);
|
j->nameRect = QRect(0, nameTop, width, nameHeight);
|
||||||
|
@ -963,6 +965,7 @@ void Viewport::RendererGL::validateDatas() {
|
||||||
if (_tileDataIndices[i] >= 0) {
|
if (_tileDataIndices[i] >= 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
const auto id = quintptr(tiles[i]->track().get());
|
||||||
const auto peer = tiles[i]->row()->peer();
|
const auto peer = tiles[i]->row()->peer();
|
||||||
auto index = int(_tileData.size());
|
auto index = int(_tileData.size());
|
||||||
maybeStaleAfter = ranges::find(
|
maybeStaleAfter = ranges::find(
|
||||||
|
@ -972,12 +975,16 @@ void Viewport::RendererGL::validateDatas() {
|
||||||
&TileData::stale);
|
&TileData::stale);
|
||||||
if (maybeStaleAfter != maybeStaleEnd) {
|
if (maybeStaleAfter != maybeStaleEnd) {
|
||||||
index = (maybeStaleAfter - begin(_tileData));
|
index = (maybeStaleAfter - begin(_tileData));
|
||||||
|
maybeStaleAfter->id = id;
|
||||||
maybeStaleAfter->peer = peer;
|
maybeStaleAfter->peer = peer;
|
||||||
maybeStaleAfter->stale = false;
|
maybeStaleAfter->stale = false;
|
||||||
request.updating = true;
|
request.updating = true;
|
||||||
} else {
|
} else {
|
||||||
// This invalidates maybeStale*, but they're already equal.
|
// This invalidates maybeStale*, but they're already equal.
|
||||||
_tileData.push_back({ .peer = peer });
|
_tileData.push_back({
|
||||||
|
.id = id,
|
||||||
|
.peer = peer,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
_tileData[index].nameVersion = peer->nameVersion;
|
_tileData[index].nameVersion = peer->nameVersion;
|
||||||
_tileData[index].nameRect = QRect(
|
_tileData[index].nameRect = QRect(
|
||||||
|
|
|
@ -47,13 +47,14 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct TileData {
|
struct TileData {
|
||||||
not_null<PeerData*> peer;
|
quintptr id = 0;
|
||||||
Ui::GL::Textures<5> textures;
|
Ui::GL::Textures<5> textures;
|
||||||
Ui::GL::Framebuffers<2> framebuffers;
|
Ui::GL::Framebuffers<2> framebuffers;
|
||||||
mutable int textureIndex = 0;
|
mutable int textureIndex = 0;
|
||||||
mutable int trackIndex = -1;
|
mutable int trackIndex = -1;
|
||||||
Ui::Animations::Simple outlined;
|
Ui::Animations::Simple outlined;
|
||||||
QRect nameRect;
|
QRect nameRect;
|
||||||
|
not_null<PeerData*> peer;
|
||||||
int nameVersion = 0;
|
int nameVersion = 0;
|
||||||
bool stale = false;
|
bool stale = false;
|
||||||
bool outline = false;
|
bool outline = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue