From 2b36c36dcbe49fa0d62543b45f42f820cb0c22ad Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 7 May 2021 16:20:23 +0400 Subject: [PATCH] Allow fractional strokes in CrossLineAnimation. --- ui/colors.palette | 4 ++-- ui/effects/cross_line.cpp | 19 ++++++++++++++++--- ui/widgets/widgets.style | 1 + 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ui/colors.palette b/ui/colors.palette index a20859d..ddbe40b 100644 --- a/ui/colors.palette +++ b/ui/colors.palette @@ -584,8 +584,8 @@ groupCallMenuBgOver: #343940; // group call popup menu with mouse over groupCallMenuBgRipple: #3a4047; // group call popup menu ripple effect groupCallLeaveBg: #f75c5c7f; // group call leave button background groupCallLeaveBgRipple: #f75c5c9e; // group call leave button ripple effect -groupCallVideoTextFg: #ffffffe0; // group call text over video -groupCallVideoSubTextFg: #ffffffa0; // group call additional text over video +groupCallVideoTextFg: #ffffffb2; // group call text over video +groupCallVideoSubTextFg: #ffffff66; // group call additional text over video callBarBg: dialogsBgActive; // active phone call bar background callBarMuteRipple: dialogsRippleBgActive; // active phone call bar mute and hangup button ripple effect diff --git a/ui/effects/cross_line.cpp b/ui/effects/cross_line.cpp index 9eb95b6..0028ac8 100644 --- a/ui/effects/cross_line.cpp +++ b/ui/effects/cross_line.cpp @@ -9,6 +9,15 @@ #include "ui/painter.h" namespace Ui { +namespace { + +[[nodiscard]] float64 StrokeWidth( + const style::CrossLineAnimation &st) noexcept { + return float64(st.stroke) + / (st.strokeDenominator ? st.strokeDenominator : 1); +} + +} // namespace CrossLineAnimation::CrossLineAnimation( const style::CrossLineAnimation &st, @@ -16,8 +25,12 @@ CrossLineAnimation::CrossLineAnimation( float angle) : _st(st) , _reversed(reversed) -, _transparentPen(Qt::transparent, st.stroke, Qt::SolidLine, Qt::RoundCap) -, _strokePen(st.fg, st.stroke, Qt::SolidLine, Qt::RoundCap) +, _transparentPen( + Qt::transparent, + StrokeWidth(st), + Qt::SolidLine, + Qt::RoundCap) +, _strokePen(st.fg, StrokeWidth(st), Qt::SolidLine, Qt::RoundCap) , _line(st.startPosition, st.endPosition) { _line.setAngle(angle); } @@ -98,7 +111,7 @@ void CrossLineAnimation::fillFrame( void CrossLineAnimation::invalidate() { _completeCross = QImage(); _completeCrossOverride = QImage(); - _strokePen = QPen(_st.fg, _st.stroke, Qt::SolidLine, Qt::RoundCap); + _strokePen = QPen(_st.fg, StrokeWidth(_st), Qt::SolidLine, Qt::RoundCap); } } // namespace Ui diff --git a/ui/widgets/widgets.style b/ui/widgets/widgets.style index 61ab92d..2b7aab5 100644 --- a/ui/widgets/widgets.style +++ b/ui/widgets/widgets.style @@ -409,6 +409,7 @@ CrossLineAnimation { startPosition: point; endPosition: point; stroke: pixels; + strokeDenominator: int; } ArcsAnimation {