1 /*
2 This file is part of Telegram Desktop,
3 the official desktop application for the Telegram messaging service.
4 
5 For license and copyright information please follow this link:
6 https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
7 */
8 #pragma once
9 
10 #include "calls/group/calls_group_viewport.h"
11 #include "ui/round_rect.h"
12 #include "ui/effects/cross_line.h"
13 #include "ui/gl/gl_surface.h"
14 #include "ui/text/text.h"
15 
16 namespace Calls::Group {
17 
18 class Viewport::RendererSW final : public Ui::GL::Renderer {
19 public:
20 	explicit RendererSW(not_null<Viewport*> owner);
21 
22 	void paintFallback(
23 		Painter &&p,
24 		const QRegion &clip,
25 		Ui::GL::Backend backend) override;
26 
27 private:
28 	struct TileData {
29 		QImage userpicFrame;
30 		QImage blurredFrame;
31 		bool stale = false;
32 	};
33 	void paintTile(
34 		Painter &p,
35 		not_null<VideoTile*> tile,
36 		const QRect &clip,
37 		QRegion &bg);
38 	void paintTileOutline(
39 		Painter &p,
40 		int x,
41 		int y,
42 		int width,
43 		int height,
44 		not_null<VideoTile*> tile);
45 	void paintTileControls(
46 		Painter &p,
47 		int x,
48 		int y,
49 		int width,
50 		int height,
51 		not_null<VideoTile*> tile);
52 	void validateUserpicFrame(
53 		not_null<VideoTile*> tile,
54 		TileData &data);
55 
56 	const not_null<Viewport*> _owner;
57 
58 	QImage _shadow;
59 	bool _userpicFrame = false;
60 	bool _pausedFrame = false;
61 	base::flat_map<not_null<VideoTile*>, TileData> _tileData;
62 	Ui::CrossLineAnimation _pinIcon;
63 	Ui::RoundRect _pinBackground;
64 
65 };
66 
67 } // namespace Calls::Group
68