Merge pull request #314 from MayeulC/smoothie-2

Smooth all the things [v2]
This commit is contained in:
DeepBlueV7.X 2020-11-12 14:04:06 +01:00 committed by GitHub
commit 9c4148cca3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 13 deletions

View file

@ -33,7 +33,7 @@ Rectangle {
asynchronous: true
fillMode: Image.PreserveAspectCrop
mipmap: true
smooth: false
smooth: true
sourceSize.width: avatar.width
sourceSize.height: avatar.height
layer.enabled: true

View file

@ -29,6 +29,8 @@ Item {
source: model.data.url.replace("mxc://", "image://MxcImage/")
asynchronous: true
fillMode: Image.PreserveAspectFit
smooth: true
mipmap: true
MouseArea {
id: mouseArea

View file

@ -121,7 +121,9 @@ Avatar::paintEvent(QPaintEvent *)
bool rounded = QSettings().value("user/avatar_circles", true).toBool();
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform |
QPainter::TextAntialiasing);
QRectF r = rect();
const int hs = size_ / 2;

View file

@ -139,17 +139,9 @@ public:
PainterHighQualityEnabler(Painter &p)
: _painter(p)
{
static constexpr QPainter::RenderHint Hints[] = {QPainter::Antialiasing,
QPainter::SmoothPixmapTransform,
QPainter::TextAntialiasing};
hints_ = QPainter::Antialiasing | QPainter::SmoothPixmapTransform |
QPainter::TextAntialiasing;
auto hints = _painter.renderHints();
for (const auto &hint : Hints) {
if (!(hints & hint))
hints_ |= hint;
}
if (hints_)
_painter.setRenderHints(hints_);
}