mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-30 07:18:28 +00:00
Round radius increased for message bubbles.
This commit is contained in:
parent
da293755ef
commit
1904a4f48a
@ -663,7 +663,9 @@ scrollDef: flatScroll {
|
||||
hiding: 1000;
|
||||
}
|
||||
|
||||
msgRadius: 3px;
|
||||
msgRadius: 16px;
|
||||
serviceMsgRadius: 10px;
|
||||
buttonRadius: 3px;
|
||||
|
||||
scrollCountries: flatScroll(scrollDef) {
|
||||
topsh: 0px;
|
||||
@ -732,7 +734,7 @@ btnIntroNext: flatButton(btnDefNext, btnDefBig) {
|
||||
overFont: font(17px);
|
||||
|
||||
width: 300px;
|
||||
radius: msgRadius;
|
||||
radius: buttonRadius;
|
||||
}
|
||||
|
||||
boxShadow: sprite(363px, 50px, 15px, 15px);
|
||||
|
@ -103,7 +103,7 @@ namespace {
|
||||
CornersPixmaps corners[RoundCornersCount];
|
||||
typedef QMap<uint32, CornersPixmaps> CornersMap;
|
||||
CornersMap cornersMap;
|
||||
QImage *cornersMask[4] = { 0 };
|
||||
QImage *cornersMaskLarge[4] = { 0 }, *cornersMaskSmall[4] = { 0 };
|
||||
|
||||
typedef QMap<uint64, QPixmap> EmojiMap;
|
||||
EmojiMap mainEmojiMap;
|
||||
@ -2062,7 +2062,7 @@ namespace {
|
||||
cors[1] = rect.copy(r * 2, 0, r, r);
|
||||
cors[2] = rect.copy(0, r * 2, r, r + (shadow ? s : 0));
|
||||
cors[3] = rect.copy(r * 2, r * 2, r, r + (shadow ? s : 0));
|
||||
if (index != NoneCorners) {
|
||||
if (index != SmallMaskCorners && index != LargeMaskCorners) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
::corners[index].p[i] = new QPixmap(QPixmap::fromImage(cors[i], Qt::ColorOnly));
|
||||
::corners[index].p[i]->setDevicePixelRatio(cRetinaFactor());
|
||||
@ -2101,33 +2101,38 @@ namespace {
|
||||
}
|
||||
|
||||
QImage mask[4];
|
||||
prepareCorners(NoneCorners, st::msgRadius, st::white, 0, mask);
|
||||
prepareCorners(LargeMaskCorners, st::msgRadius, st::white, 0, mask);
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
::cornersMask[i] = new QImage(mask[i].convertToFormat(QImage::Format_ARGB32_Premultiplied));
|
||||
::cornersMask[i]->setDevicePixelRatio(cRetinaFactor());
|
||||
::cornersMaskLarge[i] = new QImage(mask[i].convertToFormat(QImage::Format_ARGB32_Premultiplied));
|
||||
::cornersMaskLarge[i]->setDevicePixelRatio(cRetinaFactor());
|
||||
}
|
||||
prepareCorners(BlackCorners, st::msgRadius, st::black);
|
||||
prepareCorners(WhiteCorners, st::msgRadius, st::white);
|
||||
prepareCorners(ServiceCorners, st::msgRadius, st::msgServiceBg);
|
||||
prepareCorners(ServiceSelectedCorners, st::msgRadius, st::msgServiceSelectBg);
|
||||
prepareCorners(SelectedOverlayCorners, st::msgRadius, st::msgSelectOverlay);
|
||||
prepareCorners(DateCorners, st::msgRadius, st::msgDateImgBg);
|
||||
prepareCorners(DateSelectedCorners, st::msgRadius, st::msgDateImgBgSelected);
|
||||
prepareCorners(SmallMaskCorners, st::buttonRadius, st::white, 0, mask);
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
::cornersMaskSmall[i] = new QImage(mask[i].convertToFormat(QImage::Format_ARGB32_Premultiplied));
|
||||
::cornersMaskSmall[i]->setDevicePixelRatio(cRetinaFactor());
|
||||
}
|
||||
prepareCorners(WhiteCorners, st::buttonRadius, st::white);
|
||||
prepareCorners(ServiceCorners, st::serviceMsgRadius, st::msgServiceBg);
|
||||
prepareCorners(ServiceSelectedCorners, st::serviceMsgRadius, st::msgServiceSelectBg);
|
||||
prepareCorners(SelectedOverlaySmallCorners, st::buttonRadius, st::msgSelectOverlay);
|
||||
prepareCorners(SelectedOverlayLargeCorners, st::msgRadius, st::msgSelectOverlay);
|
||||
prepareCorners(DateCorners, st::serviceMsgRadius, st::msgDateImgBg);
|
||||
prepareCorners(DateSelectedCorners, st::serviceMsgRadius, st::msgDateImgBgSelected);
|
||||
prepareCorners(InShadowCorners, st::msgRadius, st::msgInShadow);
|
||||
prepareCorners(InSelectedShadowCorners, st::msgRadius, st::msgInShadowSelected);
|
||||
prepareCorners(ForwardCorners, st::msgRadius, st::forwardBg);
|
||||
prepareCorners(MediaviewSaveCorners, st::msgRadius, st::medviewSaveMsg);
|
||||
prepareCorners(EmojiHoverCorners, st::msgRadius, st::emojiPanHover);
|
||||
prepareCorners(StickerHoverCorners, st::msgRadius, st::emojiPanHover);
|
||||
prepareCorners(BotKeyboardCorners, st::msgRadius, st::botKbBg);
|
||||
prepareCorners(BotKeyboardOverCorners, st::msgRadius, st::botKbOverBg);
|
||||
prepareCorners(BotKeyboardDownCorners, st::msgRadius, st::botKbDownBg);
|
||||
prepareCorners(PhotoSelectOverlayCorners, st::msgRadius, st::overviewPhotoSelectOverlay);
|
||||
prepareCorners(EmojiHoverCorners, st::buttonRadius, st::emojiPanHover);
|
||||
prepareCorners(StickerHoverCorners, st::buttonRadius, st::emojiPanHover);
|
||||
prepareCorners(BotKeyboardCorners, st::buttonRadius, st::botKbBg);
|
||||
prepareCorners(BotKeyboardOverCorners, st::buttonRadius, st::botKbOverBg);
|
||||
prepareCorners(BotKeyboardDownCorners, st::buttonRadius, st::botKbDownBg);
|
||||
prepareCorners(PhotoSelectOverlayCorners, st::buttonRadius, st::overviewPhotoSelectOverlay);
|
||||
|
||||
prepareCorners(DocBlueCorners, st::msgRadius, st::msgFileBlueColor);
|
||||
prepareCorners(DocGreenCorners, st::msgRadius, st::msgFileGreenColor);
|
||||
prepareCorners(DocRedCorners, st::msgRadius, st::msgFileRedColor);
|
||||
prepareCorners(DocYellowCorners, st::msgRadius, st::msgFileYellowColor);
|
||||
prepareCorners(DocBlueCorners, st::buttonRadius, st::msgFileBlueColor);
|
||||
prepareCorners(DocGreenCorners, st::buttonRadius, st::msgFileGreenColor);
|
||||
prepareCorners(DocRedCorners, st::buttonRadius, st::msgFileRedColor);
|
||||
prepareCorners(DocYellowCorners, st::buttonRadius, st::msgFileYellowColor);
|
||||
|
||||
prepareCorners(MessageInCorners, st::msgRadius, st::msgInBg, &st::msgInShadow);
|
||||
prepareCorners(MessageInSelectedCorners, st::msgRadius, st::msgInBgSelected, &st::msgInShadowSelected);
|
||||
@ -2156,9 +2161,10 @@ namespace {
|
||||
::emojiLarge = 0;
|
||||
for (int32 j = 0; j < 4; ++j) {
|
||||
for (int32 i = 0; i < RoundCornersCount; ++i) {
|
||||
delete ::corners[i].p[j]; ::corners[i].p[j] = 0;
|
||||
delete ::corners[i].p[j]; ::corners[i].p[j] = nullptr;
|
||||
}
|
||||
delete ::cornersMask[j]; ::cornersMask[j] = 0;
|
||||
delete ::cornersMaskSmall[j]; ::cornersMaskSmall[j] = nullptr;
|
||||
delete ::cornersMaskLarge[j]; ::cornersMaskLarge[j] = nullptr;
|
||||
}
|
||||
for (CornersMap::const_iterator i = ::cornersMap.cbegin(), e = ::cornersMap.cend(); i != e; ++i) {
|
||||
for (int32 j = 0; j < 4; ++j) {
|
||||
@ -2552,8 +2558,13 @@ namespace {
|
||||
#endif
|
||||
}
|
||||
|
||||
QImage **cornersMask() {
|
||||
return ::cornersMask;
|
||||
QImage **cornersMask(ImageRoundRadius radius) {
|
||||
switch (radius) {
|
||||
case ImageRoundRadius::Large: return ::cornersMaskLarge;
|
||||
case ImageRoundRadius::Small:
|
||||
default: break;
|
||||
}
|
||||
return ::cornersMaskSmall;
|
||||
}
|
||||
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &bg, const CornersPixmaps &c, const style::color *sh) {
|
||||
int32 cw = c.p[0]->width() / cIntRetinaFactor(), ch = c.p[0]->height() / cIntRetinaFactor();
|
||||
@ -2586,12 +2597,15 @@ namespace {
|
||||
p.drawPixmap(x + w - cw, y + h - ch + st::msgShadow, *c.p[3]);
|
||||
}
|
||||
|
||||
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &bg) {
|
||||
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &bg, ImageRoundRadius radius) {
|
||||
uint32 colorKey = ((uint32(bg->c.alpha()) & 0xFF) << 24) | ((uint32(bg->c.red()) & 0xFF) << 16) | ((uint32(bg->c.green()) & 0xFF) << 8) | ((uint32(bg->c.blue()) & 0xFF) << 24);
|
||||
CornersMap::const_iterator i = cornersMap.find(colorKey);
|
||||
if (i == cornersMap.cend()) {
|
||||
QImage images[4];
|
||||
prepareCorners(NoneCorners, st::msgRadius, bg, 0, images);
|
||||
switch (radius) {
|
||||
case ImageRoundRadius::Small: prepareCorners(SmallMaskCorners, st::buttonRadius, bg, 0, images); break;
|
||||
case ImageRoundRadius::Large: prepareCorners(LargeMaskCorners, st::msgRadius, bg, 0, images); break;
|
||||
}
|
||||
|
||||
CornersPixmaps pixmaps;
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
@ -2754,8 +2768,8 @@ namespace {
|
||||
uchar bsel = snap(qRound(((1. - alphaSel) * b + addSel) / alphaSel), 0, 0xFF);
|
||||
_msgServiceSelectBg = style::color(r, g, b, qRound(alphaSel * 0xFF));
|
||||
|
||||
prepareCorners(ServiceCorners, st::msgRadius, _msgServiceBg);
|
||||
prepareCorners(ServiceSelectedCorners, st::msgRadius, _msgServiceSelectBg);
|
||||
prepareCorners(ServiceCorners, st::serviceMsgRadius, _msgServiceBg);
|
||||
prepareCorners(ServiceSelectedCorners, st::serviceMsgRadius, _msgServiceSelectBg);
|
||||
|
||||
uchar rScroll = uchar(componentsScroll[0]), gScroll = uchar(componentsScroll[1]), bScroll = uchar(componentsScroll[2]);
|
||||
_historyScrollBarColor = style::color(rScroll, gScroll, bScroll, qRound(st::historyScroll.barColor->c.alphaF() * 0xFF));
|
||||
|
@ -271,7 +271,7 @@ namespace App {
|
||||
#endif
|
||||
void setProxySettings(QTcpSocket &socket);
|
||||
|
||||
QImage **cornersMask();
|
||||
QImage **cornersMask(ImageRoundRadius radius);
|
||||
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &bg, RoundCorners index, const style::color *sh = 0);
|
||||
inline void roundRect(Painter &p, const QRect &rect, const style::color &bg, RoundCorners index, const style::color *sh = 0) {
|
||||
return roundRect(p, rect.x(), rect.y(), rect.width(), rect.height(), bg, index, sh);
|
||||
@ -280,9 +280,9 @@ namespace App {
|
||||
inline void roundShadow(Painter &p, const QRect &rect, const style::color &sh, RoundCorners index) {
|
||||
return roundShadow(p, rect.x(), rect.y(), rect.width(), rect.height(), sh, index);
|
||||
}
|
||||
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &bg);
|
||||
inline void roundRect(Painter &p, const QRect &rect, const style::color &bg) {
|
||||
return roundRect(p, rect.x(), rect.y(), rect.width(), rect.height(), bg);
|
||||
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &bg, ImageRoundRadius radius);
|
||||
inline void roundRect(Painter &p, const QRect &rect, const style::color &bg, ImageRoundRadius radius) {
|
||||
return roundRect(p, rect.x(), rect.y(), rect.width(), rect.height(), bg, radius);
|
||||
}
|
||||
|
||||
void initBackground(int32 id = DefaultChatBackground, const QImage &p = QImage(), bool nowrite = false);
|
||||
|
@ -123,7 +123,7 @@ PhotoSendBox::PhotoSendBox(const FileLoadResultPtr &file) : AbstractBox(st::boxW
|
||||
} else {
|
||||
_thumbw = st::msgFileThumbSize;
|
||||
}
|
||||
_thumb = imagePix(_thumb.toImage(), _thumbw * cIntRetinaFactor(), 0, ImagePixSmooth | ImagePixRounded, st::msgFileThumbSize, st::msgFileThumbSize);
|
||||
_thumb = imagePix(_thumb.toImage(), _thumbw * cIntRetinaFactor(), 0, ImagePixSmooth | ImagePixRoundedSmall, st::msgFileThumbSize, st::msgFileThumbSize);
|
||||
}
|
||||
|
||||
_name.setText(st::semiboldFont, _file->filename, _textNameOptions);
|
||||
@ -427,7 +427,7 @@ EditCaptionBox::EditCaptionBox(HistoryItem *msg) : AbstractBox(st::boxWideWidth)
|
||||
} else {
|
||||
_thumbw = st::msgFileThumbSize;
|
||||
}
|
||||
_thumb = imagePix(image->pix().toImage(), _thumbw * cIntRetinaFactor(), 0, ImagePixSmooth | ImagePixRounded, st::msgFileThumbSize, st::msgFileThumbSize);
|
||||
_thumb = imagePix(image->pix().toImage(), _thumbw * cIntRetinaFactor(), 0, ImagePixSmooth | ImagePixRoundedSmall, st::msgFileThumbSize, st::msgFileThumbSize);
|
||||
}
|
||||
|
||||
if (doc) {
|
||||
@ -462,7 +462,7 @@ EditCaptionBox::EditCaptionBox(HistoryItem *msg) : AbstractBox(st::boxWideWidth)
|
||||
} else {
|
||||
maxW = dimensions.width();
|
||||
maxH = dimensions.height();
|
||||
_thumb = image->pixNoCache(maxW * cIntRetinaFactor(), maxH * cIntRetinaFactor(), ImagePixSmooth | ImagePixRounded, maxW, maxH);
|
||||
_thumb = image->pixNoCache(maxW * cIntRetinaFactor(), maxH * cIntRetinaFactor(), ImagePixSmooth, maxW, maxH);
|
||||
}
|
||||
int32 tw = _thumb.width(), th = _thumb.height();
|
||||
if (!tw || !th) {
|
||||
|
@ -229,7 +229,7 @@ void StickerSetInner::paintEvent(QPaintEvent *e) {
|
||||
}
|
||||
}
|
||||
|
||||
float64 coef = qMin((st::stickersSize.width() - st::msgRadius * 2) / float64(doc->dimensions.width()), (st::stickersSize.height() - st::msgRadius * 2) / float64(doc->dimensions.height()));
|
||||
float64 coef = qMin((st::stickersSize.width() - st::buttonRadius * 2) / float64(doc->dimensions.width()), (st::stickersSize.height() - st::buttonRadius * 2) / float64(doc->dimensions.height()));
|
||||
if (coef > 1) coef = 1;
|
||||
int32 w = qRound(coef * doc->dimensions.width()), h = qRound(coef * doc->dimensions.height());
|
||||
if (w < 1) w = 1;
|
||||
|
@ -948,9 +948,9 @@ void EmojiPanInner::onShowPicker() {
|
||||
int32 size = (c == tab) ? (sel - (sel % EmojiPanPerRow)) : _counts[c], rows = (size / EmojiPanPerRow) + ((size % EmojiPanPerRow) ? 1 : 0);
|
||||
y += st::emojiPanHeader + (rows * st::emojiPanSize.height());
|
||||
}
|
||||
y -= _picker.height() - st::msgRadius + _top;
|
||||
y -= _picker.height() - st::buttonRadius + _top;
|
||||
if (y < 0) {
|
||||
y += _picker.height() - st::msgRadius + st::emojiPanSize.height() - st::msgRadius;
|
||||
y += _picker.height() - st::buttonRadius + st::emojiPanSize.height() - st::buttonRadius;
|
||||
}
|
||||
int xmax = width() - _picker.width();
|
||||
float64 coef = float64(sel % EmojiPanPerRow) / float64(EmojiPanPerRow - 1);
|
||||
@ -1406,7 +1406,7 @@ void StickerPanInner::paintStickers(Painter &p, const QRect &r) {
|
||||
sticker->checkSticker();
|
||||
}
|
||||
|
||||
float64 coef = qMin((st::stickerPanSize.width() - st::msgRadius * 2) / float64(sticker->dimensions.width()), (st::stickerPanSize.height() - st::msgRadius * 2) / float64(sticker->dimensions.height()));
|
||||
float64 coef = qMin((st::stickerPanSize.width() - st::buttonRadius * 2) / float64(sticker->dimensions.width()), (st::stickerPanSize.height() - st::buttonRadius * 2) / float64(sticker->dimensions.height()));
|
||||
if (coef > 1) coef = 1;
|
||||
int32 w = qRound(coef * sticker->dimensions.width()), h = qRound(coef * sticker->dimensions.height());
|
||||
if (w < 1) w = 1;
|
||||
|
@ -3407,14 +3407,14 @@ void HistoryPhoto::draw(Painter &p, const QRect &r, TextSelection selection, uin
|
||||
|
||||
QPixmap pix;
|
||||
if (loaded) {
|
||||
pix = _data->full->pixSingle(_pixw, _pixh, width, height);
|
||||
pix = _data->full->pixSingle(ImageRoundRadius::Large, _pixw, _pixh, width, height);
|
||||
} else {
|
||||
pix = _data->thumb->pixBlurredSingle(_pixw, _pixh, width, height);
|
||||
pix = _data->thumb->pixBlurredSingle(ImageRoundRadius::Large, _pixw, _pixh, width, height);
|
||||
}
|
||||
QRect rthumb(rtlrect(skipx, skipy, width, height, _width));
|
||||
p.drawPixmap(rthumb.topLeft(), pix);
|
||||
if (selected) {
|
||||
App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||
App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, SelectedOverlayLargeCorners);
|
||||
}
|
||||
|
||||
if (notChild && (radial || (!loaded && !_data->loading()))) {
|
||||
@ -3736,9 +3736,9 @@ void HistoryVideo::draw(Painter &p, const QRect &r, TextSelection selection, uin
|
||||
}
|
||||
|
||||
QRect rthumb(rtlrect(skipx, skipy, width, height, _width));
|
||||
p.drawPixmap(rthumb.topLeft(), _data->thumb->pixBlurredSingle(_thumbw, 0, width, height));
|
||||
p.drawPixmap(rthumb.topLeft(), _data->thumb->pixBlurredSingle(ImageRoundRadius::Large, _thumbw, 0, width, height));
|
||||
if (selected) {
|
||||
App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||
App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, SelectedOverlayLargeCorners);
|
||||
}
|
||||
|
||||
QRect inner(rthumb.x() + (rthumb.width() - st::msgFileSize) / 2, rthumb.y() + (rthumb.height() - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize);
|
||||
@ -4074,10 +4074,10 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
|
||||
bottom = st::msgFileThumbPadding.top() + st::msgFileThumbSize + st::msgFileThumbPadding.bottom();
|
||||
|
||||
QRect rthumb(rtlrect(st::msgFileThumbPadding.left(), st::msgFileThumbPadding.top(), st::msgFileThumbSize, st::msgFileThumbSize, _width));
|
||||
QPixmap thumb = loaded ? _data->thumb->pixSingle(thumbed->_thumbw, 0, st::msgFileThumbSize, st::msgFileThumbSize) : _data->thumb->pixBlurredSingle(thumbed->_thumbw, 0, st::msgFileThumbSize, st::msgFileThumbSize);
|
||||
QPixmap thumb = loaded ? _data->thumb->pixSingle(ImageRoundRadius::Small, thumbed->_thumbw, 0, st::msgFileThumbSize, st::msgFileThumbSize) : _data->thumb->pixBlurredSingle(ImageRoundRadius::Small, thumbed->_thumbw, 0, st::msgFileThumbSize, st::msgFileThumbSize);
|
||||
p.drawPixmap(rthumb.topLeft(), thumb);
|
||||
if (selected) {
|
||||
App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||
App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, SelectedOverlaySmallCorners);
|
||||
}
|
||||
|
||||
if (radial || (!loaded && !_data->loading())) {
|
||||
@ -4695,10 +4695,10 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, uint6
|
||||
if (animating) {
|
||||
p.drawPixmap(rthumb.topLeft(), _gif->current(_thumbw, _thumbh, width, height, (Ui::isLayerShown() || Ui::isMediaViewShown() || Ui::isInlineItemBeingChosen()) ? 0 : ms));
|
||||
} else {
|
||||
p.drawPixmap(rthumb.topLeft(), _data->thumb->pixBlurredSingle(_thumbw, _thumbh, width, height));
|
||||
p.drawPixmap(rthumb.topLeft(), _data->thumb->pixBlurredSingle(ImageRoundRadius::Large, _thumbw, _thumbh, width, height));
|
||||
}
|
||||
if (selected) {
|
||||
App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||
App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, SelectedOverlayLargeCorners);
|
||||
}
|
||||
|
||||
if (radial || (!_gif && ((!loaded && !_data->loading()) || !cAutoPlayGif())) || (_gif == BadClipReader)) {
|
||||
@ -5272,7 +5272,7 @@ void HistoryContact::draw(Painter &p, const QRect &r, TextSelection selection, u
|
||||
p.drawPixmap(rthumb.topLeft(), userDefPhoto(qAbs(_userId) % UserColorsCount)->pixCircled(st::msgFileThumbSize, st::msgFileThumbSize));
|
||||
}
|
||||
if (selected) {
|
||||
App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||
App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, SelectedOverlaySmallCorners);
|
||||
}
|
||||
|
||||
bool over = ClickHandler::showAsActive(_linkl);
|
||||
@ -5664,13 +5664,13 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, u
|
||||
pixw = qRound(pixw * coef);
|
||||
}
|
||||
if (full) {
|
||||
pix = _data->photo->medium->pixSingle(pixw, pixh, pw, ph);
|
||||
pix = _data->photo->medium->pixSingle(ImageRoundRadius::Small, pixw, pixh, pw, ph);
|
||||
} else {
|
||||
pix = _data->photo->thumb->pixBlurredSingle(pixw, pixh, pw, ph);
|
||||
pix = _data->photo->thumb->pixBlurredSingle(ImageRoundRadius::Small, pixw, pixh, pw, ph);
|
||||
}
|
||||
p.drawPixmapLeft(lshift + width - pw, 0, _width, pix);
|
||||
if (selected) {
|
||||
App::roundRect(p, rtlrect(lshift + width - pw, 0, pw, _pixh, _width), textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||
App::roundRect(p, rtlrect(lshift + width - pw, 0, pw, _pixh, _width), textstyleCurrent()->selectOverlay, SelectedOverlaySmallCorners);
|
||||
}
|
||||
width -= pw + st::webPagePhotoDelta;
|
||||
}
|
||||
@ -6194,20 +6194,20 @@ void HistoryLocation::draw(Painter &p, const QRect &r, TextSelection selection,
|
||||
int32 w = _data->thumb->width(), h = _data->thumb->height();
|
||||
QPixmap pix;
|
||||
if (width * h == height * w || (w == fullWidth() && h == fullHeight())) {
|
||||
pix = _data->thumb->pixSingle(width, height, width, height);
|
||||
pix = _data->thumb->pixSingle(ImageRoundRadius::Large, width, height, width, height);
|
||||
} else if (width * h > height * w) {
|
||||
int32 nw = height * w / h;
|
||||
pix = _data->thumb->pixSingle(nw, height, width, height);
|
||||
pix = _data->thumb->pixSingle(ImageRoundRadius::Large, nw, height, width, height);
|
||||
} else {
|
||||
int32 nh = width * h / w;
|
||||
pix = _data->thumb->pixSingle(width, nh, width, height);
|
||||
pix = _data->thumb->pixSingle(ImageRoundRadius::Large, width, nh, width, height);
|
||||
}
|
||||
p.drawPixmap(QPoint(skipx, skipy), pix);
|
||||
} else {
|
||||
App::roundRect(p, skipx, skipy, width, height, st::white, MessageInCorners);
|
||||
}
|
||||
if (selected) {
|
||||
App::roundRect(p, skipx, skipy, width, height, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||
App::roundRect(p, skipx, skipy, width, height, textstyleCurrent()->selectOverlay, SelectedOverlayLargeCorners);
|
||||
}
|
||||
|
||||
if (_parent->getMedia() == this) {
|
||||
@ -6511,9 +6511,9 @@ void HistoryMessageReply::paint(Painter &p, const HistoryItem *holder, int x, in
|
||||
ImagePtr replyPreview = replyToMsg->getMedia()->replyPreview();
|
||||
if (!replyPreview->isNull()) {
|
||||
QRect to(rtlrect(x + st::msgReplyBarSkip, y + st::msgReplyPadding.top() + st::msgReplyBarPos.y(), st::msgReplyBarSize.height(), st::msgReplyBarSize.height(), w + 2 * x));
|
||||
p.drawPixmap(to.x(), to.y(), replyPreview->pixSingle(replyPreview->width() / cIntRetinaFactor(), replyPreview->height() / cIntRetinaFactor(), to.width(), to.height()));
|
||||
p.drawPixmap(to.x(), to.y(), replyPreview->pixSingle(ImageRoundRadius::Small, replyPreview->width() / cIntRetinaFactor(), replyPreview->height() / cIntRetinaFactor(), to.width(), to.height()));
|
||||
if (selected) {
|
||||
App::roundRect(p, to, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||
App::roundRect(p, to, textstyleCurrent()->selectOverlay, SelectedOverlaySmallCorners);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ void FieldAutocompleteInner::paintEvent(QPaintEvent *e) {
|
||||
sticker->checkSticker();
|
||||
}
|
||||
|
||||
float64 coef = qMin((st::stickerPanSize.width() - st::msgRadius * 2) / float64(sticker->dimensions.width()), (st::stickerPanSize.height() - st::msgRadius * 2) / float64(sticker->dimensions.height()));
|
||||
float64 coef = qMin((st::stickerPanSize.width() - st::buttonRadius * 2) / float64(sticker->dimensions.width()), (st::stickerPanSize.height() - st::buttonRadius * 2) / float64(sticker->dimensions.height()));
|
||||
if (coef > 1) coef = 1;
|
||||
int32 w = qRound(coef * sticker->dimensions.width()), h = qRound(coef * sticker->dimensions.height());
|
||||
if (w < 1) w = 1;
|
||||
|
@ -58,14 +58,14 @@ void createCircleMasks() {
|
||||
serviceMessageStyle.createIfNull();
|
||||
if (!serviceMessageStyle->circle[NormalMask].isNull()) return;
|
||||
|
||||
int size = st::msgRadius * 2;
|
||||
int size = st::serviceMsgRadius * 2;
|
||||
serviceMessageStyle->circle[NormalMask] = style::createCircleMask(size);
|
||||
serviceMessageStyle->circle[InvertedMask] = style::createInvertedCircleMask(size);
|
||||
}
|
||||
|
||||
QPixmap circleCorner(int corner) {
|
||||
if (serviceMessageStyle->corners[corner].isNull()) {
|
||||
int size = st::msgRadius * cIntRetinaFactor();
|
||||
int size = st::serviceMsgRadius * cIntRetinaFactor();
|
||||
|
||||
int xoffset = 0, yoffset = 0;
|
||||
if (corner & CornerRight) {
|
||||
@ -120,7 +120,7 @@ void paintBubblePart(Painter &p, int x, int y, int width, int height, SideStyle
|
||||
y += skip;
|
||||
height -= skip;
|
||||
}
|
||||
if (int skip = paintBubbleSide(p, x, y + height - st::msgRadius, width, bottomStyle, CornerBottom)) {
|
||||
if (int skip = paintBubbleSide(p, x, y + height - st::serviceMsgRadius, width, bottomStyle, CornerBottom)) {
|
||||
height -= skip;
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ QVector<int> ServiceMessagePainter::countLineWidths(const Text &text, const QRec
|
||||
lineWidths.reserve(linesCount);
|
||||
text.countLineWidths(textRect.width(), &lineWidths);
|
||||
|
||||
int minDelta = 4 * st::msgRadius;
|
||||
int minDelta = 4 * st::serviceMsgRadius;
|
||||
for (int i = 0, count = lineWidths.size(); i < count; ++i) {
|
||||
int width = qMax(lineWidths.at(i), 0);
|
||||
if (i > 0) {
|
||||
|
@ -8268,7 +8268,7 @@ void HistoryWidget::drawField(Painter &p, const QRect &rect) {
|
||||
ImagePtr replyPreview = drawMsgText->getMedia()->replyPreview();
|
||||
if (!replyPreview->isNull()) {
|
||||
QRect to(replyLeft, backy + st::msgReplyPadding.top(), st::msgReplyBarSize.height(), st::msgReplyBarSize.height());
|
||||
p.drawPixmap(to.x(), to.y(), replyPreview->pixSingle(replyPreview->width() / cIntRetinaFactor(), replyPreview->height() / cIntRetinaFactor(), to.width(), to.height()));
|
||||
p.drawPixmap(to.x(), to.y(), replyPreview->pixSingle(ImageRoundRadius::Small, replyPreview->width() / cIntRetinaFactor(), replyPreview->height() / cIntRetinaFactor(), to.width(), to.height()));
|
||||
}
|
||||
replyLeft += st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x();
|
||||
}
|
||||
@ -8429,7 +8429,7 @@ void HistoryWidget::drawPinnedBar(Painter &p) {
|
||||
ImagePtr replyPreview = _pinnedBar->msg->getMedia()->replyPreview();
|
||||
if (!replyPreview->isNull()) {
|
||||
QRect to(left, st::msgReplyPadding.top(), st::msgReplyBarSize.height(), st::msgReplyBarSize.height());
|
||||
p.drawPixmap(to.x(), to.y(), replyPreview->pixSingle(replyPreview->width() / cIntRetinaFactor(), replyPreview->height() / cIntRetinaFactor(), to.width(), to.height()));
|
||||
p.drawPixmap(to.x(), to.y(), replyPreview->pixSingle(ImageRoundRadius::Small, replyPreview->width() / cIntRetinaFactor(), replyPreview->height() / cIntRetinaFactor(), to.width(), to.height()));
|
||||
}
|
||||
left += st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x();
|
||||
}
|
||||
|
@ -420,8 +420,8 @@ void Sticker::clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) {
|
||||
|
||||
QSize Sticker::getThumbSize() const {
|
||||
int width = qMax(content_width(), 1), height = qMax(content_height(), 1);
|
||||
float64 coefw = (st::stickerPanSize.width() - st::msgRadius * 2) / float64(width);
|
||||
float64 coefh = (st::stickerPanSize.height() - st::msgRadius * 2) / float64(height);
|
||||
float64 coefw = (st::stickerPanSize.width() - st::buttonRadius * 2) / float64(width);
|
||||
float64 coefh = (st::stickerPanSize.height() - st::buttonRadius * 2) / float64(height);
|
||||
float64 coef = qMin(qMin(coefw, coefh), 1.);
|
||||
int w = qRound(coef * content_width()), h = qRound(coef * content_height());
|
||||
return QSize(qMax(w, 1), qMax(h, 1));
|
||||
|
@ -29,12 +29,14 @@ const TextParseOptions &itemTextOptions(History *h, PeerData *f);
|
||||
const TextParseOptions &itemTextNoMonoOptions(History *h, PeerData *f);
|
||||
|
||||
enum RoundCorners {
|
||||
NoneCorners = 0x00, // for images
|
||||
BlackCorners,
|
||||
SmallMaskCorners = 0x00, // for images
|
||||
LargeMaskCorners,
|
||||
|
||||
WhiteCorners,
|
||||
ServiceCorners,
|
||||
ServiceSelectedCorners,
|
||||
SelectedOverlayCorners,
|
||||
SelectedOverlaySmallCorners,
|
||||
SelectedOverlayLargeCorners,
|
||||
DateCorners,
|
||||
DateSelectedCorners,
|
||||
ForwardCorners,
|
||||
|
@ -1051,15 +1051,15 @@ void Link::paint(Painter &p, const QRect &clip, TextSelection selection, const P
|
||||
if (_page && _page->photo) {
|
||||
QPixmap pix;
|
||||
if (_page->photo->medium->loaded()) {
|
||||
pix = _page->photo->medium->pixSingle(_pixw, _pixh, st::linksPhotoSize, st::linksPhotoSize);
|
||||
pix = _page->photo->medium->pixSingle(ImageRoundRadius::Small, _pixw, _pixh, st::linksPhotoSize, st::linksPhotoSize);
|
||||
} else if (_page->photo->loaded()) {
|
||||
pix = _page->photo->full->pixSingle(_pixw, _pixh, st::linksPhotoSize, st::linksPhotoSize);
|
||||
pix = _page->photo->full->pixSingle(ImageRoundRadius::Small, _pixw, _pixh, st::linksPhotoSize, st::linksPhotoSize);
|
||||
} else {
|
||||
pix = _page->photo->thumb->pixSingle(_pixw, _pixh, st::linksPhotoSize, st::linksPhotoSize);
|
||||
pix = _page->photo->thumb->pixSingle(ImageRoundRadius::Small, _pixw, _pixh, st::linksPhotoSize, st::linksPhotoSize);
|
||||
}
|
||||
p.drawPixmapLeft(0, top, _width, pix);
|
||||
} else if (_page && _page->document && !_page->document->thumb->isNull()) {
|
||||
p.drawPixmapLeft(0, top, _width, _page->document->thumb->pixSingle(_pixw, _pixh, st::linksPhotoSize, st::linksPhotoSize));
|
||||
p.drawPixmapLeft(0, top, _width, _page->document->thumb->pixSingle(ImageRoundRadius::Small, _pixw, _pixh, st::linksPhotoSize, st::linksPhotoSize));
|
||||
} else {
|
||||
int32 index = _letter.isEmpty() ? 0 : (_letter.at(0).unicode() % 4);
|
||||
switch (index) {
|
||||
|
@ -186,11 +186,11 @@ StorageKey PeerData::userpicUniqueKey() const {
|
||||
}
|
||||
|
||||
void PeerData::saveUserpic(const QString &path, int size) const {
|
||||
currentUserpic()->pixRounded(size, size).save(path, "PNG");
|
||||
currentUserpic()->pixRounded(ImageRoundRadius::Small, size, size).save(path, "PNG");
|
||||
}
|
||||
|
||||
QPixmap PeerData::genUserpic(int size) const {
|
||||
return currentUserpic()->pixRounded(size, size);
|
||||
return currentUserpic()->pixRounded(ImageRoundRadius::Small, size, size);
|
||||
}
|
||||
|
||||
const Text &BotCommand::descriptionText() const {
|
||||
|
@ -230,7 +230,7 @@ QPixmap _prepareFrame(const ClipFrameRequest &request, const QImage &original, b
|
||||
}
|
||||
}
|
||||
if (request.rounded) {
|
||||
imageRound(cache);
|
||||
imageRound(cache, ImageRoundRadius::Large);
|
||||
}
|
||||
return QPixmap::fromImage(cache, Qt::ColorOnly);
|
||||
}
|
||||
|
@ -102,12 +102,12 @@ void RoundButton::paintEvent(QPaintEvent *e) {
|
||||
if (_fullWidthOverride < 0) {
|
||||
rounded = QRect(0, rounded.top(), innerWidth - _fullWidthOverride, rounded.height());
|
||||
}
|
||||
App::roundRect(p, rounded, _st.textBg);
|
||||
App::roundRect(p, rounded, _st.textBg, ImageRoundRadius::Small);
|
||||
|
||||
auto o = a_textBgOverOpacity.current();
|
||||
if (o > 0) {
|
||||
p.setOpacity(o);
|
||||
App::roundRect(p, rounded, _st.textBgOver);
|
||||
App::roundRect(p, rounded, _st.textBgOver, ImageRoundRadius::Small);
|
||||
p.setOpacity(1);
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ void CountryInput::paintEvent(QPaintEvent *e) {
|
||||
p.setRenderHint(QPainter::HighQualityAntialiasing);
|
||||
p.setBrush(_st.bgColor);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.drawRoundedRect(_inner, st::msgRadius, st::msgRadius);
|
||||
p.drawRoundedRect(_inner, st::buttonRadius, st::buttonRadius);
|
||||
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
|
||||
|
||||
p.drawPixmap(_arrowRect.x(), _arrowRect.top(), _arrow);
|
||||
|
@ -371,7 +371,7 @@ void BoxButton::paintEvent(QPaintEvent *e) {
|
||||
float64 o = a_textBgOverOpacity.current();
|
||||
if (o > 0) {
|
||||
p.setOpacity(o);
|
||||
App::roundRect(p, rect(), _st.textBgOver);
|
||||
App::roundRect(p, rect(), _st.textBgOver, ImageRoundRadius::Small);
|
||||
p.setOpacity(1);
|
||||
p.setPen(a_textFg.current());
|
||||
} else {
|
||||
|
@ -347,7 +347,7 @@ void Checkbox::paintEvent(QPaintEvent *e) {
|
||||
} else {
|
||||
p.setBrush(st::white);
|
||||
}
|
||||
p.drawRoundedRect(QRectF(_checkRect).marginsRemoved(QMarginsF(_st.thickness / 2., _st.thickness / 2., _st.thickness / 2., _st.thickness / 2.)), st::msgRadius - (_st.thickness / 2.), st::msgRadius - (_st.thickness / 2.));
|
||||
p.drawRoundedRect(QRectF(_checkRect).marginsRemoved(QMarginsF(_st.thickness / 2., _st.thickness / 2., _st.thickness / 2., _st.thickness / 2.)), st::buttonRadius - (_st.thickness / 2.), st::buttonRadius - (_st.thickness / 2.));
|
||||
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
|
||||
|
||||
if (checked > 0) {
|
||||
|
@ -180,7 +180,7 @@ void FlatInput::paintEvent(QPaintEvent *e) {
|
||||
pen.setWidth(_st.borderWidth);
|
||||
p.setPen(pen);
|
||||
p.setBrush(QBrush(a_bgColor.current()));
|
||||
p.drawRoundedRect(QRectF(0, 0, width(), height()).marginsRemoved(QMarginsF(_st.borderWidth / 2., _st.borderWidth / 2., _st.borderWidth / 2., _st.borderWidth / 2.)), st::msgRadius - (_st.borderWidth / 2.), st::msgRadius - (_st.borderWidth / 2.));
|
||||
p.drawRoundedRect(QRectF(0, 0, width(), height()).marginsRemoved(QMarginsF(_st.borderWidth / 2., _st.borderWidth / 2., _st.borderWidth / 2., _st.borderWidth / 2.)), st::buttonRadius - (_st.borderWidth / 2.), st::buttonRadius - (_st.borderWidth / 2.));
|
||||
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
|
||||
|
||||
if (_st.imgRect.pxWidth()) {
|
||||
|
@ -117,7 +117,7 @@ const QPixmap &Image::pix(int32 w, int32 h) const {
|
||||
return i.value();
|
||||
}
|
||||
|
||||
const QPixmap &Image::pixRounded(int32 w, int32 h) const {
|
||||
const QPixmap &Image::pixRounded(ImageRoundRadius radius, int32 w, int32 h) const {
|
||||
checkload();
|
||||
|
||||
if (w <= 0 || !width() || !height()) {
|
||||
@ -129,7 +129,8 @@ const QPixmap &Image::pixRounded(int32 w, int32 h) const {
|
||||
uint64 k = RoundedCacheSkip | (uint64(w) << 32) | uint64(h);
|
||||
Sizes::const_iterator i = _sizesCache.constFind(k);
|
||||
if (i == _sizesCache.cend()) {
|
||||
QPixmap p(pixNoCache(w, h, ImagePixSmooth | ImagePixRounded));
|
||||
auto options = ImagePixSmooth | (radius == ImageRoundRadius::Large ? ImagePixRoundedLarge : ImagePixRoundedSmall);
|
||||
QPixmap p(pixNoCache(w, h, options));
|
||||
if (cRetina()) p.setDevicePixelRatio(cRetinaFactor());
|
||||
i = _sizesCache.insert(k, p);
|
||||
if (!p.isNull()) {
|
||||
@ -227,7 +228,7 @@ const QPixmap &Image::pixBlurredColored(const style::color &add, int32 w, int32
|
||||
return i.value();
|
||||
}
|
||||
|
||||
const QPixmap &Image::pixSingle(int32 w, int32 h, int32 outerw, int32 outerh) const {
|
||||
const QPixmap &Image::pixSingle(ImageRoundRadius radius, int32 w, int32 h, int32 outerw, int32 outerh) const {
|
||||
checkload();
|
||||
|
||||
if (w <= 0 || !width() || !height()) {
|
||||
@ -242,7 +243,8 @@ const QPixmap &Image::pixSingle(int32 w, int32 h, int32 outerw, int32 outerh) co
|
||||
if (i != _sizesCache.cend()) {
|
||||
globalAcquiredSize -= int64(i->width()) * i->height() * 4;
|
||||
}
|
||||
QPixmap p(pixNoCache(w, h, ImagePixSmooth | ImagePixRounded, outerw, outerh));
|
||||
auto options = ImagePixSmooth | (radius == ImageRoundRadius::Large ? ImagePixRoundedLarge : ImagePixRoundedSmall);
|
||||
QPixmap p(pixNoCache(w, h, options, outerw, outerh));
|
||||
if (cRetina()) p.setDevicePixelRatio(cRetinaFactor());
|
||||
i = _sizesCache.insert(k, p);
|
||||
if (!p.isNull()) {
|
||||
@ -252,7 +254,7 @@ const QPixmap &Image::pixSingle(int32 w, int32 h, int32 outerw, int32 outerh) co
|
||||
return i.value();
|
||||
}
|
||||
|
||||
const QPixmap &Image::pixBlurredSingle(int w, int h, int32 outerw, int32 outerh) const {
|
||||
const QPixmap &Image::pixBlurredSingle(ImageRoundRadius radius, int w, int h, int32 outerw, int32 outerh) const {
|
||||
checkload();
|
||||
|
||||
if (w <= 0 || !width() || !height()) {
|
||||
@ -267,7 +269,8 @@ const QPixmap &Image::pixBlurredSingle(int w, int h, int32 outerw, int32 outerh)
|
||||
if (i != _sizesCache.cend()) {
|
||||
globalAcquiredSize -= int64(i->width()) * i->height() * 4;
|
||||
}
|
||||
QPixmap p(pixNoCache(w, h, ImagePixSmooth | ImagePixBlurred | ImagePixRounded, outerw, outerh));
|
||||
auto options = ImagePixSmooth | ImagePixBlurred | (radius == ImageRoundRadius::Large ? ImagePixRoundedLarge : ImagePixRoundedSmall);
|
||||
QPixmap p(pixNoCache(w, h, options, outerw, outerh));
|
||||
if (cRetina()) p.setDevicePixelRatio(cRetinaFactor());
|
||||
i = _sizesCache.insert(k, p);
|
||||
if (!p.isNull()) {
|
||||
@ -435,17 +438,20 @@ void imageCircle(QImage &img) {
|
||||
p.drawPixmap(0, 0, mask);
|
||||
}
|
||||
|
||||
void imageRound(QImage &img) {
|
||||
void imageRound(QImage &img, ImageRoundRadius radius) {
|
||||
t_assert(!img.isNull());
|
||||
|
||||
img.setDevicePixelRatio(cRetinaFactor());
|
||||
img = img.convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
||||
t_assert(!img.isNull());
|
||||
|
||||
QImage **masks = App::cornersMask();
|
||||
QImage **masks = App::cornersMask(radius);
|
||||
int32 w = masks[0]->width(), h = masks[0]->height();
|
||||
int32 tw = img.width(), th = img.height();
|
||||
if (tw < 2 * w || th < 2 * h) {
|
||||
if (radius == ImageRoundRadius::Large) {
|
||||
return imageRound(img, ImageRoundRadius::Small);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -530,9 +536,11 @@ QPixmap imagePix(QImage img, int32 w, int32 h, ImagePixOptions options, int32 ou
|
||||
if (options.testFlag(ImagePixCircled)) {
|
||||
imageCircle(img);
|
||||
t_assert(!img.isNull());
|
||||
} else if (options.testFlag(ImagePixRounded)) {
|
||||
imageRound(img);
|
||||
} else if (options.testFlag(ImagePixRoundedLarge)) {
|
||||
imageRound(img, ImageRoundRadius::Large);
|
||||
t_assert(!img.isNull());
|
||||
} else if (options.testFlag(ImagePixRoundedSmall)) {
|
||||
imageRound(img, ImageRoundRadius::Small);
|
||||
}
|
||||
img.setDevicePixelRatio(cRetinaFactor());
|
||||
return QPixmap::fromImage(img, Qt::ColorOnly);
|
||||
@ -571,8 +579,10 @@ QPixmap Image::pixNoCache(int w, int h, ImagePixOptions options, int outerw, int
|
||||
|
||||
if (options.testFlag(ImagePixCircled)) {
|
||||
imageCircle(result);
|
||||
} else if (options.testFlag(ImagePixRounded)) {
|
||||
imageRound(result);
|
||||
} else if (options.testFlag(ImagePixRoundedLarge)) {
|
||||
imageRound(result, ImageRoundRadius::Large);
|
||||
} else if (options.testFlag(ImagePixRoundedSmall)) {
|
||||
imageRound(result, ImageRoundRadius::Small);
|
||||
}
|
||||
return QPixmap::fromImage(result, Qt::ColorOnly);
|
||||
}
|
||||
|
@ -22,8 +22,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
|
||||
#include "mtproto/file_download.h"
|
||||
|
||||
enum class ImageRoundRadius {
|
||||
Large,
|
||||
Small,
|
||||
};
|
||||
|
||||
QImage imageBlur(QImage img);
|
||||
void imageRound(QImage &img);
|
||||
void imageRound(QImage &img, ImageRoundRadius radius);
|
||||
|
||||
inline uint32 packInt(int32 a) {
|
||||
return (a < 0) ? uint32(int64(a) + 0x100000000LL) : uint32(a);
|
||||
@ -110,8 +115,9 @@ inline bool operator!=(const StorageImageLocation &a, const StorageImageLocation
|
||||
enum ImagePixOption {
|
||||
ImagePixSmooth = 0x01,
|
||||
ImagePixBlurred = 0x02,
|
||||
ImagePixRounded = 0x04,
|
||||
ImagePixCircled = 0x08,
|
||||
ImagePixCircled = 0x04,
|
||||
ImagePixRoundedLarge = 0x08,
|
||||
ImagePixRoundedSmall = 0x10,
|
||||
};
|
||||
Q_DECLARE_FLAGS(ImagePixOptions, ImagePixOption);
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(ImagePixOptions);
|
||||
@ -152,13 +158,13 @@ public:
|
||||
}
|
||||
|
||||
const QPixmap &pix(int32 w = 0, int32 h = 0) const;
|
||||
const QPixmap &pixRounded(int32 w = 0, int32 h = 0) const;
|
||||
const QPixmap &pixRounded(ImageRoundRadius radius, int32 w = 0, int32 h = 0) const;
|
||||
const QPixmap &pixCircled(int32 w = 0, int32 h = 0) const;
|
||||
const QPixmap &pixBlurred(int32 w = 0, int32 h = 0) const;
|
||||
const QPixmap &pixColored(const style::color &add, int32 w = 0, int32 h = 0) const;
|
||||
const QPixmap &pixBlurredColored(const style::color &add, int32 w = 0, int32 h = 0) const;
|
||||
const QPixmap &pixSingle(int32 w, int32 h, int32 outerw, int32 outerh) const;
|
||||
const QPixmap &pixBlurredSingle(int32 w, int32 h, int32 outerw, int32 outerh) const;
|
||||
const QPixmap &pixSingle(ImageRoundRadius radius, int32 w, int32 h, int32 outerw, int32 outerh) const;
|
||||
const QPixmap &pixBlurredSingle(ImageRoundRadius radius, int32 w, int32 h, int32 outerw, int32 outerh) const;
|
||||
QPixmap pixNoCache(int w = 0, int h = 0, ImagePixOptions options = 0, int outerw = -1, int outerh = -1) const;
|
||||
QPixmap pixColoredNoCache(const style::color &add, int32 w = 0, int32 h = 0, bool smooth = false) const;
|
||||
QPixmap pixBlurredColoredNoCache(const style::color &add, int32 w, int32 h = 0) const;
|
||||
|
@ -51,7 +51,7 @@ void Widget::paintEvent(QPaintEvent *e) {
|
||||
Painter p(this);
|
||||
|
||||
p.setOpacity(_shownLevel);
|
||||
App::roundRect(p, rect(), st::toastBg);
|
||||
App::roundRect(p, rect(), st::toastBg, ImageRoundRadius::Large);
|
||||
|
||||
p.setPen(st::toastFg);
|
||||
textstyleSet(&st::defaultTextStyle);
|
||||
|
Loading…
Reference in New Issue
Block a user