mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed shadows in userpic builder with non-default scale.
This commit is contained in:
parent
501784cd15
commit
41dada2c06
1 changed files with 12 additions and 8 deletions
|
@ -18,22 +18,26 @@ namespace Ui {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void PaintExcludeTopShadow(QPainter &p, int radius, const QRect &r) {
|
void PaintExcludeTopShadow(QPainter &p, int radius, const QRect &r) {
|
||||||
constexpr auto kHorizontalOffset = 1;
|
constexpr auto kHorizontalOffset = 1.;
|
||||||
constexpr auto kVerticalOffset = 2;
|
constexpr auto kVerticalOffset = 2.;
|
||||||
|
constexpr auto kOpacityStep1 = 0.2;
|
||||||
|
constexpr auto kOpacityStep2 = 0.4;
|
||||||
const auto opacity = p.opacity();
|
const auto opacity = p.opacity();
|
||||||
p.setOpacity(opacity * 0.2);
|
const auto hOffset = style::ConvertScale(kHorizontalOffset);
|
||||||
|
const auto vOffset = style::ConvertScale(kVerticalOffset);
|
||||||
|
p.setOpacity(opacity * kOpacityStep1);
|
||||||
p.drawRoundedRect(
|
p.drawRoundedRect(
|
||||||
r + QMargins(kHorizontalOffset, -radius, kHorizontalOffset, 0),
|
r + QMarginsF(hOffset, -radius, hOffset, 0),
|
||||||
radius,
|
radius,
|
||||||
radius);
|
radius);
|
||||||
p.setOpacity(opacity * 0.2);
|
p.setOpacity(opacity * kOpacityStep1);
|
||||||
p.drawRoundedRect(
|
p.drawRoundedRect(
|
||||||
r + QMargins(0, 0, 0, kVerticalOffset),
|
r + QMarginsF(0, 0, 0, vOffset),
|
||||||
radius,
|
radius,
|
||||||
radius);
|
radius);
|
||||||
p.setOpacity(opacity * 0.4);
|
p.setOpacity(opacity * kOpacityStep2);
|
||||||
p.drawRoundedRect(
|
p.drawRoundedRect(
|
||||||
r + QMargins(0, 0, 0, kVerticalOffset / 2),
|
r + QMarginsF(0, 0, 0, vOffset / 2.),
|
||||||
radius,
|
radius,
|
||||||
radius);
|
radius);
|
||||||
p.setOpacity(opacity);
|
p.setOpacity(opacity);
|
||||||
|
|
Loading…
Add table
Reference in a new issue