2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Save original bytes of a photo on "Save to disk".

This commit is contained in:
John Preston
2022-02-21 17:23:49 +03:00
parent c39f15bd71
commit 7718764294
8 changed files with 80 additions and 29 deletions

View File

@@ -296,7 +296,7 @@ void PhotoData::load(
}
return true;
};
const auto done = [=](QImage result) {
const auto done = [=](QImage result, QByteArray bytes) {
Expects(_images[valid].loader != nullptr);
// Find out what progressive photo size have we loaded exactly.
@@ -316,7 +316,8 @@ void PhotoData::load(
active->set(
validSize,
goodFor,
ValidatePhotoImage(std::move(result), _images[valid]));
ValidatePhotoImage(std::move(result), _images[valid]),
std::move(bytes));
}
if (validSize == PhotoSize::Large && goodFor == validSize) {
_owner->photoLoadDone(this);
@@ -382,14 +383,15 @@ void PhotoData::updateImages(
owner().cache(),
Data::kImageCacheTag,
[=](Data::FileOrigin origin) { load(size, origin); },
[=](QImage preloaded) {
[=](QImage preloaded, QByteArray bytes) {
if (const auto media = activeMediaView()) {
media->set(
size,
size,
ValidatePhotoImage(
std::move(preloaded),
_images[index]));
_images[index]),
std::move(bytes));
}
});
};