MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / paintUserpic

Method paintUserpic

Telegram/SourceFiles/data/data_peer.cpp:457–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455}
456
457void PeerData::paintUserpic(
458 QPainter &p,
459 Ui::PeerUserpicView &view,
460 PaintUserpicContext context) const {
461 if (const auto broadcast = monoforumBroadcast()) {
462 if (context.shape == Ui::PeerUserpicShape::Auto) {
463 context.shape = Ui::PeerUserpicShape::Monoforum;
464 }
465 broadcast->paintUserpic(p, view, context);
466 return;
467 }
468 const auto size = context.size;
469 const auto cloud = userpicCloudImage(view);
470 const auto shouldLoad = cloud
471 && (!GetEnhancedBool("screenshot_mode")
472 || isVerified()
473 || isServiceUser());
474 const auto ratio = style::DevicePixelRatio();
475 if (context.shape == Ui::PeerUserpicShape::Auto) {
476 context.shape = (isForum() && !isBot())
477 ? Ui::PeerUserpicShape::Forum
478 : isMonoforum()
479 ? Ui::PeerUserpicShape::Monoforum
480 : Ui::PeerUserpicShape::Circle;
481 }
482 Ui::ValidateUserpicCache(
483 view,
484 shouldLoad ? cloud : nullptr,
485 shouldLoad ? nullptr : ensureEmptyUserpic().get(),
486 size * ratio,
487 context.shape);
488 p.drawImage(QRect(context.position, QSize(size, size)), view.cached);
489}
490
491void PeerData::loadUserpic() {
492 _userpic.load(&session(), userpicOrigin());

Callers 6

paintMethod · 0.45
setupMessagesWidgetMethod · 0.45
setupPinnedWidgetMethod · 0.45
paintMethod · 0.45
imageMethod · 0.45
prepareUserpicPixmapMethod · 0.45

Calls 3

GetEnhancedBoolFunction · 0.85
ValidateUserpicCacheFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected