mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
fix: message shot crashes
This commit is contained in:
parent
132caa18c9
commit
a87fb9160c
1 changed files with 34 additions and 5 deletions
|
@ -16,6 +16,7 @@
|
||||||
#include "data/data_forum.h"
|
#include "data/data_forum.h"
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
|
#include "dialogs/ui/dialogs_video_userpic.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "history/history_inner_widget.h"
|
#include "history/history_inner_widget.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
|
@ -359,6 +360,9 @@ QImage Make(not_null<QWidget*> box, const ShotConfig &config) {
|
||||||
|
|
||||||
const auto viewport = QRect(0, 0, width, height);
|
const auto viewport = QRect(0, 0, width, height);
|
||||||
|
|
||||||
|
base::flat_map<not_null<PeerData*>, Ui::PeerUserpicView> userpics;
|
||||||
|
base::flat_map<MsgId, Ui::PeerUserpicView> hiddenSenderUserpics;
|
||||||
|
|
||||||
Painter p(&image);
|
Painter p(&image);
|
||||||
|
|
||||||
// draw the messages
|
// draw the messages
|
||||||
|
@ -385,11 +389,36 @@ QImage Make(not_null<QWidget*> box, const ShotConfig &config) {
|
||||||
const auto picX = st::msgMargin.left();
|
const auto picX = st::msgMargin.left();
|
||||||
const auto picY = y + view->height() - st::msgPhotoSize;
|
const auto picY = y + view->height() - st::msgPhotoSize;
|
||||||
|
|
||||||
auto userpicView =
|
if (const auto from = message->displayFrom()) {
|
||||||
message->displayFrom()->hasUserpic()
|
Dialogs::Ui::PaintUserpic(
|
||||||
? message->displayFrom()->activeUserpicView()
|
p,
|
||||||
: message->displayFrom()->createUserpicView();
|
from,
|
||||||
message->displayFrom()->paintUserpic(p, userpicView, picX, picY, st::msgPhotoSize);
|
nullptr,
|
||||||
|
userpics[from],
|
||||||
|
picX,
|
||||||
|
picY,
|
||||||
|
width,
|
||||||
|
st::msgPhotoSize,
|
||||||
|
context.paused);
|
||||||
|
} else if (const auto info = message->displayHiddenSenderInfo()) {
|
||||||
|
if (info->customUserpic.empty()) {
|
||||||
|
info->emptyUserpic.paintCircle(
|
||||||
|
p,
|
||||||
|
picX,
|
||||||
|
picY,
|
||||||
|
width,
|
||||||
|
st::msgPhotoSize);
|
||||||
|
} else {
|
||||||
|
auto &userpic = hiddenSenderUserpics[message->id];
|
||||||
|
const auto valid = info->paintCustomUserpic(
|
||||||
|
p,
|
||||||
|
userpic,
|
||||||
|
picX,
|
||||||
|
picY,
|
||||||
|
width,
|
||||||
|
st::msgPhotoSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
y += view->height();
|
y += view->height();
|
||||||
|
|
Loading…
Add table
Reference in a new issue