mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-31 17:41:16 +00:00
Try using progressive jpeg photo size.
This commit is contained in:
@@ -160,6 +160,9 @@ void UpdateCloudFile(
|
||||
Fn<void(FileOrigin)> restartLoader,
|
||||
Fn<void(QImage)> usePreloaded) {
|
||||
if (!data.location.valid()) {
|
||||
if (data.progressivePartSize && !file.location.valid()) {
|
||||
file.progressivePartSize = data.progressivePartSize;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -208,11 +211,18 @@ void LoadCloudFile(
|
||||
Fn<bool()> finalCheck,
|
||||
Fn<void(CloudFile&)> done,
|
||||
Fn<void(bool)> fail,
|
||||
Fn<void()> progress) {
|
||||
Fn<void()> progress,
|
||||
int downloadFrontPartSize = 0) {
|
||||
const auto loadSize = downloadFrontPartSize
|
||||
? downloadFrontPartSize
|
||||
: file.byteSize;
|
||||
if (file.loader) {
|
||||
if (fromCloud == LoadFromCloudOrLocal) {
|
||||
file.loader->permitLoadFromCloud();
|
||||
}
|
||||
if (file.loader->fullSize() < loadSize) {
|
||||
file.loader->increaseLoadSize(loadSize);
|
||||
}
|
||||
return;
|
||||
} else if ((file.flags & CloudFile::Flag::Failed)
|
||||
|| !file.location.valid()
|
||||
@@ -225,7 +235,7 @@ void LoadCloudFile(
|
||||
file.location.file(),
|
||||
origin,
|
||||
QString(),
|
||||
file.byteSize,
|
||||
loadSize,
|
||||
UnknownFileLocation,
|
||||
LoadToCacheAsWell,
|
||||
fromCloud,
|
||||
@@ -275,7 +285,8 @@ void LoadCloudFile(
|
||||
Fn<bool()> finalCheck,
|
||||
Fn<void(QImage)> done,
|
||||
Fn<void(bool)> fail,
|
||||
Fn<void()> progress) {
|
||||
Fn<void()> progress,
|
||||
int downloadFrontPartSize) {
|
||||
const auto callback = [=](CloudFile &file) {
|
||||
if (auto read = file.loader->imageData(); read.isNull()) {
|
||||
file.flags |= CloudFile::Flag::Failed;
|
||||
@@ -296,7 +307,8 @@ void LoadCloudFile(
|
||||
finalCheck,
|
||||
callback,
|
||||
std::move(fail),
|
||||
std::move(progress));
|
||||
std::move(progress),
|
||||
downloadFrontPartSize);
|
||||
}
|
||||
|
||||
void LoadCloudFile(
|
||||
|
||||
Reference in New Issue
Block a user