mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 05:07:10 +02:00
fix: messageshot on macOS
Co-authored-by: Vladislav Gorodkov <fuccsoc@gmail.com>
This commit is contained in:
parent
7fe66c07e4
commit
292de83c35
3 changed files with 15 additions and 13 deletions
|
@ -247,8 +247,8 @@ QImage addPadding(const QImage &original) {
|
|||
}
|
||||
|
||||
QImage paddedImage(
|
||||
original.width() + 2 * st::messageShotPadding,
|
||||
original.height() + 2 * st::messageShotPadding,
|
||||
original.width() + 2 * st::messageShotPadding * style::DevicePixelRatio(),
|
||||
original.height() + 2 * st::messageShotPadding * style::DevicePixelRatio(),
|
||||
QImage::Format_ARGB32_Premultiplied
|
||||
);
|
||||
paddedImage.setDevicePixelRatio(style::DevicePixelRatio());
|
||||
|
@ -352,6 +352,7 @@ QImage Make(not_null<QWidget*> box, const ShotConfig &config) {
|
|||
height += view->resizeGetHeight(width);
|
||||
}
|
||||
|
||||
width *= style::DevicePixelRatio();
|
||||
height *= style::DevicePixelRatio();
|
||||
|
||||
// create the image
|
||||
|
|
|
@ -200,7 +200,7 @@ void MessageShotBox::setupContent() {
|
|||
|
||||
updatePreview();
|
||||
|
||||
const auto boxWidth = imageView->getImage().width() + (st::boxPadding.left() + st::boxPadding.right()) * 4;
|
||||
const auto boxWidth = imageView->getImage().width() / style::DevicePixelRatio() + (st::boxPadding.left() + st::boxPadding.right()) * 4;
|
||||
|
||||
boxClosing() | rpl::start_with_next(
|
||||
[=]
|
||||
|
|
|
@ -27,7 +27,8 @@ void ImageView::setImage(const QImage &image) {
|
|||
this->prevImage = this->image;
|
||||
this->image = image;
|
||||
|
||||
setMinimumSize(image.size().grownBy(st::imageViewInnerPadding));
|
||||
const auto size = image.size() / style::DevicePixelRatio();
|
||||
setMinimumSize(size.grownBy(st::imageViewInnerPadding));
|
||||
|
||||
if (this->animation.animating()) {
|
||||
this->animation.stop();
|
||||
|
@ -67,7 +68,7 @@ void ImageView::paintEvent(QPaintEvent *e) {
|
|||
const auto brush = QBrush(AyuFeatures::MessageShot::makeDefaultBackgroundColor());
|
||||
|
||||
QPainterPath path;
|
||||
path.addRoundedRect(rect(), st::bubbleRadiusLarge, st::bubbleRadiusLarge);
|
||||
path.addRoundedRect(rect(), st::roundRadiusLarge, st::roundRadiusLarge);
|
||||
|
||||
p.fillPath(path, brush);
|
||||
|
||||
|
@ -75,10 +76,10 @@ void ImageView::paintEvent(QPaintEvent *e) {
|
|||
const auto realRect = rect().marginsRemoved(st::imageViewInnerPadding);
|
||||
|
||||
const auto resizedRect = QRect(
|
||||
(realRect.width() - prevImage.width()) / 2 + st::imageViewInnerPadding.left(),
|
||||
(realRect.height() - prevImage.height()) / 2 + st::imageViewInnerPadding.top(),
|
||||
prevImage.width(),
|
||||
prevImage.height());
|
||||
(realRect.width() - prevImage.width() / style::DevicePixelRatio()) / 2 + st::imageViewInnerPadding.left(),
|
||||
(realRect.height() - prevImage.height() / style::DevicePixelRatio()) / 2 + st::imageViewInnerPadding.top(),
|
||||
prevImage.width() / style::DevicePixelRatio(),
|
||||
prevImage.height() / style::DevicePixelRatio());
|
||||
|
||||
const auto opacity = 1.0 - animation.value(1.0);
|
||||
p.setOpacity(opacity);
|
||||
|
@ -90,10 +91,10 @@ void ImageView::paintEvent(QPaintEvent *e) {
|
|||
const auto realRect = rect().marginsRemoved(st::imageViewInnerPadding);
|
||||
|
||||
const auto resizedRect = QRect(
|
||||
(realRect.width() - image.width()) / 2 + st::imageViewInnerPadding.left(),
|
||||
(realRect.height() - image.height()) / 2 + st::imageViewInnerPadding.top(),
|
||||
image.width(),
|
||||
image.height());
|
||||
(realRect.width() - image.width() / style::DevicePixelRatio()) / 2 + st::imageViewInnerPadding.left(),
|
||||
(realRect.height() - image.height() / style::DevicePixelRatio()) / 2 + st::imageViewInnerPadding.top(),
|
||||
image.width() / style::DevicePixelRatio(),
|
||||
image.height() / style::DevicePixelRatio());
|
||||
|
||||
const auto opacity = animation.value(1.0);
|
||||
p.setOpacity(opacity);
|
||||
|
|
Loading…
Add table
Reference in a new issue