From 411678df3e25304b105e5f3afc849b529baa0d6f Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 27 May 2009 10:46:40 +1000 Subject: Don't really need QPainter::save/restore for render hint mods. --- src/declarative/fx/qfximage.cpp | 10 ++++------ src/declarative/fx/qfxrect.cpp | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index 6226e45..55aecd7 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -322,10 +322,9 @@ void QFxImage::paintContents(QPainter &p) if (d->_pix.isNull()) return; - if (d->_smooth) { - p.save(); + QPainter::RenderHints oldHints = p.renderHints(); + if (d->_smooth) p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->_smooth); - } QSimpleCanvasConfig::Image pix = d->_pix; @@ -415,9 +414,8 @@ void QFxImage::paintContents(QPainter &p) QRect(pix.width()-sgr, pix.height() - sgb, sgr, sgb)); } - if (d->_smooth) { - p.restore(); - } + if (d->_smooth) + p.setRenderHints(oldHints); } #elif defined(QFX_RENDER_OPENGL) uint QFxImage::glSimpleItemData(float *vertices, float *texVertices, diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index 90170da..cc5afc3 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -505,7 +505,7 @@ void QFxRect::drawRect(QPainter &p) if (d->_gradcolor.isValid() /*|| p.usingQt() */) { // XXX This path is still slower than the image path // Image path won't work for gradients though - p.save(); + QPainter::RenderHints oldHints = p.renderHints(); p.setRenderHint(QPainter::Antialiasing); if (d->_pen && d->_pen->isValid()) { QPen pn(QColor(pen()->color()), pen()->width()); @@ -525,7 +525,7 @@ void QFxRect::drawRect(QPainter &p) p.drawRoundedRect(0, 0, width(), height(), d->_radius, d->_radius); else p.drawRect(0, 0, width(), height()); - p.restore(); + p.setRenderHints(oldHints); } else { int offset = 0; const int pw = d->_pen && d->_pen->isValid() ? (d->_pen->width()+1)/2*2 : 0; -- cgit v0.12