Allow fractional strokes in CrossLineAnimation.

This commit is contained in:
John Preston 2021-05-07 16:20:23 +04:00
parent 52326fffd0
commit 2b36c36dcb
3 changed files with 19 additions and 5 deletions

View file

@ -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

View file

@ -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

View file

@ -409,6 +409,7 @@ CrossLineAnimation {
startPosition: point;
endPosition: point;
stroke: pixels;
strokeDenominator: int;
}
ArcsAnimation {