Replaced multiple static constants for square root of 2 with Qt define.
This commit is contained in:
		
							parent
							
								
									c8aa97b6b2
								
							
						
					
					
						commit
						6258aa01b8
					
				
					 4 changed files with 5 additions and 10 deletions
				
			
		| 
						 | 
					@ -68,7 +68,7 @@ QImage EmojiImageLoader::prepare(EmojiPtr emoji) const {
 | 
				
			||||||
			{ -1, 1 },
 | 
								{ -1, 1 },
 | 
				
			||||||
			{ 1, 1 },
 | 
								{ 1, 1 },
 | 
				
			||||||
		} };
 | 
							} };
 | 
				
			||||||
		const auto corrected = int(base::SafeRound(delta / sqrt(2.)));
 | 
							const auto corrected = int(base::SafeRound(delta / M_SQRT2));
 | 
				
			||||||
		for (const auto &shift : diagonal) {
 | 
							for (const auto &shift : diagonal) {
 | 
				
			||||||
			for (auto i = 0; i != corrected; ++i) {
 | 
								for (auto i = 0; i != corrected; ++i) {
 | 
				
			||||||
				p.drawImage(QPoint(delta, delta) + shift * (i + 1), tinted);
 | 
									p.drawImage(QPoint(delta, delta) + shift * (i + 1), tinted);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -138,8 +138,6 @@ void PlayButtonLayout::paintPlayToPause(QPainter &p, const QBrush &brush, float6
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void PlayButtonLayout::paintPlayToCancel(QPainter &p, const QBrush &brush, float64 progress) {
 | 
					void PlayButtonLayout::paintPlayToCancel(QPainter &p, const QBrush &brush, float64 progress) {
 | 
				
			||||||
	static const auto sqrt2 = sqrt(2.);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	auto playLeft = 0. + _st.playPosition.x();
 | 
						auto playLeft = 0. + _st.playPosition.x();
 | 
				
			||||||
	auto playTop = 0. + _st.playPosition.y();
 | 
						auto playTop = 0. + _st.playPosition.y();
 | 
				
			||||||
	auto playWidth = _st.playOuter.width() - 2 * playLeft;
 | 
						auto playWidth = _st.playOuter.width() - 2 * playLeft;
 | 
				
			||||||
| 
						 | 
					@ -149,7 +147,7 @@ void PlayButtonLayout::paintPlayToCancel(QPainter &p, const QBrush &brush, float
 | 
				
			||||||
	auto cancelTop = 0. + _st.cancelPosition.y();
 | 
						auto cancelTop = 0. + _st.cancelPosition.y();
 | 
				
			||||||
	auto cancelWidth = _st.cancelOuter.width() - 2 * cancelLeft;
 | 
						auto cancelWidth = _st.cancelOuter.width() - 2 * cancelLeft;
 | 
				
			||||||
	auto cancelHeight = _st.cancelOuter.height() - 2 * cancelTop;
 | 
						auto cancelHeight = _st.cancelOuter.height() - 2 * cancelTop;
 | 
				
			||||||
	auto cancelStroke = (0. + _st.cancelStroke) / sqrt2;
 | 
						auto cancelStroke = (0. + _st.cancelStroke) / M_SQRT2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p.setPen(Qt::NoPen);
 | 
						p.setPen(Qt::NoPen);
 | 
				
			||||||
	PainterHighQualityEnabler hq(p);
 | 
						PainterHighQualityEnabler hq(p);
 | 
				
			||||||
| 
						 | 
					@ -186,8 +184,6 @@ void PlayButtonLayout::paintPlayToCancel(QPainter &p, const QBrush &brush, float
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void PlayButtonLayout::paintPauseToCancel(QPainter &p, const QBrush &brush, float64 progress) {
 | 
					void PlayButtonLayout::paintPauseToCancel(QPainter &p, const QBrush &brush, float64 progress) {
 | 
				
			||||||
	static const auto sqrt2 = sqrt(2.);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	auto pauseLeft = 0. + _st.pausePosition.x();
 | 
						auto pauseLeft = 0. + _st.pausePosition.x();
 | 
				
			||||||
	auto pauseTop = 0. + _st.pausePosition.y();
 | 
						auto pauseTop = 0. + _st.pausePosition.y();
 | 
				
			||||||
	auto pauseWidth = _st.pauseOuter.width() - 2 * pauseLeft;
 | 
						auto pauseWidth = _st.pauseOuter.width() - 2 * pauseLeft;
 | 
				
			||||||
| 
						 | 
					@ -198,7 +194,7 @@ void PlayButtonLayout::paintPauseToCancel(QPainter &p, const QBrush &brush, floa
 | 
				
			||||||
	auto cancelTop = 0. + _st.cancelPosition.y();
 | 
						auto cancelTop = 0. + _st.cancelPosition.y();
 | 
				
			||||||
	auto cancelWidth = _st.cancelOuter.width() - 2 * cancelLeft;
 | 
						auto cancelWidth = _st.cancelOuter.width() - 2 * cancelLeft;
 | 
				
			||||||
	auto cancelHeight = _st.cancelOuter.height() - 2 * cancelTop;
 | 
						auto cancelHeight = _st.cancelOuter.height() - 2 * cancelTop;
 | 
				
			||||||
	auto cancelStroke = (0. + _st.cancelStroke) / sqrt2;
 | 
						auto cancelStroke = (0. + _st.cancelStroke) / M_SQRT2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p.setPen(Qt::NoPen);
 | 
						p.setPen(Qt::NoPen);
 | 
				
			||||||
	PainterHighQualityEnabler hq(p);
 | 
						PainterHighQualityEnabler hq(p);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -272,8 +272,7 @@ void MainMenu::ToggleAccountsButton::paintEvent(QPaintEvent *e) {
 | 
				
			||||||
	const auto y = 0. + height() - st::mainMenuTogglePosition.y();
 | 
						const auto y = 0. + height() - st::mainMenuTogglePosition.y();
 | 
				
			||||||
	const auto size = st::mainMenuToggleSize;
 | 
						const auto size = st::mainMenuToggleSize;
 | 
				
			||||||
	const auto size2 = size / 2.;
 | 
						const auto size2 = size / 2.;
 | 
				
			||||||
	const auto sqrt2 = sqrt(2.);
 | 
						const auto stroke = (st::mainMenuToggleFourStrokes / 4.) / M_SQRT2;
 | 
				
			||||||
	const auto stroke = (st::mainMenuToggleFourStrokes / 4.) / sqrt2;
 | 
					 | 
				
			||||||
	const auto left = x - size;
 | 
						const auto left = x - size;
 | 
				
			||||||
	const auto right = x + size;
 | 
						const auto right = x + size;
 | 
				
			||||||
	const auto bottom = y + size2;
 | 
						const auto bottom = y + size2;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +1 @@
 | 
				
			||||||
Subproject commit 6e3cc8c769fcc424e2e798ca90847bf6d89688d0
 | 
					Subproject commit 28d01d023bd76310520a895bdb7f66a2e70a2043
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue