mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 12:38:48 +03:00
Merge pull request #314 from MayeulC/smoothie-2
Smooth all the things [v2]
This commit is contained in:
commit
9c4148cca3
4 changed files with 9 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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_);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue