diff --git a/Telegram/Resources/style.txt b/Telegram/Resources/style.txt index 4372ddb36..ea06887ee 100644 --- a/Telegram/Resources/style.txt +++ b/Telegram/Resources/style.txt @@ -54,7 +54,7 @@ wndBG: #FFF; wndShadow: sprite(209px, 46px, 19px, 19px); wndShadowShift: 1px; -layerAlpha: 0.3; +layerAlpha: 0.5; layerBG: #000; titleBG: #6389a8; @@ -390,7 +390,8 @@ btnIntroNext: flatButton(btnDefNext, btnDefBig) { width: 300px; } -boxShadow: sprite(230px, 46px, 9px, 9px); +boxShadow: sprite(363px, 50px, 15px, 15px); +boxShadowShift: 2px; introCountry: countryInput { width: 300px; @@ -776,7 +777,7 @@ activeFadeOutDuration: 3000; msgRadius: 3px; -msgMaxWidth: 550px; +msgMaxWidth: 430px; msgFont: font(fsize); msgNameFont: font(fsize semibold); msgServiceFont: font(fsize semibold); @@ -1375,6 +1376,7 @@ dropdownDef: dropdown { padding: margins(10px, 10px, 10px, 10px); shadow: sprite(241px, 46px, 6px, 6px); + shadowShift: 1px; duration: 150; width: 0px; @@ -1796,7 +1798,7 @@ radialBgOpacity: 0.4; radialDownload: sprite(346px, 0px, 50px, 50px); radialDownloadOpacity: 0.8; radialCancel: sprite(378px, 50px, 18px, 18px); -radialCancelOpacity: 0.7; +radialCancelOpacity: 1.0; overviewLoader: size(34px, 14px); overviewLoaderPoint: size(4px, 4px); diff --git a/Telegram/Resources/style_classes.txt b/Telegram/Resources/style_classes.txt index 07a7c5bad..69dc94fe9 100644 --- a/Telegram/Resources/style_classes.txt +++ b/Telegram/Resources/style_classes.txt @@ -254,6 +254,7 @@ dropdown { padding: margins; shadow: sprite; + shadowShift: number; duration: number; width: number; diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 737b74b3f..aaae221af 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -2016,6 +2016,16 @@ namespace App { p.drawPixmap(QPoint(x + w - cw, y + h - ch), *c[3]); } + void roundShadow(QPainter &p, int32 x, int32 y, int32 w, int32 h, const style::color &sh, RoundCorners index) { + QPixmap **c = App::corners(index); + int32 cw = c[0]->width() / cIntRetinaFactor(), ch = c[0]->height() / cIntRetinaFactor(); + p.fillRect(x + cw, y + h, w - 2 * cw, st::msgShadow, sh->b); + p.fillRect(x, y + h - ch, cw, st::msgShadow, sh->b); + p.fillRect(x + w - cw, y + h - ch, cw, st::msgShadow, sh->b); + p.drawPixmap(x, y + h - ch + st::msgShadow, *c[2]); + p.drawPixmap(x + w - cw, y + h - ch + st::msgShadow, *c[3]); + } + void initBackground(int32 id, const QImage &p, bool nowrite) { if (Local::readBackground()) return; diff --git a/Telegram/SourceFiles/app.h b/Telegram/SourceFiles/app.h index a19cc934e..42266c86d 100644 --- a/Telegram/SourceFiles/app.h +++ b/Telegram/SourceFiles/app.h @@ -236,6 +236,10 @@ namespace App { inline void roundRect(QPainter &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); } + void roundShadow(QPainter &p, int32 x, int32 y, int32 w, int32 h, const style::color &sh, RoundCorners index); + inline void roundShadow(QPainter &p, const QRect &rect, const style::color &sh, RoundCorners index) { + return roundShadow(p, rect.x(), rect.y(), rect.width(), rect.height(), sh, index); + } void initBackground(int32 id = DefaultChatBackground, const QImage &p = QImage(), bool nowrite = false); diff --git a/Telegram/SourceFiles/art/sprite.png b/Telegram/SourceFiles/art/sprite.png index 1b89b1136..667b373b9 100644 Binary files a/Telegram/SourceFiles/art/sprite.png and b/Telegram/SourceFiles/art/sprite.png differ diff --git a/Telegram/SourceFiles/art/sprite_200x.png b/Telegram/SourceFiles/art/sprite_200x.png index 63d898be0..16b28c7ff 100644 Binary files a/Telegram/SourceFiles/art/sprite_200x.png and b/Telegram/SourceFiles/art/sprite_200x.png differ diff --git a/Telegram/SourceFiles/dropdown.cpp b/Telegram/SourceFiles/dropdown.cpp index ec400795b..f6816675b 100644 --- a/Telegram/SourceFiles/dropdown.cpp +++ b/Telegram/SourceFiles/dropdown.cpp @@ -120,7 +120,7 @@ void Dropdown::paintEvent(QPaintEvent *e) { // draw shadow QRect r(_st.padding.left(), _st.padding.top(), _width - _st.padding.left() - _st.padding.right(), _height - _st.padding.top() - _st.padding.bottom()); - _shadow.paint(p, r); + _shadow.paint(p, r, _st.shadowShift); if (!_buttons.isEmpty() && _st.border > 0) { // paint separators p.setPen(_st.borderColor->p); @@ -308,7 +308,7 @@ bool Dropdown::eventFilter(QObject *obj, QEvent *e) { } DragArea::DragArea(QWidget *parent) : TWidget(parent), - _hiding(false), _in(false), a_opacity(0), a_color(st::dragColor->c), _shadow(st::boxShadow) { +_hiding(false), _in(false), a_opacity(0), a_color(st::dragColor->c), _shadow(st::boxShadow) { setMouseTracking(true); setAcceptDrops(true); } @@ -354,7 +354,7 @@ void DragArea::paintEvent(QPaintEvent *e) { QRect r(st::dragPadding.left(), st::dragPadding.top(), width() - st::dragPadding.left() - st::dragPadding.right(), height() - st::dragPadding.top() - st::dragPadding.bottom()); // draw shadow - _shadow.paint(p, r); + _shadow.paint(p, r, st::boxShadowShift); p.fillRect(r, st::white->b); @@ -487,7 +487,7 @@ void EmojiColorPicker::paintEvent(QPaintEvent *e) { int32 w = st::dropdownDef.shadow.pxWidth(), h = st::dropdownDef.shadow.pxHeight(); QRect r = QRect(w, h, width() - 2 * w, height() - 2 * h); - _shadow.paint(p, r); + _shadow.paint(p, r, st::dropdownDef.shadowShift); if (_cache.isNull()) { p.fillRect(r, st::white->b); @@ -1697,7 +1697,7 @@ void EmojiPan::paintEvent(QPaintEvent *e) { QRect r(st::dropdownDef.padding.left(), st::dropdownDef.padding.top(), _width - st::dropdownDef.padding.left() - st::dropdownDef.padding.right(), _height - st::dropdownDef.padding.top() - st::dropdownDef.padding.bottom()); - _shadow.paint(p, r); + _shadow.paint(p, r, st::dropdownDef.shadowShift); if (_toCache.isNull()) { if (_cache.isNull()) { diff --git a/Telegram/SourceFiles/gui/boxshadow.cpp b/Telegram/SourceFiles/gui/boxshadow.cpp index 2b921e1e6..f6e0356bb 100644 --- a/Telegram/SourceFiles/gui/boxshadow.cpp +++ b/Telegram/SourceFiles/gui/boxshadow.cpp @@ -19,13 +19,14 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org #include "boxshadow.h" -BoxShadow::BoxShadow(const style::rect &topLeft) : _size(topLeft.width() / cIntRetinaFactor()) { +BoxShadow::BoxShadow(const style::sprite &topLeft) : _size(topLeft.pxWidth()), _pixsize(_size * cIntRetinaFactor()) { if (!_size) return; - QImage cornersImage(_size * 2, _size * 2, QImage::Format_ARGB32_Premultiplied); + QImage cornersImage(_pixsize * 2, _pixsize * 2, QImage::Format_ARGB32_Premultiplied); + cornersImage.setDevicePixelRatio(cRetinaFactor()); { QPainter p(&cornersImage); - p.drawPixmap(QPoint(rtl() ? _size : 0, 0), App::sprite(), topLeft); + p.drawPixmap(QPoint(rtl() ? _pixsize : 0, 0), App::sprite(), topLeft); } if (rtl()) cornersImage = cornersImage.mirrored(true, false); uchar *bits = cornersImage.bits(); @@ -41,39 +42,61 @@ BoxShadow::BoxShadow(const style::rect &topLeft) : _size(topLeft.width() / cIntR { QPainter p(&cornersImage); p.setCompositionMode(QPainter::CompositionMode_Source); - p.drawImage(0, _size, cornersImage.mirrored(), 0, _size, _size, _size); + p.drawImage(0, _pixsize, cornersImage.mirrored(), 0, _pixsize, _pixsize, _pixsize); } { QPainter p(&cornersImage); p.setCompositionMode(QPainter::CompositionMode_Source); - p.drawImage(_size, 0, cornersImage.mirrored(true, false), _size, 0, _size, _size * 2); + p.drawImage(_pixsize, 0, cornersImage.mirrored(true, false), _pixsize, 0, _pixsize, _pixsize * 2); } _corners = QPixmap::fromImage(cornersImage, Qt::ColorOnly); - _colors.reserve(_size); + _corners.setDevicePixelRatio(cRetinaFactor()); + _colors.reserve(_pixsize); uchar prev = 0; - for (int32 i = 0; i < _size; ++i) { - uchar a = (cornersImage.pixel(QPoint(i, _size - 1)) >> 24); + for (int32 i = 0; i < _pixsize; ++i) { + uchar a = (cornersImage.pixel(QPoint(i, _pixsize - 1)) >> 24); if (a < prev) break; _colors.push_back(style::color(0, 0, 0, a)); prev = a; } -} - -void BoxShadow::paint(QPainter &p, const QRect &box, const QPoint &shift, int32 flags) { - if (!_size) return; - - int32 count = _colors.size(), minus = _size - count + 1; - bool left = (flags & Left), top = (flags & Top), right = (flags & Right), bottom = (flags & Bottom); - if (left && top) p.drawPixmap(box.left() - _size + minus + shift.x(), box.top() - _size + minus + shift.y(), _corners, 0, 0, _size, _size); - if (right && top) p.drawPixmap(box.right() - minus + 1 + shift.x(), box.top() - _size + minus + shift.y(), _corners, _size, 0, _size, _size); - if (right && bottom) p.drawPixmap(box.right() - minus + 1 + shift.x(), box.bottom() - minus + 1 + shift.y(), _corners, _size, _size, _size, _size); - if (left && bottom) p.drawPixmap(box.left() - _size + minus + shift.x(), box.bottom() - minus + 1 + shift.y(), _corners, 0, _size, _size, _size); - for (int32 i = 1; i <= count; ++i) { - p.setPen(_colors[i - 1]->p); - if (top) p.fillRect(box.left() + (left ? minus : 0) + shift.x(), box.top() - count + i + shift.y(), box.width() - (right ? minus : 0) - (left ? minus : 0), cIntRetinaFactor(), _colors[i - 1]->b); - if (right) p.fillRect(box.right() + count - i + shift.x(), box.top() + (top ? minus : 0) + shift.y(), cIntRetinaFactor(), box.height() - (bottom ? minus : 0) - (top ? minus : 0), _colors[i - 1]->b); - if (bottom) p.fillRect(box.left() + (left ? minus : 0) + shift.x(), box.bottom() + count - i + shift.y(), box.width() - (right ? minus : 0) - (left ? minus : 0), cIntRetinaFactor(), _colors[i - 1]->b); - if (left) p.fillRect(box.left() - count + i + shift.x(), box.top() + (top ? minus : 0) + shift.y(), cIntRetinaFactor(), box.height() - (bottom ? minus : 0) - (top ? minus : 0), _colors[i - 1]->b); + if (cRetina()) { + _left = QPixmap::fromImage(cornersImage.copy(0, _pixsize - 1, _colors.size(), 1), Qt::ColorOnly); + _left.setDevicePixelRatio(cRetinaFactor()); + _top = QPixmap::fromImage(cornersImage.copy(_pixsize - 1, 0, 1, _colors.size()), Qt::ColorOnly); + _top.setDevicePixelRatio(cRetinaFactor()); + _right = QPixmap::fromImage(cornersImage.copy(_pixsize * 2 - _colors.size(), _pixsize, _colors.size(), 1), Qt::ColorOnly); + _right.setDevicePixelRatio(cRetinaFactor()); + _bottom = QPixmap::fromImage(cornersImage.copy(_pixsize, _pixsize * 2 - _colors.size(), 1, _colors.size()), Qt::ColorOnly); + _bottom.setDevicePixelRatio(cRetinaFactor()); + } +} + +void BoxShadow::paint(QPainter &p, const QRect &box, int32 shifty, int32 flags) { + if (!_size) return; + + int32 add = shifty; + int32 count = _colors.size(), minus = _size - count + add; + bool left = (flags & Left), top = (flags & Top), right = (flags & Right), bottom = (flags & Bottom); + if (left && top) p.drawPixmap(box.left() - _size + minus, box.top() - _size + minus + shifty, _corners, 0, 0, _size, _size); + if (right && top) p.drawPixmap(box.left() + box.width() - minus, box.top() - _size + minus + shifty, _corners, _size, 0, _size, _size); + if (right && bottom) p.drawPixmap(box.left() + box.width() - minus, box.top() + box.height() - minus + shifty, _corners, _size, _size, _size, _size); + if (left && bottom) p.drawPixmap(box.left() - _size + minus, box.top() + box.height() - minus + shifty, _corners, 0, _size, _size, _size); + if (cRetina()) { + bool wasSmooth = p.renderHints().testFlag(QPainter::SmoothPixmapTransform); + if (wasSmooth) p.setRenderHint(QPainter::SmoothPixmapTransform, false); + if (left) p.drawPixmap(box.left() - count + add, box.top() + (top ? minus : 0) + shifty, count - add, box.height() - (bottom ? minus : 0) - (top ? minus : 0), _left, 0, 0, count - add, 1); + if (top) p.drawPixmap(box.left() + (left ? minus : 0), box.top() - count + add + shifty, box.width() - (right ? minus : 0) - (left ? minus : 0), count - add - shifty, _top, 0, 0, 1, count - add - shifty); + if (right) p.drawPixmap(box.left() + box.width(), box.top() + (top ? minus : 0) + shifty, count - add, box.height() - (bottom ? minus : 0) - (top ? minus : 0), _right, add, 0, count - add, 1); + if (bottom) p.drawPixmap(box.left() + (left ? minus : 0), box.top() + box.height(), box.width() - (right ? minus : 0) - (left ? minus : 0), count, _bottom, 0, 0, 1, count); + if (wasSmooth) p.setRenderHint(QPainter::SmoothPixmapTransform); + } else { + p.setPen(Qt::NoPen); + for (int32 i = 0; i < count; ++i) { + if (left && i + add < count) p.fillRect(box.left() - count + i + add, box.top() + (top ? minus : 0) + shifty, 1, box.height() - (bottom ? minus : 0) - (top ? minus : 0), _colors[i]->b); + if (top && i + add + shifty < count) p.fillRect(box.left() + (left ? minus : 0), box.top() - count + i + add + shifty, box.width() - (right ? minus : 0) - (left ? minus : 0), 1, _colors[i]->b); + if (right && i + add < count) p.fillRect(box.left() + box.width() + count - i - add - 1, box.top() + (top ? minus : 0) + shifty, 1, box.height() - (bottom ? minus : 0) - (top ? minus : 0), _colors[i]->b); + if (bottom && i + add - shifty < count) p.fillRect(box.left() + (left ? minus : 0), box.top() + box.height() + count - i - add + shifty - 1, box.width() - (right ? minus : 0) - (left ? minus : 0), 1, _colors[i]->b); + } } } diff --git a/Telegram/SourceFiles/gui/boxshadow.h b/Telegram/SourceFiles/gui/boxshadow.h index 29235a26a..8d82c720a 100644 --- a/Telegram/SourceFiles/gui/boxshadow.h +++ b/Telegram/SourceFiles/gui/boxshadow.h @@ -27,14 +27,14 @@ public: Bottom = 8 }; - BoxShadow(const style::rect &topLeft); + BoxShadow(const style::sprite &topLeft); - void paint(QPainter &p, const QRect &box, const QPoint &shift = QPoint(0, 1), int32 flags = Left | Top | Right | Bottom); + void paint(QPainter &p, const QRect &box, int32 shifty, int32 flags = Left | Top | Right | Bottom); private: - int32 _size; - QPixmap _corners; + int32 _size, _pixsize; + QPixmap _corners, _left, _top, _right, _bottom; QVector _colors; }; diff --git a/Telegram/SourceFiles/gui/contextmenu.cpp b/Telegram/SourceFiles/gui/contextmenu.cpp index 8d2f9e66f..964c4b1b4 100644 --- a/Telegram/SourceFiles/gui/contextmenu.cpp +++ b/Telegram/SourceFiles/gui/contextmenu.cpp @@ -144,7 +144,7 @@ void ContextMenu::paintEvent(QPaintEvent *e) { QRect r(_st.padding.left(), _st.padding.top(), _width - _st.padding.left() - _st.padding.right(), _height - _st.padding.top() - _st.padding.bottom()); // draw shadow - _shadow.paint(p, r); + _shadow.paint(p, r, _st.shadowShift); } void ContextMenu::keyPressEvent(QKeyEvent *e) { diff --git a/Telegram/SourceFiles/gui/countryinput.cpp b/Telegram/SourceFiles/gui/countryinput.cpp index e5c3da0f6..d0d2fa7f7 100644 --- a/Telegram/SourceFiles/gui/countryinput.cpp +++ b/Telegram/SourceFiles/gui/countryinput.cpp @@ -485,7 +485,7 @@ void CountrySelect::paintEvent(QPaintEvent *e) { p.setOpacity(1); QRect inner(_innerLeft, _innerTop, _innerWidth, _innerHeight); - _shadow.paint(p, inner); + _shadow.paint(p, inner, st::boxShadowShift); if (trivial || e->rect().intersects(inner)) { // fill bg p.fillRect(inner, st::white->b); diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index b27f2ab1c..9474c27ac 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -1807,14 +1807,7 @@ void HistoryPhoto::draw(QPainter &p, const HistoryItem *parent, bool selected, i height -= st::webPagePhotoSkip + _caption.countHeight(width); } } else { - QPixmap **cors = App::corners(selected ? InSelectedShadowCorners : InShadowCorners); - int32 cw = cors[0]->width() / cIntRetinaFactor(), ch = cors[0]->height() / cIntRetinaFactor(); - style::color shadow(selected ? st::msgInSelectShadow : st::msgInShadow); - p.fillRect(cw, _height, width - 2 * cw, st::msgShadow, shadow->b); - p.fillRect(0, _height - ch, cw, st::msgShadow, shadow->b); - p.fillRect(width - cw, _height - ch, cw, st::msgShadow, shadow->b); - p.drawPixmap(0, _height - ch + st::msgShadow, *cors[2]); - p.drawPixmap(width - cw, _height - ch + st::msgShadow, *cors[3]); + App::roundShadow(p, 0, 0, width, _height, selected ? st::msgInSelectShadow : st::msgInShadow, selected ? InSelectedShadowCorners : InShadowCorners); } data->full->load(false, false); bool full = data->full->loaded(); @@ -2657,14 +2650,7 @@ void HistoryDocument::draw(QPainter &p, const HistoryItem *parent, bool selected if (ph < 1) ph = 1; } - QPixmap **cors = App::corners(selected ? InSelectedShadowCorners : InShadowCorners); - int32 cw = cors[0]->width() / cIntRetinaFactor(), ch = cors[0]->height() / cIntRetinaFactor(); - style::color shadow(selected ? st::msgInSelectShadow : st::msgInShadow); - p.fillRect(cw, ph, pw - 2 * cw, st::msgShadow, shadow->b); - p.fillRect(0, ph - ch, cw, st::msgShadow, shadow->b); - p.fillRect(pw - cw, ph - ch, cw, st::msgShadow, shadow->b); - p.drawPixmap(0, ph - ch + st::msgShadow, *cors[2]); - p.drawPixmap(pw - cw, ph - ch + st::msgShadow, *cors[3]); + App::roundShadow(p, 0, 0, pw, ph, selected ? st::msgInSelectShadow : st::msgInShadow, selected ? InSelectedShadowCorners : InShadowCorners); p.drawPixmap(0, 0, animated.current(pw, ph, true)); if (selected) { @@ -4305,14 +4291,7 @@ void HistoryImageLink::draw(QPainter &p, const HistoryItem *parent, bool selecte } height -= skipy + st::mediaPadding.bottom(); } else { - QPixmap **cors = App::corners(selected ? InSelectedShadowCorners : InShadowCorners); - int32 cw = cors[0]->width() / cIntRetinaFactor(), ch = cors[0]->height() / cIntRetinaFactor(); - style::color shadow(selected ? st::msgInSelectShadow : st::msgInShadow); - p.fillRect(cw, _height, width - 2 * cw, st::msgShadow, shadow->b); - p.fillRect(0, _height - ch, cw, st::msgShadow, shadow->b); - p.fillRect(width - cw, _height - ch, cw, st::msgShadow, shadow->b); - p.drawPixmap(0, _height - ch + st::msgShadow, *cors[2]); - p.drawPixmap(width - cw, _height - ch + st::msgShadow, *cors[3]); + App::roundShadow(p, 0, 0, width, _height, selected ? st::msgInSelectShadow : st::msgInShadow, selected ? InSelectedShadowCorners : InShadowCorners); } data->load(); diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index f708d1951..09cac08d6 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -34,7 +34,6 @@ extern TextParseOptions _textNameOptions, _textDlgOptions; #include "structs.h" - struct History; struct Histories : public QHash, public Animated { typedef QHash Parent; diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 6faef6e6c..8c54d3890 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -1316,35 +1316,35 @@ void MessageField::focusInEvent(QFocusEvent *e) { } HistoryHider::HistoryHider(MainWidget *parent, bool forwardSelected) : QWidget(parent) - , _sharedContact(0) - , _forwardSelected(forwardSelected) - , _sendPath(false) - , forwardButton(this, lang(lng_forward), st::btnSelectDone) - , cancelButton(this, lang(lng_cancel), st::btnSelectCancel) - , offered(0) - , aOpacity(0, 1) - , aOpacityFunc(anim::easeOutCirc) - , hiding(false) - , _forwardRequest(0) - , toTextWidth(0) - , shadow(st::boxShadow) +, _sharedContact(0) +, _forwardSelected(forwardSelected) +, _sendPath(false) +, forwardButton(this, lang(lng_forward), st::btnSelectDone) +, cancelButton(this, lang(lng_cancel), st::btnSelectCancel) +, offered(0) +, aOpacity(0, 1) +, aOpacityFunc(anim::easeOutCirc) +, hiding(false) +, _forwardRequest(0) +, toTextWidth(0) +, shadow(st::boxShadow) { init(); } HistoryHider::HistoryHider(MainWidget *parent, UserData *sharedContact) : QWidget(parent) - , _sharedContact(sharedContact) - , _forwardSelected(false) - , _sendPath(false) - , forwardButton(this, lang(lng_forward_send), st::btnSelectDone) - , cancelButton(this, lang(lng_cancel), st::btnSelectCancel) - , offered(0) - , aOpacity(0, 1) - , aOpacityFunc(anim::easeOutCirc) - , hiding(false) - , _forwardRequest(0) - , toTextWidth(0) - , shadow(st::boxShadow) +, _sharedContact(sharedContact) +, _forwardSelected(false) +, _sendPath(false) +, forwardButton(this, lang(lng_forward_send), st::btnSelectDone) +, cancelButton(this, lang(lng_cancel), st::btnSelectCancel) +, offered(0) +, aOpacity(0, 1) +, aOpacityFunc(anim::easeOutCirc) +, hiding(false) +, _forwardRequest(0) +, toTextWidth(0) +, shadow(st::boxShadow) { init(); } @@ -1410,7 +1410,7 @@ void HistoryHider::paintEvent(QPaintEvent *e) { if (cacheForAnim.isNull() || !offered) { p.setFont(st::forwardFont->f); if (offered) { - shadow.paint(p, box); + shadow.paint(p, box, st::boxShadowShift); // fill bg p.fillRect(box, st::boxBG->b); diff --git a/Telegram/SourceFiles/layerwidget.cpp b/Telegram/SourceFiles/layerwidget.cpp index 8c44b2d87..1e0b92f88 100644 --- a/Telegram/SourceFiles/layerwidget.cpp +++ b/Telegram/SourceFiles/layerwidget.cpp @@ -25,7 +25,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org #include "gui/filedialog.h" BackgroundWidget::BackgroundWidget(QWidget *parent, LayeredWidget *w) : QWidget(parent), w(w), _hidden(0), - aBackground(0), aBackgroundFunc(anim::easeOutCirc), hiding(false), shadow(st::boxShadow) { +aBackground(0), aBackgroundFunc(anim::easeOutCirc), hiding(false), shadow(st::boxShadow) { w->setParent(this); setGeometry(0, 0, App::wnd()->width(), App::wnd()->height()); aBackground.start(1); @@ -54,7 +54,7 @@ void BackgroundWidget::paintEvent(QPaintEvent *e) { p.fillRect(rect(), st::layerBG->b); p.setOpacity(aBackground.current()); - shadow.paint(p, w->boxRect()); + shadow.paint(p, w->boxRect(), st::boxShadowShift); } void BackgroundWidget::keyPressEvent(QKeyEvent *e) { diff --git a/Telegram/SourceFiles/window.cpp b/Telegram/SourceFiles/window.cpp index 0b506c4ca..8309bc7a6 100644 --- a/Telegram/SourceFiles/window.cpp +++ b/Telegram/SourceFiles/window.cpp @@ -57,7 +57,7 @@ void ConnectingWidget::set(const QString &text, const QString &reconnect) { void ConnectingWidget::paintEvent(QPaintEvent *e) { QPainter p(this); - _shadow.paint(p, QRect(0, st::boxShadow.pxHeight(), width() - st::boxShadow.pxWidth(), height() - st::boxShadow.pxHeight()), QPoint(0, 0), BoxShadow::Top | BoxShadow::Right); + _shadow.paint(p, QRect(0, st::boxShadow.pxHeight(), width() - st::boxShadow.pxWidth(), height() - st::boxShadow.pxHeight()), 0, BoxShadow::Top | BoxShadow::Right); p.fillRect(0, st::boxShadow.pxHeight(), width() - st::boxShadow.pxWidth(), height() - st::boxShadow.pxHeight(), st::connectingBG->b); p.setFont(st::linkFont->f); p.setPen(st::connectingColor->p);