Custom colors in FillComplex(Overlay|Location)Rect.

This commit is contained in:
John Preston 2021-09-03 17:45:21 +03:00
parent 16c9031f88
commit 64457cd6cb
14 changed files with 141 additions and 80 deletions

View file

@ -594,7 +594,7 @@ void HistoryInner::paintEvent(QPaintEvent *e) {
const auto stm = &st->messageStyle(false, false); const auto stm = &st->messageStyle(false, false);
if (clip.y() < _botAbout->rect.y() + _botAbout->rect.height() && clip.y() + clip.height() > _botAbout->rect.y()) { if (clip.y() < _botAbout->rect.y() + _botAbout->rect.height() && clip.y() + clip.height() > _botAbout->rect.y()) {
p.setTextPalette(stm->textPalette); p.setTextPalette(stm->textPalette);
Ui::FillRoundRect(p, _botAbout->rect, stm->msgBg, stm->corners, &stm->msgShadow); Ui::FillRoundRect(p, _botAbout->rect, stm->msgBg, stm->msgBgCorners, &stm->msgShadow);
auto top = _botAbout->rect.top() + st::msgPadding.top(); auto top = _botAbout->rect.top() + st::msgPadding.top();
if (!_history->peer->isRepliesChat()) { if (!_history->peer->isRepliesChat()) {

View file

@ -905,8 +905,6 @@ void Message::paintForwardedInfo(
const PaintContext &context) const { const PaintContext &context) const {
if (displayForwardedFrom()) { if (displayForwardedFrom()) {
const auto item = message(); const auto item = message();
const auto outbg = hasOutLayout();
const auto selected = context.selected();
const auto st = context.st; const auto st = context.st;
const auto stm = context.messageStyle(); const auto stm = context.messageStyle();
const auto forwarded = item->Get<HistoryMessageForwarded>(); const auto forwarded = item->Get<HistoryMessageForwarded>();
@ -1717,7 +1715,6 @@ void Message::drawInfo(
} }
const auto item = message(); const auto item = message();
const auto selected = context.selected();
auto infoW = infoWidth(); auto infoW = infoWidth();
if (rtl()) infoRight = width - infoRight + infoW; if (rtl()) infoRight = width - infoRight + infoW;

View file

@ -373,8 +373,10 @@ void Document::draw(
} }
p.drawPixmap(rthumb.topLeft(), thumb); p.drawPixmap(rthumb.topLeft(), thumb);
if (context.selected()) { if (context.selected()) {
auto overlayCorners = inWebPage ? Ui::SelectedOverlaySmallCorners : Ui::SelectedOverlayLargeCorners; const auto st = context.st;
Ui::FillRoundRect(p, rthumb, p.textPalette().selectOverlay, overlayCorners); Ui::FillRoundRect(p, rthumb, st->msgSelectOverlay(), inWebPage
? st->msgSelectOverlayCornersSmall()
: st->msgSelectOverlayCornersLarge());
} }
if (radial || (!loaded && !_data->loading()) || _data->waitingForAlbum()) { if (radial || (!loaded && !_data->loading()) || _data->waitingForAlbum()) {

View file

@ -306,7 +306,7 @@ void Gif::draw(Painter &p, const PaintContext &context) const {
auto paintx = 0, painty = 0, paintw = width(), painth = height(); auto paintx = 0, painty = 0, paintw = width(), painth = height();
bool bubble = _parent->hasBubble(); bool bubble = _parent->hasBubble();
auto outbg = _parent->hasOutLayout(); const auto outbg = context.outbg;
auto inWebPage = (_parent->media() != this); auto inWebPage = (_parent->media() != this);
auto captionw = paintw - st::msgPadding.left() - st::msgPadding.right(); auto captionw = paintw - st::msgPadding.left() - st::msgPadding.right();
@ -462,7 +462,7 @@ void Gif::draw(Painter &p, const PaintContext &context) const {
} }
if (context.selected()) { if (context.selected()) {
Ui::FillComplexOverlayRect(p, rthumb, roundRadius, roundCorners); Ui::FillComplexOverlayRect(p, st, rthumb, roundRadius, roundCorners);
} }
if (radial if (radial
@ -752,7 +752,7 @@ TextState Gif::textState(QPoint point, StateRequest request) const {
} }
painth -= st::mediaCaptionSkip; painth -= st::mediaCaptionSkip;
} }
auto outbg = _parent->hasOutLayout(); const auto outbg = _parent->hasOutLayout();
auto inWebPage = (_parent->media() != this); auto inWebPage = (_parent->media() != this);
auto isRound = _data->isVideoMessage(); auto isRound = _data->isVideoMessage();
auto usew = paintw, usex = 0; auto usew = paintw, usex = 0;
@ -996,9 +996,9 @@ void Gif::drawGrouped(
: highlightOpacity; : highlightOpacity;
if (overlayOpacity > 0.) { if (overlayOpacity > 0.) {
p.setOpacity(overlayOpacity); p.setOpacity(overlayOpacity);
Ui::FillComplexOverlayRect(p, geometry, roundRadius, corners); Ui::FillComplexOverlayRect(p, st, geometry, roundRadius, corners);
if (!context.selected()) { if (!context.selected()) {
Ui::FillComplexOverlayRect(p, geometry, roundRadius, corners); Ui::FillComplexOverlayRect(p, st, geometry, roundRadius, corners);
} }
p.setOpacity(1.); p.setOpacity(1.);
} }

View file

@ -192,7 +192,7 @@ void Location::draw(Painter &p, const PaintContext &context) const {
const auto &pix = thumbnail->pixSingle(paintw, painth, paintw, painth, roundRadius, roundCorners); const auto &pix = thumbnail->pixSingle(paintw, painth, paintw, painth, roundRadius, roundCorners);
p.drawPixmap(rthumb.topLeft(), pix); p.drawPixmap(rthumb.topLeft(), pix);
} else { } else {
Ui::FillComplexLocationRect(p, rthumb, roundRadius, roundCorners); Ui::FillComplexLocationRect(p, st, rthumb, roundRadius, roundCorners);
} }
const auto paintMarker = [&](const style::icon &icon) { const auto paintMarker = [&](const style::icon &icon) {
icon.paint( icon.paint(
@ -204,7 +204,7 @@ void Location::draw(Painter &p, const PaintContext &context) const {
paintMarker(st->historyMapPoint()); paintMarker(st->historyMapPoint());
paintMarker(st->historyMapPointInner()); paintMarker(st->historyMapPointInner());
if (context.selected()) { if (context.selected()) {
Ui::FillComplexOverlayRect(p, rthumb, roundRadius, roundCorners); Ui::FillComplexOverlayRect(p, st, rthumb, roundRadius, roundCorners);
} }
if (_parent->media() == this) { if (_parent->media() == this) {

View file

@ -109,8 +109,6 @@ void UnwrappedMedia::draw(Painter &p, const PaintContext &context) const {
if (width() < st::msgPadding.left() + st::msgPadding.right() + 1) { if (width() < st::msgPadding.left() + st::msgPadding.right() + 1) {
return; return;
} }
bool selected = (context.selection == FullSelection);
const auto rightAligned = _parent->hasOutLayout() const auto rightAligned = _parent->hasOutLayout()
&& !_parent->delegate()->elementIsChatWide(); && !_parent->delegate()->elementIsChatWide();
const auto inWebPage = (_parent->media() != this); const auto inWebPage = (_parent->media() != this);

View file

@ -284,7 +284,7 @@ void Photo::draw(Painter &p, const PaintContext &context) const {
}(); }();
p.drawPixmap(rthumb.topLeft(), pix); p.drawPixmap(rthumb.topLeft(), pix);
if (context.selected()) { if (context.selected()) {
Ui::FillComplexOverlayRect(p, rthumb, roundRadius, roundCorners); Ui::FillComplexOverlayRect(p, st, rthumb, roundRadius, roundCorners);
} }
} }
if (radial || (!loaded && !_data->loading())) { if (radial || (!loaded && !_data->loading())) {
@ -522,9 +522,9 @@ void Photo::drawGrouped(
if (overlayOpacity > 0.) { if (overlayOpacity > 0.) {
p.setOpacity(overlayOpacity); p.setOpacity(overlayOpacity);
const auto roundRadius = ImageRoundRadius::Large; const auto roundRadius = ImageRoundRadius::Large;
Ui::FillComplexOverlayRect(p, geometry, roundRadius, corners); Ui::FillComplexOverlayRect(p, st, geometry, roundRadius, corners);
if (!context.selected()) { if (!context.selected()) {
Ui::FillComplexOverlayRect(p, geometry, roundRadius, corners); Ui::FillComplexOverlayRect(p, st, geometry, roundRadius, corners);
} }
p.setOpacity(1.); p.setOpacity(1.);
} }

View file

@ -180,7 +180,7 @@ void ThemeDocument::draw(Painter &p, const PaintContext &context) const {
validateThumbnail(); validateThumbnail();
p.drawPixmap(rthumb.topLeft(), _thumbnail); p.drawPixmap(rthumb.topLeft(), _thumbnail);
if (context.selected()) { if (context.selected()) {
Ui::FillComplexOverlayRect(p, rthumb, roundRadius, roundCorners); Ui::FillComplexOverlayRect(p, st, rthumb, roundRadius, roundCorners);
} }
if (_data) { if (_data) {

View file

@ -455,7 +455,6 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
const auto st = context.st; const auto st = context.st;
const auto sti = context.imageStyle(); const auto sti = context.imageStyle();
const auto stm = context.messageStyle(); const auto stm = context.messageStyle();
const auto selected = context.selected();
const auto &barfg = stm->msgReplyBarColor; const auto &barfg = stm->msgReplyBarColor;
const auto &semibold = stm->msgServiceFg; const auto &semibold = stm->msgServiceFg;
@ -503,8 +502,13 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
pix = blurred->pixBlurredSingle(pixw, pixh, pw, ph, ImageRoundRadius::Small); pix = blurred->pixBlurredSingle(pixw, pixh, pw, ph, ImageRoundRadius::Small);
} }
p.drawPixmapLeft(padding.left() + paintw - pw, tshift, width(), pix); p.drawPixmapLeft(padding.left() + paintw - pw, tshift, width(), pix);
if (selected) { if (context.selected()) {
Ui::FillRoundRect(p, style::rtlrect(padding.left() + paintw - pw, tshift, pw, _pixh, width()), p.textPalette().selectOverlay, Ui::SelectedOverlaySmallCorners); const auto st = context.st;
Ui::FillRoundRect(
p,
style::rtlrect(padding.left() + paintw - pw, tshift, pw, _pixh, width()),
st->msgSelectOverlay(),
st->msgSelectOverlayCornersSmall());
} }
paintw -= pw + st::webPagePhotoDelta; paintw -= pw + st::webPagePhotoDelta;
} }
@ -553,7 +557,9 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
_attach->draw(p, context.translated( _attach->draw(p, context.translated(
-attachLeft, -attachLeft,
-attachTop -attachTop
).withSelection(selected ? FullSelection : TextSelection())); ).withSelection(context.selected()
? FullSelection
: TextSelection()));
auto pixwidth = _attach->width(); auto pixwidth = _attach->width();
auto pixheight = _attach->height(); auto pixheight = _attach->height();

View file

@ -75,8 +75,6 @@ void CreateMaskCorners() {
void CreatePaletteCorners() { void CreatePaletteCorners() {
PrepareCorners(MenuCorners, st::roundRadiusSmall, st::menuBg); PrepareCorners(MenuCorners, st::roundRadiusSmall, st::menuBg);
PrepareCorners(BoxCorners, st::boxRadius, st::boxBg); PrepareCorners(BoxCorners, st::boxRadius, st::boxBg);
PrepareCorners(SelectedOverlaySmallCorners, st::roundRadiusSmall, st::msgSelectOverlay);
PrepareCorners(SelectedOverlayLargeCorners, st::historyMessageRadius, st::msgSelectOverlay);
PrepareCorners(DateCorners, st::dateRadius, st::msgDateImgBg); PrepareCorners(DateCorners, st::dateRadius, st::msgDateImgBg);
PrepareCorners(OverviewVideoCorners, st::overviewVideoStatusRadius, st::msgDateImgBg); PrepareCorners(OverviewVideoCorners, st::overviewVideoStatusRadius, st::msgDateImgBg);
PrepareCorners(OverviewVideoSelectedCorners, st::overviewVideoStatusRadius, st::msgDateImgBgSelected); PrepareCorners(OverviewVideoSelectedCorners, st::overviewVideoStatusRadius, st::msgDateImgBgSelected);
@ -90,8 +88,6 @@ void CreatePaletteCorners() {
PrepareCorners(Doc2Corners, st::roundRadiusSmall, st::msgFile2Bg); PrepareCorners(Doc2Corners, st::roundRadiusSmall, st::msgFile2Bg);
PrepareCorners(Doc3Corners, st::roundRadiusSmall, st::msgFile3Bg); PrepareCorners(Doc3Corners, st::roundRadiusSmall, st::msgFile3Bg);
PrepareCorners(Doc4Corners, st::roundRadiusSmall, st::msgFile4Bg); PrepareCorners(Doc4Corners, st::roundRadiusSmall, st::msgFile4Bg);
PrepareCorners(MessageInCorners, st::historyMessageRadius, st::msgInBg, &st::msgInShadow);
} }
} // namespace } // namespace
@ -113,48 +109,6 @@ void FinishCachedCorners() {
PaletteChangedLifetime.destroy(); PaletteChangedLifetime.destroy();
} }
void RectWithCorners(Painter &p, QRect rect, const style::color &bg, CachedRoundCorners index, RectParts corners) {
auto parts = RectPart::Top
| RectPart::NoTopBottom
| RectPart::Bottom
| corners;
FillRoundRect(p, rect, bg, index, nullptr, parts);
if ((corners & RectPart::AllCorners) != RectPart::AllCorners) {
const auto size = Corners[index].p[0].width() / style::DevicePixelRatio();
if (!(corners & RectPart::TopLeft)) {
p.fillRect(rect.x(), rect.y(), size, size, bg);
}
if (!(corners & RectPart::TopRight)) {
p.fillRect(rect.x() + rect.width() - size, rect.y(), size, size, bg);
}
if (!(corners & RectPart::BottomLeft)) {
p.fillRect(rect.x(), rect.y() + rect.height() - size, size, size, bg);
}
if (!(corners & RectPart::BottomRight)) {
p.fillRect(rect.x() + rect.width() - size, rect.y() + rect.height() - size, size, size, bg);
}
}
}
void FillComplexOverlayRect(Painter &p, QRect rect, ImageRoundRadius radius, RectParts corners) {
if (radius == ImageRoundRadius::Ellipse) {
PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen);
p.setBrush(p.textPalette().selectOverlay);
p.drawEllipse(rect);
} else {
auto overlayCorners = (radius == ImageRoundRadius::Small)
? SelectedOverlaySmallCorners
: SelectedOverlayLargeCorners;
const auto bg = p.textPalette().selectOverlay;
RectWithCorners(p, rect, bg, overlayCorners, corners);
}
}
void FillComplexLocationRect(Painter &p, QRect rect, ImageRoundRadius radius, RectParts corners) {
RectWithCorners(p, rect, st::msgInBg, MessageInCorners, corners);
}
void FillRoundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color bg, const CornersPixmaps &corner, const style::color *shadow, RectParts parts) { void FillRoundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color bg, const CornersPixmaps &corner, const style::color *shadow, RectParts parts) {
auto cornerWidth = corner.p[0].width() / style::DevicePixelRatio(); auto cornerWidth = corner.p[0].width() / style::DevicePixelRatio();
auto cornerHeight = corner.p[0].height() / style::DevicePixelRatio(); auto cornerHeight = corner.p[0].height() / style::DevicePixelRatio();

View file

@ -22,8 +22,6 @@ struct CornersPixmaps {
enum CachedRoundCorners : int { enum CachedRoundCorners : int {
BoxCorners, BoxCorners,
MenuCorners, MenuCorners,
SelectedOverlaySmallCorners,
SelectedOverlayLargeCorners,
DateCorners, DateCorners,
OverviewVideoCorners, OverviewVideoCorners,
OverviewVideoSelectedCorners, OverviewVideoSelectedCorners,
@ -38,14 +36,9 @@ enum CachedRoundCorners : int {
Doc3Corners, Doc3Corners,
Doc4Corners, Doc4Corners,
MessageInCorners, // with shadow
RoundCornersCount RoundCornersCount
}; };
void FillComplexOverlayRect(Painter &p, QRect rect, ImageRoundRadius radius, RectParts corners);
void FillComplexLocationRect(Painter &p, QRect rect, ImageRoundRadius radius, RectParts corners);
void FillRoundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color bg, CachedRoundCorners index, const style::color *shadow = nullptr, RectParts parts = RectPart::Full); void FillRoundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, style::color bg, CachedRoundCorners index, const style::color *shadow = nullptr, RectParts parts = RectPart::Full);
inline void FillRoundRect(Painter &p, const QRect &rect, style::color bg, CachedRoundCorners index, const style::color *shadow = nullptr, RectParts parts = RectPart::Full) { inline void FillRoundRect(Painter &p, const QRect &rect, style::color bg, CachedRoundCorners index, const style::color *shadow = nullptr, RectParts parts = RectPart::Full) {
FillRoundRect(p, rect.x(), rect.y(), rect.width(), rect.height(), bg, index, shadow, parts); FillRoundRect(p, rect.x(), rect.y(), rect.width(), rect.height(), bg, index, shadow, parts);

View file

@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/chat/chat_style.h" #include "ui/chat/chat_style.h"
#include "ui/chat/chat_theme.h" #include "ui/chat/chat_theme.h"
#include "ui/image/image_prepare.h" // ImageRoundRadius
#include "ui/ui_utility.h" #include "ui/ui_utility.h"
#include "styles/style_chat.h" #include "styles/style_chat.h"
#include "styles/style_dialogs.h" #include "styles/style_dialogs.h"
@ -25,6 +26,49 @@ void EnsureCorners(
} }
} }
void RectWithCorners(
Painter &p,
QRect rect,
const style::color &bg,
const CornersPixmaps &corners,
RectParts roundCorners) {
const auto parts = RectPart::Top
| RectPart::NoTopBottom
| RectPart::Bottom
| roundCorners;
FillRoundRect(p, rect, bg, corners, nullptr, parts);
if ((roundCorners & RectPart::AllCorners) != RectPart::AllCorners) {
const auto size = corners.p[0].width() / style::DevicePixelRatio();
if (!(roundCorners & RectPart::TopLeft)) {
p.fillRect(rect.x(), rect.y(), size, size, bg);
}
if (!(roundCorners & RectPart::TopRight)) {
p.fillRect(
rect.x() + rect.width() - size,
rect.y(),
size,
size,
bg);
}
if (!(roundCorners & RectPart::BottomLeft)) {
p.fillRect(
rect.x(),
rect.y() + rect.height() - size,
size,
size,
bg);
}
if (!(roundCorners & RectPart::BottomRight)) {
p.fillRect(
rect.x() + rect.width() - size,
rect.y() + rect.height() - size,
size,
size,
bg);
}
}
}
} // namespace } // namespace
not_null<const MessageStyle*> ChatPaintContext::messageStyle() const { not_null<const MessageStyle*> ChatPaintContext::messageStyle() const {
@ -427,7 +471,7 @@ void ChatStyle::assignPalette(not_null<const style::palette*> palette) {
*static_cast<style::palette*>(this) = *palette; *static_cast<style::palette*>(this) = *palette;
style::internal::resetIcons(); style::internal::resetIcons();
for (auto &style : _messageStyles) { for (auto &style : _messageStyles) {
style.corners = {}; style.msgBgCorners = {};
} }
for (auto &style : _imageStyles) { for (auto &style : _imageStyles) {
style.msgDateImgBgCorners = {}; style.msgDateImgBgCorners = {};
@ -437,6 +481,8 @@ void ChatStyle::assignPalette(not_null<const style::palette*> palette) {
_serviceBgCornersNormal = {}; _serviceBgCornersNormal = {};
_serviceBgCornersInverted = {}; _serviceBgCornersInverted = {};
_msgBotKbOverBgAddCorners = {}; _msgBotKbOverBgAddCorners = {};
_msgSelectOverlayCornersSmall = {};
_msgSelectOverlayCornersLarge = {};
} }
const CornersPixmaps &ChatStyle::serviceBgCornersNormal() const { const CornersPixmaps &ChatStyle::serviceBgCornersNormal() const {
@ -470,7 +516,7 @@ const CornersPixmaps &ChatStyle::serviceBgCornersInverted() const {
const MessageStyle &ChatStyle::messageStyle(bool outbg, bool selected) const { const MessageStyle &ChatStyle::messageStyle(bool outbg, bool selected) const {
auto &result = messageStyleRaw(outbg, selected); auto &result = messageStyleRaw(outbg, selected);
EnsureCorners( EnsureCorners(
result.corners, result.msgBgCorners,
st::historyMessageRadius, st::historyMessageRadius,
result.msgBg, result.msgBg,
&result.msgShadow); &result.msgShadow);
@ -502,6 +548,22 @@ const CornersPixmaps &ChatStyle::msgBotKbOverBgAddCorners() const {
return _msgBotKbOverBgAddCorners; return _msgBotKbOverBgAddCorners;
} }
const CornersPixmaps &ChatStyle::msgSelectOverlayCornersSmall() const {
EnsureCorners(
_msgSelectOverlayCornersSmall,
st::roundRadiusSmall,
msgSelectOverlay());
return _msgSelectOverlayCornersSmall;
}
const CornersPixmaps &ChatStyle::msgSelectOverlayCornersLarge() const {
EnsureCorners(
_msgSelectOverlayCornersLarge,
st::historyMessageRadius,
msgSelectOverlay());
return _msgSelectOverlayCornersLarge;
}
MessageStyle &ChatStyle::messageStyleRaw(bool outbg, bool selected) const { MessageStyle &ChatStyle::messageStyleRaw(bool outbg, bool selected) const {
return _messageStyles[(outbg ? 2 : 0) + (selected ? 1 : 0)]; return _messageStyles[(outbg ? 2 : 0) + (selected ? 1 : 0)];
} }
@ -576,4 +638,34 @@ void ChatStyle::make(
make(imageSelected().*my, originalSelected); make(imageSelected().*my, originalSelected);
} }
void FillComplexOverlayRect(
Painter &p,
not_null<const ChatStyle*> st,
QRect rect,
ImageRoundRadius radius,
RectParts roundCorners) {
const auto bg = st->msgSelectOverlay();
if (radius == ImageRoundRadius::Ellipse) {
PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen);
p.setBrush(bg);
p.drawEllipse(rect);
} else {
const auto &corners = (radius == ImageRoundRadius::Small)
? st->msgSelectOverlayCornersSmall()
: st->msgSelectOverlayCornersLarge();
RectWithCorners(p, rect, bg, corners, roundCorners);
}
}
void FillComplexLocationRect(
Painter &p,
not_null<const ChatStyle*> st,
QRect rect,
ImageRoundRadius radius,
RectParts roundCorners) {
const auto stm = &st->messageStyle(false, false);
RectWithCorners(p, rect, stm->msgBg, stm->msgBgCorners, roundCorners);
}
} // namespace Ui } // namespace Ui

View file

@ -11,6 +11,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/style/style_core_palette.h" #include "ui/style/style_core_palette.h"
#include "layout/layout_selection.h" #include "layout/layout_selection.h"
enum class ImageRoundRadius;
namespace Ui { namespace Ui {
class ChatTheme; class ChatTheme;
@ -18,7 +20,7 @@ class ChatStyle;
struct BubblePattern; struct BubblePattern;
struct MessageStyle { struct MessageStyle {
CornersPixmaps corners; CornersPixmaps msgBgCorners;
style::color msgBg; style::color msgBg;
style::color msgShadow; style::color msgShadow;
style::color msgServiceFg; style::color msgServiceFg;
@ -143,6 +145,8 @@ public:
[[nodiscard]] const MessageImageStyle &imageStyle(bool selected) const; [[nodiscard]] const MessageImageStyle &imageStyle(bool selected) const;
[[nodiscard]] const CornersPixmaps &msgBotKbOverBgAddCorners() const; [[nodiscard]] const CornersPixmaps &msgBotKbOverBgAddCorners() const;
[[nodiscard]] const CornersPixmaps &msgSelectOverlayCornersSmall() const;
[[nodiscard]] const CornersPixmaps &msgSelectOverlayCornersLarge() const;
[[nodiscard]] const style::TextPalette &historyPsaForwardPalette() const { [[nodiscard]] const style::TextPalette &historyPsaForwardPalette() const {
return _historyPsaForwardPalette; return _historyPsaForwardPalette;
@ -257,6 +261,8 @@ private:
mutable std::array<MessageImageStyle, 2> _imageStyles; mutable std::array<MessageImageStyle, 2> _imageStyles;
mutable CornersPixmaps _msgBotKbOverBgAddCorners; mutable CornersPixmaps _msgBotKbOverBgAddCorners;
mutable CornersPixmaps _msgSelectOverlayCornersSmall;
mutable CornersPixmaps _msgSelectOverlayCornersLarge;
style::TextPalette _historyPsaForwardPalette; style::TextPalette _historyPsaForwardPalette;
style::TextPalette _imgReplyTextPalette; style::TextPalette _imgReplyTextPalette;
@ -287,4 +293,17 @@ private:
}; };
void FillComplexOverlayRect(
Painter &p,
not_null<const ChatStyle*> st,
QRect rect,
ImageRoundRadius radius,
RectParts roundCorners);
void FillComplexLocationRect(
Painter &p,
not_null<const ChatStyle*> st,
QRect rect,
ImageRoundRadius radius,
RectParts roundCorners);
} // namespace Ui } // namespace Ui

View file

@ -236,7 +236,7 @@ void PaintSolidBubble(Painter &p, const SimpleBubble &args) {
}, [&](const QRect &rect) { }, [&](const QRect &rect) {
p.fillRect(rect, *sh); p.fillRect(rect, *sh);
}, [&](const QRect &rect, RectParts parts) { }, [&](const QRect &rect, RectParts parts) {
Ui::FillRoundRect(p, rect, bg, st.corners, sh, parts); Ui::FillRoundRect(p, rect, bg, st.msgBgCorners, sh, parts);
}, [&](const QPoint &bottomPosition) { }, [&](const QPoint &bottomPosition) {
tail.paint(p, bottomPosition - tailShift, args.outerWidth); tail.paint(p, bottomPosition - tailShift, args.outerWidth);
return tail.width(); return tail.width();