Add shadow for white suggested reactions.

This commit is contained in:
John Preston 2023-09-14 20:11:53 +04:00
parent a43a5ce6c5
commit 01428572b0

View file

@ -409,12 +409,12 @@ void ReactionView::cacheBackground() {
_background.setDevicePixelRatio(ratio);
_background.fill(Qt::transparent);
const auto paintShape = [&](QColor color) {
auto p = QPainter(&_background);
auto hq = PainterHighQualityEnabler(p);
p.setPen(Qt::NoPen);
p.setBrush(_data.dark ? QColor(0, 0, 0, 128) : QColor(255, 255, 255));
p.setCompositionMode(QPainter::CompositionMode_Source);
p.setBrush(color);
_bubbleGeometry = QRectF(
(width() - _bubble) / 2.,
(height() - _bubble) / 2.,
@ -442,12 +442,20 @@ void ReactionView::cacheBackground() {
p.rotate(delta);
};
const auto paintTailPart = [&](float64 offset, float64 size) {
p.drawEllipse(QRectF(offset - size / 2., -size / 2., size, size));
const auto part = QRectF(-size / 2., -size / 2., size, size);
p.drawEllipse(part.translated(offset, 0));
};
rotate(kSuggestedTailBigRotation);
paintTailPart(_bigOffset, _bigSize);
rotate(kSuggestedTailSmallRotation);
paintTailPart(_smallOffset, _smallSize);
};
const auto dark = QColor(0, 0, 0, 128);
if (!_data.dark) {
paintShape(dark);
_background = Images::Blur(std::move(_background), true);
}
paintShape(_data.dark ? dark : QColor(255, 255, 255));
}
[[nodiscard]] Data::ReactionId HeartReactionId() {