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 "media/view/media_view_pip_renderer.h"
11 
12 namespace Media::View {
13 
14 class Pip::RendererSW final : public Pip::Renderer {
15 public:
16 	explicit RendererSW(not_null<Pip*> owner);
17 
18 	void paintFallback(
19 		Painter &&p,
20 		const QRegion &clip,
21 		Ui::GL::Backend backend) override;
22 
23 private:
24 	void paintTransformedVideoFrame(ContentGeometry geometry) override;
25 	void paintTransformedStaticContent(
26 		const QImage &image,
27 		ContentGeometry geometry) override;
28 	void paintTransformedImage(
29 		const QImage &image,
30 		ContentGeometry geometry);
31 	void paintRadialLoading(
32 		QRect inner,
33 		float64 controlsShown) override;
34 	void paintButtonsStart() override;
35 	void paintButton(
36 		const Button &button,
37 		int outerWidth,
38 		float64 shown,
39 		float64 over,
40 		const style::icon &icon,
41 		const style::icon &iconOver) override;
42 	void paintPlayback(QRect outer, float64 shown) override;
43 	void paintVolumeController(QRect outer, float64 shown) override;
44 
45 	void paintFade(ContentGeometry geometry) const;
46 
47 	[[nodiscard]] FrameRequest frameRequest(ContentGeometry geometry) const;
48 	[[nodiscard]] QImage staticContentByRequest(
49 		const QImage &image,
50 		const FrameRequest &request);
51 
52 	const not_null<Pip*> _owner;
53 
54 	Painter *_p = nullptr;
55 	const QRegion *_clip = nullptr;
56 	QRect _clipOuter;
57 
58 	Ui::RoundRect _roundRect;
59 
60 	QImage _preparedStaticContent;
61 	FrameRequest _preparedStaticRequest;
62 	qint64 _preparedStaticKey = 0;
63 
64 };
65 
66 } // namespace Media::View
67