mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-29 06:08: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
|
asynchronous: true
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
mipmap: true
|
mipmap: true
|
||||||
smooth: false
|
smooth: true
|
||||||
sourceSize.width: avatar.width
|
sourceSize.width: avatar.width
|
||||||
sourceSize.height: avatar.height
|
sourceSize.height: avatar.height
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
|
|
|
@ -29,6 +29,8 @@ Item {
|
||||||
source: model.data.url.replace("mxc://", "image://MxcImage/")
|
source: model.data.url.replace("mxc://", "image://MxcImage/")
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
|
smooth: true
|
||||||
|
mipmap: true
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
|
|
|
@ -121,7 +121,9 @@ Avatar::paintEvent(QPaintEvent *)
|
||||||
bool rounded = QSettings().value("user/avatar_circles", true).toBool();
|
bool rounded = QSettings().value("user/avatar_circles", true).toBool();
|
||||||
|
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
painter.setRenderHint(QPainter::Antialiasing);
|
|
||||||
|
painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform |
|
||||||
|
QPainter::TextAntialiasing);
|
||||||
|
|
||||||
QRectF r = rect();
|
QRectF r = rect();
|
||||||
const int hs = size_ / 2;
|
const int hs = size_ / 2;
|
||||||
|
|
|
@ -139,18 +139,10 @@ public:
|
||||||
PainterHighQualityEnabler(Painter &p)
|
PainterHighQualityEnabler(Painter &p)
|
||||||
: _painter(p)
|
: _painter(p)
|
||||||
{
|
{
|
||||||
static constexpr QPainter::RenderHint Hints[] = {QPainter::Antialiasing,
|
hints_ = QPainter::Antialiasing | QPainter::SmoothPixmapTransform |
|
||||||
QPainter::SmoothPixmapTransform,
|
QPainter::TextAntialiasing;
|
||||||
QPainter::TextAntialiasing};
|
|
||||||
|
|
||||||
auto hints = _painter.renderHints();
|
_painter.setRenderHints(hints_);
|
||||||
for (const auto &hint : Hints) {
|
|
||||||
if (!(hints & hint))
|
|
||||||
hints_ |= hint;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hints_)
|
|
||||||
_painter.setRenderHints(hints_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~PainterHighQualityEnabler()
|
~PainterHighQualityEnabler()
|
||||||
|
|
Loading…
Reference in a new issue