2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Replaced using of QPixmap in photo editor with Image.

This commit is contained in:
23rd
2021-02-20 07:27:10 +03:00
parent 3ce315111f
commit 671a06c407
7 changed files with 27 additions and 25 deletions

View File

@@ -619,23 +619,18 @@ void SendFilesBox::pushBlock(int from, int till) {
crl::guard(this, callback));
}, widget->lifetime());
const auto pp = std::make_shared<QPixmap>();
block.itemModifyRequest(
) | rpl::start_with_next([=, controller = _controller](int index) {
auto &file = _list.files[index];
if (file.type != Ui::PreparedFile::Type::Photo) {
return;
}
using Image = Ui::PreparedFileInformation::Image;
const auto image = std::get_if<Image>(&file.information->media);
using ImageInfo = Ui::PreparedFileInformation::Image;
const auto image = std::get_if<ImageInfo>(&file.information->media);
if (!image) {
return;
}
*pp = QPixmap::fromImage(
image->data,
Qt::ColorOnly);
auto callback = [=](const Editor::PhotoModifications &mods) {
image->modifications = mods;
Storage::UpdateImageDetails(
@@ -643,12 +638,13 @@ void SendFilesBox::pushBlock(int from, int till) {
st::sendMediaPreviewSize);
refreshAllAfterChanges(from);
};
auto copy = image->data;
const auto fileImage = std::make_shared<Image>(std::move(copy));
controller->showLayer(
std::make_unique<Editor::LayerWidget>(
this,
&controller->window(),
pp,
fileImage,
image->modifications,
std::move(callback)),
Ui::LayerOption::KeepOther);