mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Implement progressive jpeg loading and sending.
This commit is contained in:
@@ -270,13 +270,15 @@ ImageWithLocation FromPhotoSize(
|
||||
|
||||
ImageWithLocation FromImageInMemory(
|
||||
const QImage &image,
|
||||
const char *format) {
|
||||
const char *format,
|
||||
QByteArray bytes) {
|
||||
if (image.isNull()) {
|
||||
return ImageWithLocation();
|
||||
}
|
||||
auto bytes = QByteArray();
|
||||
auto buffer = QBuffer(&bytes);
|
||||
image.save(&buffer, format);
|
||||
if (bytes.isEmpty()) {
|
||||
auto buffer = QBuffer(&bytes);
|
||||
image.save(&buffer, format);
|
||||
}
|
||||
return ImageWithLocation{
|
||||
.location = ImageLocation(
|
||||
DownloadLocation{ InMemoryLocation{ bytes } },
|
||||
|
@@ -41,7 +41,8 @@ namespace Images {
|
||||
const MTPVideoSize &size);
|
||||
[[nodiscard]] ImageWithLocation FromImageInMemory(
|
||||
const QImage &image,
|
||||
const char *format);
|
||||
const char *format,
|
||||
QByteArray bytes = QByteArray());
|
||||
[[nodiscard]] ImageLocation FromWebDocument(const MTPWebDocument &document);
|
||||
|
||||
} // namespace Images
|
||||
|
Reference in New Issue
Block a user