init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
82
Telegram/SourceFiles/ui/cached_round_corners.h
Normal file
82
Telegram/SourceFiles/ui/cached_round_corners.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/rect_part.h"
|
||||
|
||||
enum class ImageRoundRadius;
|
||||
|
||||
namespace Ui {
|
||||
|
||||
struct CornersPixmaps {
|
||||
QPixmap p[4];
|
||||
};
|
||||
|
||||
enum CachedRoundCorners : int {
|
||||
BoxCorners,
|
||||
MenuCorners,
|
||||
DateCorners,
|
||||
OverviewVideoCorners,
|
||||
OverviewVideoSelectedCorners,
|
||||
ForwardCorners,
|
||||
MediaviewSaveCorners,
|
||||
StickerHoverCorners,
|
||||
BotKeyboardCorners,
|
||||
|
||||
Doc1Corners,
|
||||
Doc2Corners,
|
||||
Doc3Corners,
|
||||
Doc4Corners,
|
||||
|
||||
RoundCornersCount
|
||||
};
|
||||
|
||||
void FillRoundRect(QPainter &p, int x, int y, int w, int h, style::color bg, CachedRoundCorners index);
|
||||
inline void FillRoundRect(QPainter &p, const QRect &rect, style::color bg, CachedRoundCorners index) {
|
||||
FillRoundRect(p, rect.x(), rect.y(), rect.width(), rect.height(), bg, index);
|
||||
}
|
||||
|
||||
[[nodiscard]] const CornersPixmaps &CachedCornerPixmaps(CachedRoundCorners index);
|
||||
[[nodiscard]] CornersPixmaps PrepareCornerPixmaps(
|
||||
int radius,
|
||||
style::color bg,
|
||||
const style::color *sh = nullptr);
|
||||
[[nodiscard]] CornersPixmaps PrepareCornerPixmaps(
|
||||
ImageRoundRadius radius,
|
||||
style::color bg,
|
||||
const style::color *sh = nullptr);
|
||||
[[nodiscard]] CornersPixmaps PrepareInvertedCornerPixmaps(
|
||||
int radius,
|
||||
style::color bg);
|
||||
void FillRoundRect(QPainter &p, int x, int y, int w, int h, style::color bg, const CornersPixmaps &corners);
|
||||
inline void FillRoundRect(QPainter &p, const QRect &rect, style::color bg, const CornersPixmaps &corners) {
|
||||
return FillRoundRect(p, rect.x(), rect.y(), rect.width(), rect.height(), bg, corners);
|
||||
}
|
||||
void FillRoundShadow(QPainter &p, int x, int y, int w, int h, style::color shadow, const CornersPixmaps &corners);
|
||||
inline void FillRoundShadow(QPainter &p, const QRect &rect, style::color shadow, const CornersPixmaps &corners) {
|
||||
FillRoundShadow(p, rect.x(), rect.y(), rect.width(), rect.height(), shadow, corners);
|
||||
}
|
||||
|
||||
enum class CachedCornerRadius {
|
||||
Small,
|
||||
ThumbSmall,
|
||||
ThumbLarge,
|
||||
BubbleSmall,
|
||||
BubbleLarge,
|
||||
|
||||
kCount,
|
||||
};
|
||||
[[nodiscard]] int CachedCornerRadiusValue(CachedCornerRadius tag);
|
||||
|
||||
[[nodiscard]] const std::array<QImage, 4> &CachedCornersMasks(
|
||||
CachedCornerRadius radius);
|
||||
|
||||
void StartCachedCorners();
|
||||
void FinishCachedCorners();
|
||||
|
||||
} // namespace Ui
|
||||
Reference in New Issue
Block a user