Simplify PainterHighQualityEnabler code
There is no need to iterate over a list, flags can be applied and stored simultaneously.
This commit is contained in:
parent
6219604ff8
commit
5f086cd93d
@ -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 New Issue
Block a user