diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index da9550e1e..64ae9ee1a 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -1633,8 +1633,7 @@ namespace App { QImage mask[4]; prepareCorners(MaskCorners, st::msgRadius, st::white, 0, mask); for (int i = 0; i < 4; ++i) { - ::cornersMask[i] = new QImage(mask[i]); - ::cornersMask[i]->convertToFormat(QImage::Format_ARGB32_Premultiplied); + ::cornersMask[i] = new QImage(mask[i].convertToFormat(QImage::Format_ARGB32_Premultiplied)); ::cornersMask[i]->setDevicePixelRatio(cRetinaFactor()); } prepareCorners(BlackCorners, st::msgRadius, st::black); @@ -1645,7 +1644,7 @@ namespace App { prepareCorners(DateSelectedCorners, st::msgRadius, st::msgDateImgSelectBg); prepareCorners(InShadowCorners, st::msgRadius, st::msgInShadow); prepareCorners(InSelectedShadowCorners, st::msgRadius, st::msgInSelectShadow); - prepareCorners(ForwardCorners, st::msgRadius, st::emojiPanHover); + prepareCorners(ForwardCorners, st::msgRadius, st::forwardBg); prepareCorners(MediaviewSaveCorners, st::msgRadius, st::emojiPanHover); prepareCorners(EmojiHoverCorners, st::msgRadius, st::emojiPanHover); prepareCorners(StickerHoverCorners, st::msgRadius, st::emojiPanHover); @@ -2181,31 +2180,31 @@ namespace App { if (App::main()) App::main()->updateScrollColors(); } - style::color msgServiceBg() { + const style::color &msgServiceBg() { return _msgServiceBg; } - style::color msgServiceSelectBg() { + const style::color &msgServiceSelectBg() { return _msgServiceSelectBg; } - style::color historyScrollBarColor() { + const style::color &historyScrollBarColor() { return _historyScrollBarColor; } - style::color historyScrollBgColor() { + const style::color &historyScrollBgColor() { return _historyScrollBgColor; } - style::color historyScrollBarOverColor() { + const style::color &historyScrollBarOverColor() { return _historyScrollBarOverColor; } - style::color historyScrollBgOverColor() { + const style::color &historyScrollBgOverColor() { return _historyScrollBgOverColor; } - style::color introPointHoverColor() { + const style::color &introPointHoverColor() { return _introPointHoverColor; } diff --git a/Telegram/SourceFiles/app.h b/Telegram/SourceFiles/app.h index 5fea933b7..a19cc934e 100644 --- a/Telegram/SourceFiles/app.h +++ b/Telegram/SourceFiles/app.h @@ -239,13 +239,13 @@ namespace App { void initBackground(int32 id = DefaultChatBackground, const QImage &p = QImage(), bool nowrite = false); - style::color msgServiceBg(); - style::color msgServiceSelectBg(); - style::color historyScrollBarColor(); - style::color historyScrollBgColor(); - style::color historyScrollBarOverColor(); - style::color historyScrollBgOverColor(); - style::color introPointHoverColor(); + const style::color &msgServiceBg(); + const style::color &msgServiceSelectBg(); + const style::color &historyScrollBarColor(); + const style::color &historyScrollBgColor(); + const style::color &historyScrollBarOverColor(); + const style::color &historyScrollBgOverColor(); + const style::color &introPointHoverColor(); struct WallPaper { WallPaper(int32 id, ImagePtr thumb, ImagePtr full) : id(id), thumb(thumb), full(full) { diff --git a/Telegram/SourceFiles/gui/images.cpp b/Telegram/SourceFiles/gui/images.cpp index 067e98aad..f8fbfca8a 100644 --- a/Telegram/SourceFiles/gui/images.cpp +++ b/Telegram/SourceFiles/gui/images.cpp @@ -418,7 +418,7 @@ QPixmap Image::pixNoCache(int32 w, int32 h, bool smooth, bool blurred, bool roun if (w < outerw || h < outerh) { p.fillRect(0, 0, result.width(), result.height(), st::black->b); } - p.drawImage((result.width() - img.width()) / 2, (result.height() - img.height()) / 2, img); + p.drawImage((result.width() - img.width()) / (2 * cIntRetinaFactor()), (result.height() - img.height()) / (2 * cIntRetinaFactor()), img); } img = result; } diff --git a/Telegram/SourceFiles/gui/images.h b/Telegram/SourceFiles/gui/images.h index f74e7191f..c0d9ecd88 100644 --- a/Telegram/SourceFiles/gui/images.h +++ b/Telegram/SourceFiles/gui/images.h @@ -20,6 +20,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org #include QImage imageBlur(QImage img); +void imageRound(QImage &img); struct StorageImageLocation { StorageImageLocation() : width(0), height(0), dc(0), volume(0), local(0), secret(0) { diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index baef5c8d6..09bc64b93 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -1808,7 +1808,7 @@ void HistoryPhoto::draw(QPainter &p, const HistoryItem *parent, bool selected, i } } else { QPixmap **cors = App::corners(selected ? InSelectedShadowCorners : InShadowCorners); - int32 cw = cors[0]->width() / cIntRetinaFactor(), ch = cors[0]->height(); + 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); @@ -4302,7 +4302,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(); + 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); @@ -4318,15 +4318,12 @@ void HistoryImageLink::draw(QPainter &p, const HistoryItem *parent, bool selecte QPixmap pix; if (width * h == height * w || (w == convertScale(fullWidth()) && h == convertScale(fullHeight()))) { pix = data->thumb->pixSingle(width, height, width, height); + } else if (width * h > height * w) { + int32 nw = height * w / h; + pix = data->thumb->pixSingle(nw, height, width, height); } else { - p.fillRect(QRect(skipx, skipy, width, height), st::black->b); - if (width * h > height * w) { - int32 nw = height * w / h; - pix = data->thumb->pixSingle(nw, height, width, height); - } else { - int32 nh = width * h / w; - pix = data->thumb->pixSingle(width, nh, width, height); - } + int32 nh = width * h / w; + pix = data->thumb->pixSingle(width, nh, width, height); } p.drawPixmap(QPoint(skipx, skipy), pix); } else { diff --git a/Telegram/SourceFiles/overviewwidget.cpp b/Telegram/SourceFiles/overviewwidget.cpp index 720041606..fede2bf1d 100644 --- a/Telegram/SourceFiles/overviewwidget.cpp +++ b/Telegram/SourceFiles/overviewwidget.cpp @@ -562,6 +562,7 @@ QPixmap OverviewInner::genPix(PhotoData *photo, int32 size) { } else { img = img.copy(0, (img.height() - img.width()) / 2, img.width(), img.width()).scaled(size, size, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); } +// imageRound(img); img.setDevicePixelRatio(cRetinaFactor()); photo->forget(); return QPixmap::fromImage(img, Qt::ColorOnly);