2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-03 08:05:12 +00:00

Use Images::Read instead of App::readImage.

This commit is contained in:
John Preston
2021-08-11 18:40:17 +03:00
parent b150ab8ef5
commit c79cd0b692
56 changed files with 155 additions and 293 deletions

View File

@@ -23,7 +23,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/crash_reports.h"
#include "base/bytes.h"
#include "base/openssl_help.h"
#include "app.h"
namespace {
@@ -163,11 +162,10 @@ void FileLoader::readImage(int progressiveSizeLimit) const {
const auto buffer = progressiveSizeLimit
? QByteArray::fromRawData(_data.data(), progressiveSizeLimit)
: _data;
auto format = QByteArray();
auto image = App::readImage(buffer, &format, false);
if (!image.isNull()) {
_imageData = std::move(image);
_imageFormat = format;
auto read = Images::Read({ .content = buffer });
if (!read.image.isNull()) {
_imageData = std::move(read.image);
_imageFormat = read.format;
}
}
@@ -290,13 +288,12 @@ void FileLoader::loadLocal(const Storage::Cache::Key &key) {
value = std::move(value),
done = std::move(callback)
]() mutable {
auto format = QByteArray();
auto image = App::readImage(value, &format, false);
if (!image.isNull()) {
auto read = Images::Read({ .content = value });
if (!read.image.isNull()) {
done(
std::move(value),
std::move(image),
std::move(format));
std::move(read.image),
std::move(read.format));
} else {
done(std::move(value), {}, {});
}