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

Implement progressive jpeg loading and sending.

This commit is contained in:
John Preston
2020-08-26 17:28:56 +04:00
parent 0888901d79
commit 437c9320cd
22 changed files with 201 additions and 96 deletions

View File

@@ -2147,7 +2147,10 @@ not_null<PhotoData*> Session::processPhoto(
const auto i = find(levels);
return (i == thumbs.end())
? ImageWithLocation()
: Images::FromImageInMemory(i->second, "JPG");
: Images::FromImageInMemory(
i->second.image,
"JPG",
i->second.bytes);
};
const auto small = image(SmallLevels);
const auto thumbnail = image(ThumbnailLevels);
@@ -2271,7 +2274,7 @@ void Session::photoApplyFields(
return 0;
});
};
const auto found = ranges::max_element(sizes, std::greater<>(), area);
const auto found = ranges::max_element(sizes, std::less<>(), area);
return (found == sizes.end()
|| found->type() != mtpc_photoSizeProgressive)
? sizes.end()