summarylogtreecommitdiffstats
path: root/337.patch
blob: a5a06b678084c5e5cb1cce731b162b92b4b936a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 1513b7b2dd73c9a09c8fb9da74b62e3483a1318b Mon Sep 17 00:00:00 2001
From: blank X <blankie@nixnetmail.com>
Date: Sun, 20 Mar 2022 13:46:01 +0700
Subject: [PATCH] Respect userpic rounding for service messages

---
 .../history/view/media/history_view_photo.cpp  | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp
index 74244a0019..abf3da9202 100644
--- a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp
+++ b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp
@@ -405,7 +405,7 @@ void Photo::paintUserpicFrame(
 		auto request = ::Media::Streaming::FrameRequest();
 		request.outer = size * cIntRetinaFactor();
 		request.resize = size * cIntRetinaFactor();
-		request.radius = ImageRoundRadius::Ellipse;
+		request.radius = KotatoImageRoundRadius();
 		if (_streamed->instance.playerLocked()) {
 			if (_streamed->frozenFrame.isNull()) {
 				_streamed->frozenFrame = _streamed->instance.frame(request);
@@ -423,7 +423,7 @@ void Photo::paintUserpicFrame(
 	const auto pix = [&] {
 		const auto size = QSize(_pixw, _pixh);
 		const auto args = Images::PrepareArgs{
-			.options = Images::Option::RoundCircle,
+			.options = KotatoImageRoundOption(),
 		};
 		if (const auto large = _dataMedia->image(PhotoSize::Large)) {
 			return large->pix(size, args);
@@ -453,7 +453,19 @@ void Photo::paintUserpicFrame(
 		}
 		{
 			PainterHighQualityEnabler hq(p);
-			p.drawEllipse(inner);
+			switch (KotatoImageRoundRadius()) {
+				case ImageRoundRadius::None:
+					p.drawRoundedRect(inner, 0, 0);
+					break;
+				case ImageRoundRadius::Small:
+					p.drawRoundedRect(inner, st::buttonRadius, st::buttonRadius);
+					break;
+				case ImageRoundRadius::Large:
+					p.drawRoundedRect(inner, st::dateRadius, st::dateRadius);
+					break;
+				default:
+					p.drawEllipse(inner);
+			}
 		}
 		sti->historyFileThumbPlay.paintInCenter(p, inner);
 	}