Added ability to pass additional scale to RadialBlob.
This commit is contained in:
		
							parent
							
								
									526a816b7e
								
							
						
					
					
						commit
						c0e1dfcc8d
					
				
					 4 changed files with 6 additions and 6 deletions
				
			
		|  | @ -81,12 +81,12 @@ RadialBlob::RadialBlob(int n, float minScale, float minSpeed, float maxSpeed) | |||
| , _segments(n) { | ||||
| } | ||||
| 
 | ||||
| void RadialBlob::paint(Painter &p, const QBrush &brush) { | ||||
| void RadialBlob::paint(Painter &p, const QBrush &brush, float outerScale) { | ||||
| 	auto path = QPainterPath(); | ||||
| 	auto m = QMatrix(); | ||||
| 
 | ||||
| 	p.save(); | ||||
| 	const auto scale = _minScale + _scale * (1. - _minScale); | ||||
| 	const auto scale = (_minScale + (1. - _minScale) * _scale) * outerScale; | ||||
| 	if (scale != 1.) { | ||||
| 		p.scale(scale, scale); | ||||
| 	} | ||||
|  |  | |||
|  | @ -58,7 +58,7 @@ class RadialBlob final : public Blob { | |||
| public: | ||||
| 	RadialBlob(int n, float minScale, float minSpeed = 0, float maxSpeed = 0); | ||||
| 
 | ||||
| 	void paint(Painter &p, const QBrush &brush); | ||||
| 	void paint(Painter &p, const QBrush &brush, float outerScale = 1.); | ||||
| 	void update(float level, float speedScale); | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -65,7 +65,7 @@ void Blobs::setLevel(float value) { | |||
| 	_levelValue.start(to); | ||||
| } | ||||
| 
 | ||||
| void Blobs::paint(Painter &p, const QBrush &brush) { | ||||
| void Blobs::paint(Painter &p, const QBrush &brush, float outerScale) { | ||||
| 	const auto opacity = p.opacity(); | ||||
| 	for (auto i = 0; i < _blobs.size(); i++) { | ||||
| 		_blobs[i].update(_levelValue.current(), _blobDatas[i].speedScale); | ||||
|  | @ -73,7 +73,7 @@ void Blobs::paint(Painter &p, const QBrush &brush) { | |||
| 		if (alpha != 1.) { | ||||
| 			p.setOpacity(opacity * alpha); | ||||
| 		} | ||||
| 		_blobs[i].paint(p, brush); | ||||
| 		_blobs[i].paint(p, brush, outerScale); | ||||
| 		if (alpha != 1.) { | ||||
| 			p.setOpacity(opacity); | ||||
| 		} | ||||
|  |  | |||
|  | @ -35,7 +35,7 @@ public: | |||
| 	Blob::Radiuses radiusesAt(int index); | ||||
| 
 | ||||
| 	void setLevel(float value); | ||||
| 	void paint(Painter &p, const QBrush &brush); | ||||
| 	void paint(Painter &p, const QBrush &brush, float outerScale = 1.); | ||||
| 	void updateLevel(crl::time dt); | ||||
| 
 | ||||
| 	[[nodiscard]] float maxRadius() const; | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 23rd
						23rd