2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +00:00

Pass FileOrigin in all file downloads.

This commit is contained in:
John Preston
2018-07-14 00:25:47 +03:00
parent ee16070abe
commit 839885910c
67 changed files with 1021 additions and 510 deletions

View File

@@ -187,7 +187,7 @@ void PeerData::setUserpicPhoto(const MTPPhoto &data) {
ImagePtr PeerData::currentUserpic() const {
if (_userpic) {
_userpic->load();
_userpic->load(userpicPhotoOrigin());
if (_userpic->loaded()) {
if (!useEmptyUserpic()) {
_userpicEmpty = nullptr;
@@ -200,7 +200,7 @@ ImagePtr PeerData::currentUserpic() const {
void PeerData::paintUserpic(Painter &p, int x, int y, int size) const {
if (auto userpic = currentUserpic()) {
p.drawPixmap(x, y, userpic->pixCircled(size, size));
p.drawPixmap(x, y, userpic->pixCircled(userpicPhotoOrigin(), size, size));
} else {
_userpicEmpty->paint(p, x, y, x + size + x, size);
}
@@ -208,7 +208,7 @@ void PeerData::paintUserpic(Painter &p, int x, int y, int size) const {
void PeerData::paintUserpicRounded(Painter &p, int x, int y, int size) const {
if (auto userpic = currentUserpic()) {
p.drawPixmap(x, y, userpic->pixRounded(size, size, ImageRoundRadius::Small));
p.drawPixmap(x, y, userpic->pixRounded(userpicPhotoOrigin(), size, size, ImageRoundRadius::Small));
} else {
_userpicEmpty->paintRounded(p, x, y, x + size + x, size);
}
@@ -216,7 +216,7 @@ void PeerData::paintUserpicRounded(Painter &p, int x, int y, int size) const {
void PeerData::paintUserpicSquare(Painter &p, int x, int y, int size) const {
if (auto userpic = currentUserpic()) {
p.drawPixmap(x, y, userpic->pix(size, size));
p.drawPixmap(x, y, userpic->pix(userpicPhotoOrigin(), size, size));
} else {
_userpicEmpty->paintSquare(p, x, y, x + size + x, size);
}
@@ -239,7 +239,7 @@ void PeerData::saveUserpicRounded(const QString &path, int size) const {
QPixmap PeerData::genUserpic(int size) const {
if (auto userpic = currentUserpic()) {
return userpic->pixCircled(size, size);
return userpic->pixCircled(userpicPhotoOrigin(), size, size);
}
auto result = QImage(QSize(size, size) * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
result.setDevicePixelRatio(cRetinaFactor());
@@ -253,7 +253,7 @@ QPixmap PeerData::genUserpic(int size) const {
QPixmap PeerData::genUserpicRounded(int size) const {
if (auto userpic = currentUserpic()) {
return userpic->pixRounded(size, size, ImageRoundRadius::Small);
return userpic->pixRounded(userpicPhotoOrigin(), size, size, ImageRoundRadius::Small);
}
auto result = QImage(QSize(size, size) * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
result.setDevicePixelRatio(cRetinaFactor());