Simplify PainterHighQualityEnabler code

There is no need to iterate over a list, flags can be applied and stored
simultaneously.
This commit is contained in:
Mayeul Cantan 2020-11-01 02:47:47 +01:00
parent 6219604ff8
commit 5f086cd93d
1 changed files with 3 additions and 11 deletions

View File

@ -139,17 +139,9 @@ 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();
for (const auto &hint : Hints) {
if (!(hints & hint))
hints_ |= hint;
}
if (hints_)
_painter.setRenderHints(hints_); _painter.setRenderHints(hints_);
} }