mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add shadow for white suggested reactions.
This commit is contained in:
parent
a43a5ce6c5
commit
01428572b0
1 changed files with 44 additions and 36 deletions
|
@ -409,45 +409,53 @@ void ReactionView::cacheBackground() {
|
||||||
_background.setDevicePixelRatio(ratio);
|
_background.setDevicePixelRatio(ratio);
|
||||||
_background.fill(Qt::transparent);
|
_background.fill(Qt::transparent);
|
||||||
|
|
||||||
auto p = QPainter(&_background);
|
const auto paintShape = [&](QColor color) {
|
||||||
auto hq = PainterHighQualityEnabler(p);
|
auto p = QPainter(&_background);
|
||||||
p.setPen(Qt::NoPen);
|
auto hq = PainterHighQualityEnabler(p);
|
||||||
p.setBrush(_data.dark ? QColor(0, 0, 0, 128) : QColor(255, 255, 255));
|
p.setPen(Qt::NoPen);
|
||||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||||
|
p.setBrush(color);
|
||||||
|
_bubbleGeometry = QRectF(
|
||||||
|
(width() - _bubble) / 2.,
|
||||||
|
(height() - _bubble) / 2.,
|
||||||
|
_bubble,
|
||||||
|
_bubble);
|
||||||
|
p.drawEllipse(_bubbleGeometry);
|
||||||
|
|
||||||
_bubbleGeometry = QRectF(
|
const auto center = QPointF(width() / 2., height() / 2.);
|
||||||
(width() - _bubble) / 2.,
|
p.translate(center);
|
||||||
(height() - _bubble) / 2.,
|
|
||||||
_bubble,
|
|
||||||
_bubble);
|
|
||||||
p.drawEllipse(_bubbleGeometry);
|
|
||||||
|
|
||||||
const auto center = QPointF(width() / 2., height() / 2.);
|
auto previous = 0.;
|
||||||
p.translate(center);
|
const auto rotate = [&](float64 initial) {
|
||||||
|
if (_data.flipped) {
|
||||||
auto previous = 0.;
|
initial = 180 - initial;
|
||||||
const auto rotate = [&](float64 initial) {
|
}
|
||||||
if (_data.flipped) {
|
auto rotation = _data.area.rotation - initial;
|
||||||
initial = 180 - initial;
|
while (rotation < 0) {
|
||||||
}
|
rotation += 360;
|
||||||
auto rotation = _data.area.rotation - initial;
|
}
|
||||||
while (rotation < 0) {
|
while (rotation >= 360) {
|
||||||
rotation += 360;
|
rotation -= 360;
|
||||||
}
|
}
|
||||||
while (rotation >= 360) {
|
const auto delta = rotation - previous;
|
||||||
rotation -= 360;
|
previous = rotation;
|
||||||
}
|
p.rotate(delta);
|
||||||
const auto delta = rotation - previous;
|
};
|
||||||
previous = rotation;
|
const auto paintTailPart = [&](float64 offset, float64 size) {
|
||||||
p.rotate(delta);
|
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 paintTailPart = [&](float64 offset, float64 size) {
|
const auto dark = QColor(0, 0, 0, 128);
|
||||||
p.drawEllipse(QRectF(offset - size / 2., -size / 2., size, size));
|
if (!_data.dark) {
|
||||||
};
|
paintShape(dark);
|
||||||
rotate(kSuggestedTailBigRotation);
|
_background = Images::Blur(std::move(_background), true);
|
||||||
paintTailPart(_bigOffset, _bigSize);
|
}
|
||||||
rotate(kSuggestedTailSmallRotation);
|
paintShape(_data.dark ? dark : QColor(255, 255, 255));
|
||||||
paintTailPart(_smallOffset, _smallSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] Data::ReactionId HeartReactionId() {
|
[[nodiscard]] Data::ReactionId HeartReactionId() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue