2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-29 13:47:47 +00:00

Fix rounding of Replies userpic

This commit is contained in:
RadRussianRus 2020-12-27 19:35:16 +03:00
parent eab12695bb
commit 19c1764bd1
2 changed files with 102 additions and 1 deletions

View File

@ -373,9 +373,35 @@ void EmptyUserpic::PaintRepliesMessages(
int y,
int outerWidth,
int size) {
switch (cUserpicCornersType()) {
case 0:
PaintRepliesMessagesSquared(p, x, y, outerWidth, size);
break;
case 1:
PaintRepliesMessagesRounded(p, x, y, outerWidth, size);
break;
case 2:
PaintRepliesMessagesRoundedLarge(p, x, y, outerWidth, size);
break;
default:
const auto &bg = st::historyPeerSavedMessagesBg;
const auto &fg = st::historyPeerUserpicFg;
PaintRepliesMessages(p, x, y, outerWidth, size, bg, fg);
}
}
void EmptyUserpic::PaintRepliesMessagesRoundedLarge(
Painter &p,
int x,
int y,
int outerWidth,
int size) {
const auto &bg = st::historyPeerSavedMessagesBg;
const auto &fg = st::historyPeerUserpicFg;
PaintRepliesMessagesRoundedLarge(p, x, y, outerWidth, size, bg, fg);
}
void EmptyUserpic::PaintRepliesMessagesRounded(
@ -389,6 +415,17 @@ void EmptyUserpic::PaintRepliesMessagesRounded(
PaintRepliesMessagesRounded(p, x, y, outerWidth, size, bg, fg);
}
void EmptyUserpic::PaintRepliesMessagesSquared(
Painter &p,
int x,
int y,
int outerWidth,
int size) {
const auto &bg = st::historyPeerSavedMessagesBg;
const auto &fg = st::historyPeerUserpicFg;
PaintRepliesMessagesSquared(p, x, y, outerWidth, size, bg, fg);
}
void EmptyUserpic::PaintRepliesMessages(
Painter &p,
int x,
@ -407,6 +444,24 @@ void EmptyUserpic::PaintRepliesMessages(
PaintRepliesMessagesInner(p, x, y, size, bg, fg);
}
void EmptyUserpic::PaintRepliesMessagesRoundedLarge(
Painter &p,
int x,
int y,
int outerWidth,
int size,
const style::color &bg,
const style::color &fg) {
x = rtl() ? (outerWidth - x - size) : x;
PainterHighQualityEnabler hq(p);
p.setBrush(bg);
p.setPen(Qt::NoPen);
p.drawRoundedRect(x, y, size, size, st::dateRadius, st::dateRadius);
PaintRepliesMessagesInner(p, x, y, size, bg, fg);
}
void EmptyUserpic::PaintRepliesMessagesRounded(
Painter &p,
int x,
@ -425,6 +480,24 @@ void EmptyUserpic::PaintRepliesMessagesRounded(
PaintRepliesMessagesInner(p, x, y, size, bg, fg);
}
void EmptyUserpic::PaintRepliesMessagesSquared(
Painter &p,
int x,
int y,
int outerWidth,
int size,
const style::color &bg,
const style::color &fg) {
x = rtl() ? (outerWidth - x - size) : x;
PainterHighQualityEnabler hq(p);
p.setBrush(bg);
p.setPen(Qt::NoPen);
p.drawRoundedRect(x, y, size, size, 0, 0);
PaintRepliesMessagesInner(p, x, y, size, bg, fg);
}
QPixmap EmptyUserpic::GenerateRepliesMessages(int size) {
return Generate(size, [&](Painter &p) {
PaintRepliesMessages(p, 0, 0, size, size);

View File

@ -105,12 +105,24 @@ public:
int y,
int outerWidth,
int size);
static void PaintRepliesMessagesRoundedLarge(
Painter &p,
int x,
int y,
int outerWidth,
int size);
static void PaintRepliesMessagesRounded(
Painter &p,
int x,
int y,
int outerWidth,
int size);
static void PaintRepliesMessagesSquared(
Painter &p,
int x,
int y,
int outerWidth,
int size);
static void PaintRepliesMessages(
Painter &p,
int x,
@ -119,6 +131,14 @@ public:
int size,
const style::color &bg,
const style::color &fg);
static void PaintRepliesMessagesRoundedLarge(
Painter &p,
int x,
int y,
int outerWidth,
int size,
const style::color &bg,
const style::color &fg);
static void PaintRepliesMessagesRounded(
Painter &p,
int x,
@ -127,6 +147,14 @@ public:
int size,
const style::color &bg,
const style::color &fg);
static void PaintRepliesMessagesSquared(
Painter &p,
int x,
int y,
int outerWidth,
int size,
const style::color &bg,
const style::color &fg);
static QPixmap GenerateRepliesMessages(int size);
static QPixmap GenerateRepliesMessagesRounded(int size);