mirror of https://github.com/procxx/kepka.git
				
				
				
			Alpha 1.1.3: Fix some render in macOS.
This commit is contained in:
		
							parent
							
								
									413be7d76d
								
							
						
					
					
						commit
						e0978f86d1
					
				|  | @ -1972,7 +1972,7 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, TimeM | |||
| 		if (displayMute) { | ||||
| 			_roundPlayback.reset(); | ||||
| 		} else if (_roundPlayback) { | ||||
| 			auto value = _roundPlayback->value(); | ||||
| 			auto value = _roundPlayback->value(ms); | ||||
| 			if (value > 0.) { | ||||
| 				auto pen = st::historyVideoMessageProgressFg->p; | ||||
| 				auto was = p.pen(); | ||||
|  |  | |||
|  | @ -140,7 +140,7 @@ void Float::prepareShadow() { | |||
| 		auto extend = 2 * st::lineWidth; | ||||
| 		p.drawEllipse(getInnerRect().marginsAdded(QMargins(extend, extend, extend, extend))); | ||||
| 	} | ||||
| 	_shadow = App::pixmapFromImageInPlace(Images::prepareBlur(shadow)); | ||||
| 	_shadow = App::pixmapFromImageInPlace(Images::prepareBlur(std::move(shadow))); | ||||
| } | ||||
| 
 | ||||
| QRect Float::getInnerRect() const { | ||||
|  | @ -161,7 +161,7 @@ void Float::paintEvent(QPaintEvent *e) { | |||
| 	auto inner = getInnerRect(); | ||||
| 	p.drawImage(inner.topLeft(), _frame); | ||||
| 
 | ||||
| 	auto progress = _roundPlayback ? _roundPlayback->value() : 1.; | ||||
| 	auto progress = _roundPlayback ? _roundPlayback->value(getms()) : 1.; | ||||
| 	if (progress > 0.) { | ||||
| 		auto pen = st::historyVideoMessageProgressFg->p; | ||||
| 		auto was = p.pen(); | ||||
|  |  | |||
|  | @ -88,6 +88,11 @@ float64 Playback::value() const { | |||
| 	return qMin(a_value.current(), 1.); | ||||
| } | ||||
| 
 | ||||
| float64 Playback::value(TimeMs ms) { | ||||
| 	_a_value.step(ms); | ||||
| 	return value(); | ||||
| } | ||||
| 
 | ||||
| void Playback::setValue(float64 value, bool animated) { | ||||
| 	if (animated) { | ||||
| 		a_value.start(value); | ||||
|  |  | |||
|  | @ -41,6 +41,7 @@ public: | |||
| 	} | ||||
| 	void setValue(float64 value, bool animated); | ||||
| 	float64 value() const; | ||||
| 	float64 value(TimeMs ms); | ||||
| 
 | ||||
| 	void updateState(const Player::TrackState &state); | ||||
| 	void updateLoadingState(float64 progress); | ||||
|  |  | |||
|  | @ -242,7 +242,7 @@ void Photo::paint(Painter &p, const QRect &clip, TextSelection selection, const | |||
| 		if (_goodLoaded || _data->thumb->loaded()) { | ||||
| 			auto img = (_data->loaded() ? _data->full : (_data->medium->loaded() ? _data->medium : _data->thumb))->pix().toImage(); | ||||
| 			if (!_goodLoaded) { | ||||
| 				img = Images::prepareBlur(img); | ||||
| 				img = Images::prepareBlur(std::move(img)); | ||||
| 			} | ||||
| 			if (img.width() == img.height()) { | ||||
| 				if (img.width() != size) { | ||||
|  | @ -344,7 +344,7 @@ void Video::paint(Painter &p, const QRect &clip, TextSelection selection, const | |||
| 		_thumbLoaded = thumbLoaded; | ||||
| 
 | ||||
| 		if (_thumbLoaded && !_data->thumb->isNull()) { | ||||
| 			int32 size = _width * cIntRetinaFactor(); | ||||
| 			auto size = _width * cIntRetinaFactor(); | ||||
| 			auto img = Images::prepareBlur(_data->thumb->pix().toImage()); | ||||
| 			if (img.width() == img.height()) { | ||||
| 				if (img.width() != size) { | ||||
|  |  | |||
|  | @ -60,9 +60,11 @@ const QPixmap &circleMask(int width, int height) { | |||
| } // namespace
 | ||||
| 
 | ||||
| QImage prepareBlur(QImage img) { | ||||
| 	QImage::Format fmt = img.format(); | ||||
| 	auto ratio = img.devicePixelRatio(); | ||||
| 	auto fmt = img.format(); | ||||
| 	if (fmt != QImage::Format_RGB32 && fmt != QImage::Format_ARGB32_Premultiplied) { | ||||
| 		img = img.convertToFormat(QImage::Format_ARGB32_Premultiplied); | ||||
| 		img.setDevicePixelRatio(ratio); | ||||
| 		t_assert(!img.isNull()); | ||||
| 	} | ||||
| 
 | ||||
|  | @ -85,8 +87,9 @@ QImage prepareBlur(QImage img) { | |||
| 					p.fillRect(0, 0, w, h, Qt::transparent); | ||||
| 					p.drawImage(QRect(radius, radius, w - 2 * radius, h - 2 * radius), img, QRect(0, 0, w, h)); | ||||
| 				} | ||||
| 				QImage was = img; | ||||
| 				img = imgsmall; | ||||
| 				imgsmall.setDevicePixelRatio(ratio); | ||||
| 				auto was = img; | ||||
| 				img = std::move(imgsmall); | ||||
| 				imgsmall = QImage(); | ||||
| 				t_assert(!img.isNull()); | ||||
| 
 | ||||
|  | @ -293,7 +296,7 @@ QImage prepareOpaque(QImage image) { | |||
| QImage prepare(QImage img, int w, int h, Images::Options options, int outerw, int outerh) { | ||||
| 	t_assert(!img.isNull()); | ||||
| 	if (options.testFlag(Images::Option::Blurred)) { | ||||
| 		img = prepareBlur(img); | ||||
| 		img = prepareBlur(std::move(img)); | ||||
| 		t_assert(!img.isNull()); | ||||
| 	} | ||||
| 	if (w <= 0 || (w == img.width() && (h <= 0 || h == img.height()))) { | ||||
|  | @ -752,7 +755,7 @@ QPixmap Image::pixBlurredColoredNoCache(style::color add, int32 w, int32 h) cons | |||
| 	restore(); | ||||
| 	if (_data.isNull()) return blank()->pix(); | ||||
| 
 | ||||
| 	QImage img = Images::prepareBlur(_data.toImage()); | ||||
| 	auto img = Images::prepareBlur(_data.toImage()); | ||||
| 	if (h <= 0) { | ||||
| 		img = img.scaledToWidth(w, Qt::SmoothTransformation); | ||||
| 	} else { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue