From a013029c5c44bd44265e0c2436b3cc7dc9cc3e0b Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 13 Aug 2016 01:42:16 +0000 Subject: [PATCH] do not force rendering hints Signed-off-by: Ivailo Monev --- .../graphicsitems/qdeclarativeborderimage.cpp | 8 ---- .../graphicsitems/qdeclarativeimage.cpp | 8 ---- src/declarative/graphicsitems/qdeclarativeitem.cpp | 3 +- .../graphicsitems/qdeclarativepainteditem.cpp | 32 +------------- .../graphicsitems/qdeclarativepainteditem_p.h | 4 -- .../graphicsitems/qdeclarativepainteditem_p_p.h | 3 +- .../graphicsitems/qdeclarativerectangle.cpp | 20 --------- src/declarative/graphicsitems/qdeclarativetext.cpp | 10 ----- src/gui/graphicsview/qgraphicsitem.cpp | 49 +--------------------- src/gui/graphicsview/qgraphicsitem.h | 3 -- src/gui/image/qimage.cpp | 3 -- src/gui/image/qpixmapfilter.cpp | 1 - src/gui/kernel/qwidget.cpp | 6 --- src/gui/painting/qdrawutil.cpp | 10 ----- src/gui/painting/qpainter.cpp | 5 --- src/gui/styles/qcleanlooksstyle.cpp | 5 --- src/gui/styles/qcommonstyle.cpp | 7 ---- src/gui/styles/qmacstyle_mac.mm | 8 ---- src/gui/styles/qplastiquestyle.cpp | 7 ---- src/gui/styles/qstylehelper.cpp | 3 -- src/gui/styles/qstylesheetstyle.cpp | 3 -- src/gui/styles/qwindowscestyle.cpp | 1 - src/gui/text/qfontengine.cpp | 1 - src/gui/text/qtextdocumentlayout.cpp | 7 ---- src/gui/text/qtextlayout.cpp | 1 - src/gui/widgets/qlcdnumber.cpp | 1 - src/opengl/qglpixmapfilter.cpp | 2 - src/svg/qsvgtinydocument.cpp | 3 -- src/tools/designer/qdesigner_actions.cpp | 1 - 29 files changed, 6 insertions(+), 209 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 53b8cba2b..810c613d8 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -580,11 +580,7 @@ void QDeclarativeBorderImage::paint(QPainter *p, const QStyleOptionGraphicsItem if (d->pix.isNull() || d->width() <= 0.0 || d->height() <= 0.0) return; - bool oldAA = p->testRenderHint(QPainter::Antialiasing); - bool oldSmooth = p->testRenderHint(QPainter::SmoothPixmapTransform); QTransform oldTransform; - if (d->smooth) - p->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth); if (d->mirror) { oldTransform = p->transform(); QTransform mirror; @@ -612,10 +608,6 @@ void QDeclarativeBorderImage::paint(QPainter *p, const QStyleOptionGraphicsItem QMargins margins(left, top, right, bottom); QTileRules rules((Qt::TileRule)d->horizontalTileMode, (Qt::TileRule)d->verticalTileMode); qDrawBorderPixmap(p, QRect(0, 0, (int)d->width(), (int)d->height()), margins, d->pix, d->pix.rect(), margins, rules); - if (d->smooth) { - p->setRenderHint(QPainter::Antialiasing, oldAA); - p->setRenderHint(QPainter::SmoothPixmapTransform, oldSmooth); - } if (d->mirror) p->setWorldTransform(oldTransform); } diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 952371533..50cf9c4b0 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -539,10 +539,6 @@ void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWi } QTransform oldTransform; - bool oldAA = p->testRenderHint(QPainter::Antialiasing); - bool oldSmooth = p->testRenderHint(QPainter::SmoothPixmapTransform); - if (d->smooth) - p->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth); if (doClip) { p->save(); p->setClipRect(QRectF(0, 0, d->mWidth, d->mHeight), Qt::IntersectClip); @@ -559,10 +555,6 @@ void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWi else p->drawPixmap(QRectF(0, 0, drawWidth, drawHeight), d->pix, QRectF(0, 0, drawWidth, drawHeight)); - if (d->smooth) { - p->setRenderHint(QPainter::Antialiasing, oldAA); - p->setRenderHint(QPainter::SmoothPixmapTransform, oldSmooth); - } if (doClip) p->restore(); if (!transform.isIdentity()) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 94d854936..e65d9b475 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -3199,7 +3199,8 @@ void QDeclarativeItem::setSmooth(bool smooth) Q_D(QDeclarativeItem); if (d->smooth == smooth) return; - d->smooth = smooth; + // this is just a stub for now because - QML + d->smooth = false; emit smoothChanged(smooth); update(); } diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp index df79fce89..a51b1b6ba 100644 --- a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp +++ b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp @@ -279,7 +279,6 @@ void QDeclarativePaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem topaint &= content; QRegion uncached(content); - p->setRenderHints(QPainter::SmoothPixmapTransform, d->smooth); int cachesize=0; for (int i=0; iimagecache.count(); ++i) { @@ -296,7 +295,6 @@ void QDeclarativePaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem #ifdef Q_WS_MAC qt_applefontsmoothing_enabled = oldSmooth; #endif - qp.setRenderHints(QPainter::HighQualityAntialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform, d->smoothCache); qp.translate(-area.x(), -area.y()); qp.scale(d->contentsScale,d->contentsScale); QRect clip = d->imagecache[i]->dirty; @@ -365,8 +363,6 @@ void QDeclarativePaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem #ifdef Q_WS_MAC qt_applefontsmoothing_enabled = oldSmooth; #endif - qp.setRenderHints(QPainter::HighQualityAntialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform, d->smoothCache); - qp.translate(-r.x(),-r.y()); qp.scale(d->contentsScale,d->contentsScale); QRect sclip(qFloor(r.x()/d->contentsScale), @@ -469,30 +465,6 @@ QColor QDeclarativePaintedItem::fillColor() const return d->fillColor; } -/*! - \qmlproperty bool PaintedItem::smoothCache - - Controls whether the cached tiles of which the item is composed are - rendered smoothly when they are generated. - - This is in addition toe Item::smooth, which controls the smooth painting of - the already-painted cached tiles under transformation. -*/ -bool QDeclarativePaintedItem::smoothCache() const -{ - Q_D(const QDeclarativePaintedItem); - return d->smoothCache; -} - -void QDeclarativePaintedItem::setSmoothCache(bool on) -{ - Q_D(QDeclarativePaintedItem); - if (d->smoothCache != on) { - d->smoothCache = on; - clearCache(); - } -} - - QT_END_NAMESPACE -#include + +#include "moc_qdeclarativepainteditem_p.h" diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem_p.h b/src/declarative/graphicsitems/qdeclarativepainteditem_p.h index d15436040..8bfc7ea38 100644 --- a/src/declarative/graphicsitems/qdeclarativepainteditem_p.h +++ b/src/declarative/graphicsitems/qdeclarativepainteditem_p.h @@ -57,7 +57,6 @@ class Q_AUTOTEST_EXPORT QDeclarativePaintedItem : public QDeclarativeItem Q_PROPERTY(QSize contentsSize READ contentsSize WRITE setContentsSize NOTIFY contentsSizeChanged) Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged) Q_PROPERTY(int pixelCacheSize READ pixelCacheSize WRITE setPixelCacheSize) - Q_PROPERTY(bool smoothCache READ smoothCache WRITE setSmoothCache) Q_PROPERTY(qreal contentsScale READ contentsScale WRITE setContentsScale NOTIFY contentsScaleChanged) @@ -74,9 +73,6 @@ public: int pixelCacheSize() const; void setPixelCacheSize(int pixels); - bool smoothCache() const; - void setSmoothCache(bool on); - QColor fillColor() const; void setFillColor(const QColor&); diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem_p_p.h b/src/declarative/graphicsitems/qdeclarativepainteditem_p_p.h index b09285b48..c58443a07 100644 --- a/src/declarative/graphicsitems/qdeclarativepainteditem_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativepainteditem_p_p.h @@ -63,7 +63,7 @@ class QDeclarativePaintedItemPrivate : public QDeclarativeItemPrivate public: QDeclarativePaintedItemPrivate() - : max_imagecache_size(100000), contentsScale(1.0), fillColor(Qt::transparent), cachefrozen(false), smoothCache(true) + : max_imagecache_size(100000), contentsScale(1.0), fillColor(Qt::transparent), cachefrozen(false) { } @@ -83,7 +83,6 @@ public: qreal contentsScale; QColor fillColor; bool cachefrozen; - bool smoothCache; }; QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 50f40164d..6153679bf 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -480,12 +480,7 @@ void QDeclarativeRectangle::paint(QPainter *p, const QStyleOptionGraphicsItem *, drawRect(*p); } else { - bool oldAA = p->testRenderHint(QPainter::Antialiasing); - if (d->smooth) - p->setRenderHints(QPainter::Antialiasing, true); p->fillRect(QRectF(0, 0, width(), height()), d->color); - if (d->smooth) - p->setRenderHint(QPainter::Antialiasing, oldAA); } } @@ -497,9 +492,6 @@ void QDeclarativeRectangle::drawRect(QPainter &p) || width() < 3 || height() < 3) { // XXX This path is still slower than the image path // Image path won't work for gradients or invalid radius though - bool oldAA = p.testRenderHint(QPainter::Antialiasing); - if (d->smooth) - p.setRenderHint(QPainter::Antialiasing); if (d->pen && d->pen->isValid()) { QPen pn(QColor(d->pen->color()), d->pen->width()); pn.setJoinStyle(Qt::MiterJoin); @@ -524,14 +516,7 @@ void QDeclarativeRectangle::drawRect(QPainter &p) p.drawRoundedRect(rect, radius, radius); else p.drawRect(rect); - if (d->smooth) - p.setRenderHint(QPainter::Antialiasing, oldAA); } else { - bool oldAA = p.testRenderHint(QPainter::Antialiasing); - bool oldSmooth = p.testRenderHint(QPainter::SmoothPixmapTransform); - if (d->smooth) - p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth); - const int pw = d->pen && d->pen->isValid() ? (d->pen->width()+1)/2*2 : 0; if (d->radius > 0) @@ -554,11 +539,6 @@ void QDeclarativeRectangle::drawRect(QPainter &p) QTileRules rules(Qt::StretchTile, Qt::StretchTile); //NOTE: even though our item may have qreal-based width and height, qDrawBorderPixmap only supports QRects qDrawBorderPixmap(&p, QRect(-pw/2, -pw/2, width()+pw, height()+pw), margins, d->rectImage, d->rectImage.rect(), margins, rules); - - if (d->smooth) { - p.setRenderHint(QPainter::Antialiasing, oldAA); - p.setRenderHint(QPainter::SmoothPixmapTransform, oldSmooth); - } } } diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 1c03b1487..f3abd38c0 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -1530,11 +1530,6 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid if (d->imageCache.isNull()) return; - bool oldAA = p->testRenderHint(QPainter::Antialiasing); - bool oldSmooth = p->testRenderHint(QPainter::SmoothPixmapTransform); - if (d->smooth) - p->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth); - QRect br = boundingRect().toRect(); bool needClip = clip() && (d->imageCache.width() > width() || @@ -1544,11 +1539,6 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid p->drawPixmap(0, 0, width(), height(), d->imageCache, -br.x(), -br.y(), width(), height()); else p->drawPixmap(br.x(), br.y(), d->imageCache); - - if (d->smooth) { - p->setRenderHint(QPainter::Antialiasing, oldAA); - p->setRenderHint(QPainter::SmoothPixmapTransform, oldSmooth); - } } else { QRectF bounds = boundingRect(); diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 335c5be72..423af2c6b 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -5162,7 +5162,6 @@ QRegion QGraphicsItem::boundingRegion(const QTransform &itemToDeviceTransform) c QImage mask(bitmapSize, QImage::Format_ARGB32_Premultiplied); mask.fill(0); QPainter p(&mask); - p.setRenderHints(QPainter::Antialiasing); // Transform painter (### this code is from QGraphicsScene::drawItemHelper // and doesn't work properly with perspective transformations). @@ -9310,14 +9309,6 @@ QVariant QGraphicsLineItem::extension(const QVariant &variant) const The pixmap is drawn at the item's (0, 0) coordinate, as returned by offset(). You can change the drawing offset by calling setOffset(). - You can set the pixmap's transformation mode by calling - setTransformationMode(). By default, Qt::FastTransformation is used, which - provides fast, non-smooth scaling. Qt::SmoothTransformation enables - QPainter::SmoothPixmapTransform on the painter, and the quality depends on - the platform and viewport. The result is usually not as good as calling - QPixmap::scale() directly. Call transformationMode() to get the current - transformation mode for the item. - \sa QGraphicsPathItem, QGraphicsRectItem, QGraphicsEllipseItem, QGraphicsTextItem, QGraphicsPolygonItem, QGraphicsLineItem, {Graphics View Framework} @@ -9351,13 +9342,11 @@ class QGraphicsPixmapItemPrivate : public QGraphicsItemPrivate Q_DECLARE_PUBLIC(QGraphicsPixmapItem) public: QGraphicsPixmapItemPrivate() - : transformationMode(Qt::FastTransformation), - shapeMode(QGraphicsPixmapItem::MaskShape), + : shapeMode(QGraphicsPixmapItem::MaskShape), hasShape(false) {} QPixmap pixmap; - Qt::TransformationMode transformationMode; QPointF offset; QGraphicsPixmapItem::ShapeMode shapeMode; QPainterPath shape; @@ -9457,39 +9446,6 @@ QPixmap QGraphicsPixmapItem::pixmap() const } /*! - Returns the transformation mode of the pixmap. The default mode is - Qt::FastTransformation, which provides quick transformation with no - smoothing. - - \sa setTransformationMode() -*/ -Qt::TransformationMode QGraphicsPixmapItem::transformationMode() const -{ - Q_D(const QGraphicsPixmapItem); - return d->transformationMode; -} - -/*! - Sets the pixmap item's transformation mode to \a mode, and toggles an - update of the item. The default mode is Qt::FastTransformation, which - provides quick transformation with no smoothing. - - Qt::SmoothTransformation enables QPainter::SmoothPixmapTransform on the - painter, and the quality depends on the platform and viewport. The result - is usually not as good as calling QPixmap::scale() directly. - - \sa transformationMode() -*/ -void QGraphicsPixmapItem::setTransformationMode(Qt::TransformationMode mode) -{ - Q_D(QGraphicsPixmapItem); - if (mode != d->transformationMode) { - d->transformationMode = mode; - update(); - } -} - -/*! Returns the pixmap item's \e offset, which defines the point of the top-left corner of the pixmap, in local coordinates. @@ -9572,9 +9528,6 @@ void QGraphicsPixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsIte Q_D(QGraphicsPixmapItem); Q_UNUSED(widget); - painter->setRenderHint(QPainter::SmoothPixmapTransform, - (d->transformationMode == Qt::SmoothTransformation)); - painter->drawPixmap(d->offset, d->pixmap); if (option->state & QStyle::State_Selected) diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index ebaa8a124..e8265ac0d 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -861,9 +861,6 @@ public: QPixmap pixmap() const; void setPixmap(const QPixmap &pixmap); - Qt::TransformationMode transformationMode() const; - void setTransformationMode(Qt::TransformationMode mode); - QPointF offset() const; void setOffset(const QPointF &offset); inline void setOffset(qreal x, qreal y); diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 2da71df69..f8625b61a 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -5851,9 +5851,6 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode if (d->format >= QImage::Format_RGB32) { QPainter p(&dImage); - if (mode == Qt::SmoothTransformation) { - p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); - } p.setTransform(mat); p.drawImage(QPoint(0, 0), *this); } else { diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index 102d3bc26..9d9d7a750 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -892,7 +892,6 @@ Q_GUI_EXPORT void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, boo if (p) { p->scale(scale, scale); - p->setRenderHint(QPainter::SmoothPixmapTransform); p->drawImage(QRect(0, 0, blurImage.width(), blurImage.height()), blurImage); } } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 33f2b8ca0..4eeaa979b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -5034,14 +5034,8 @@ void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset pixmap.fill(Qt::transparent); q->render(&pixmap, QPoint(), toBePainted, renderFlags); - const bool restore = !(painter->renderHints() & QPainter::SmoothPixmapTransform); - painter->setRenderHints(QPainter::SmoothPixmapTransform, true); - painter->drawPixmap(targetOffset, pixmap); - if (restore) - painter->setRenderHints(QPainter::SmoothPixmapTransform, false); - #ifndef Q_WS_MAC } else { // Render via a pixmap in device coordinates (to avoid pixmap scaling). diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index dbcd3823d..ba73de006 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -840,13 +840,6 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin xTarget.resize(columns + 1); yTarget.resize(rows + 1); - bool oldAA = painter->testRenderHint(QPainter::Antialiasing); - if (painter->paintEngine()->type() != QPaintEngine::OpenGL - && painter->paintEngine()->type() != QPaintEngine::OpenGL2 - && oldAA && painter->combinedTransform().type() != QTransform::TxNone) { - painter->setRenderHint(QPainter::Antialiasing, false); - } - xTarget[0] = targetRect.left(); xTarget[1] = targetCenterLeft; xTarget[columns - 1] = targetCenterRight; @@ -981,9 +974,6 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin if (sourceData[i].size()) painter->drawPixmapFragments(targetData[i].data(), sourceData[i].data(), sourceData[i].size(), pixmap, i == 1 ? QPainter::OpaqueHint : QPainter::PixmapFragmentHint(0)); } - - if (oldAA) - painter->setRenderHint(QPainter::Antialiasing, true); } QT_END_NAMESPACE diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index ec5da7b3a..b790fab09 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -4681,7 +4681,6 @@ void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm) } translate(x, y); setBackgroundMode(Qt::TransparentMode); - setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); QBrush brush(d->state->pen.color(), pm); setBrush(brush); setPen(Qt::NoPen); @@ -4804,7 +4803,6 @@ void QPainter::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) translate(x, y); scale(w / sw, h / sh); setBackgroundMode(Qt::TransparentMode); - setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); QBrush brush; if (sw == pm.width() && sh == pm.height()) @@ -4964,7 +4962,6 @@ void QPainter::drawImage(const QPointF &p, const QImage &image) } translate(x, y); setBackgroundMode(Qt::TransparentMode); - setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); QBrush brush(image); setBrush(brush); setPen(Qt::NoPen); @@ -5076,7 +5073,6 @@ void QPainter::drawImage(const QRectF &targetRect, const QImage &image, const QR translate(x, y); scale(w / sw, h / sh); setBackgroundMode(Qt::TransparentMode); - setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); QBrush brush(image); setBrush(brush); setPen(Qt::NoPen); @@ -6191,7 +6187,6 @@ void QPainter::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPo { save(); setBackgroundMode(Qt::TransparentMode); - setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); setBrush(QBrush(d->state->pen.color(), pixmap)); setPen(Qt::NoPen); diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index aa3f2f378..837189f8a 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -957,7 +957,6 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, case PE_IndicatorRadioButton: painter->save(); { - painter->setRenderHint(QPainter::SmoothPixmapTransform); QRect checkRect = rect.adjusted(0, 0, 0, 0); if (state & (State_On )) { painter->drawImage(rect, QImage(qt_cleanlooks_radiobutton)); @@ -966,7 +965,6 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, else if (state & State_Sunken) { painter->drawImage(rect, QImage(qt_cleanlooks_radiobutton)); QColor bgc = buttonShadow; - painter->setRenderHint(QPainter::Antialiasing); painter->setBrush(bgc); painter->setPen(Qt::NoPen); painter->drawEllipse(rect.adjusted(1, 1, -1, -1)); } @@ -1903,7 +1901,6 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o if (menuItem->checkType & QStyleOptionMenuItem::Exclusive) { // Radio button if (checked || sunken) { - painter->setRenderHint(QPainter::Antialiasing); painter->setPen(Qt::NoPen); QPalette::ColorRole textRole = !enabled ? QPalette::Text: @@ -2870,7 +2867,6 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp alpha.setAlpha(128); image.setColor(1, textColor.rgba()); image.setColor(2, alpha.rgba()); - painter->setRenderHint(QPainter::SmoothPixmapTransform); painter->drawImage(contextHelpButtonRect.adjusted(4, 4, -4, -4), image); } } @@ -3517,7 +3513,6 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp handlePainter.drawLine(QPoint(r.left() + 3, r.bottom()), QPoint(r.right() - 3, r.bottom())); handlePainter.save(); - handlePainter.setRenderHint(QPainter::Antialiasing); handlePainter.translate(0.5, 0.5); const QLine lines[4] = { QLine(QPoint(r.left(), r.bottom() - 2), QPoint(r.left() + 2, r.bottom())), diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 129bf91bf..02f0cb589 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -561,7 +561,6 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q p->setPen(QPen(tab->palette.light(), qreal(.8))); p->setBrush(tab->palette.background()); - p->setRenderHint(QPainter::Antialiasing); p->drawPath(path); } break; @@ -1638,7 +1637,6 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, a.setPoint(i, a.point(i).x(), rect.height() - 1 - a.point(i).y()); a.translate(rect.left(), rect.top()); - p->setRenderHint(QPainter::Antialiasing); p->translate(0, 0.5); QPainterPath path; @@ -1663,7 +1661,6 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, for (i = 0; i < 10; ++i) a.setPoint(i, rect.width() - 1 - a.point(i).x(), a.point(i).y()); a.translate(rect.left(), rect.top()); - p->setRenderHint(QPainter::Antialiasing); p->translate(0.5, 0); QPainterPath path; path.addPolygon(a); @@ -3408,10 +3405,6 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl // OK, this is more a port of things over p->save(); - // avoid dithering - if (p->paintEngine()->hasFeature(QPaintEngine::Antialiasing)) - p->setRenderHint(QPainter::Antialiasing); - int width = dial->rect.width(); int height = dial->rect.height(); qreal r = qMin(width, height) / 2; diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 2e781acec..6d2238a36 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -151,7 +151,6 @@ static bool isVerticalTabs(const QTabBar::Shape shape) { void drawTabCloseButton(QPainter *p, bool hover, bool active, bool selected) { // draw background circle - p->setRenderHints(QPainter::Antialiasing); QRect rect(0, 0, closeButtonSize, closeButtonSize); QColor background; if (hover) { @@ -269,7 +268,6 @@ void drawTabShape(QPainter *p, const QStyleOptionTabV3 *tabOpt) QRectF rectangleRight(width - 2, height - 1, w, w); int startAngle = 180 * 16; int spanAngle = 90 * 16; - p->setRenderHint(QPainter::Antialiasing); p->drawArc(rectangleLeft, startAngle, spanAngle); p->drawArc(rectangleRight, startAngle, -spanAngle); } else { @@ -2684,7 +2682,6 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai case PE_IndicatorArrowRight: case PE_IndicatorArrowLeft: { p->save(); - p->setRenderHint(QPainter::Antialiasing); int xOffset = opt->direction == Qt::LeftToRight ? 2 : -1; QMatrix matrix; matrix.translate(opt->rect.center().x() + xOffset, opt->rect.center().y() + 2); @@ -2870,7 +2867,6 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai p->setPen(QPen(QColor(100, 100, 100), 3)); } p->save(); - p->setRenderHint(QPainter::Antialiasing); p->drawLines(a); p->restore(); break; } @@ -4097,7 +4093,6 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter QPen metalHighlight = QColor(5, 5, 5, 192); lineColor.setWidth(1); p->save(); - p->setRenderHint(QPainter::Antialiasing); p->setPen(lineColor); const Qt::LayoutDirection layoutDirection = w ? w->layoutDirection() : qApp->layoutDirection(); const int NumLines = metal ? 4 : 3; @@ -4114,9 +4109,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter p->drawLine(start, end); if (metal) { p->setPen(metalHighlight); - p->setRenderHint(QPainter::Antialiasing, false); p->drawLine(start + QPoint(0, -1), end + QPoint(0, -1)); - p->setRenderHint(QPainter::Antialiasing, true); p->setPen(lineColor); } } @@ -4979,7 +4972,6 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex if (tb->state & State_On) { if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) { static QPixmap pm(QLatin1String(":/trolltech/mac/style/images/leopard-unified-toolbar-on.png")); - p->setRenderHint(QPainter::SmoothPixmapTransform); QStyleHelper::drawBorderPixmap(pm, p, tb->rect, 2, 2, 2, 2); } else { QPen oldPen = p->pen(); diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 042c437f7..bc70c1c27 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -1435,12 +1435,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption break; #endif // QT_NO_MAINWINDOW case PE_IndicatorHeaderArrow: { - bool usedAntialiasing = painter->renderHints() & QPainter::Antialiasing; - if (!usedAntialiasing) - painter->setRenderHint(QPainter::Antialiasing); QWindowsStyle::drawPrimitive(element, option, painter, widget); - if (!usedAntialiasing) - painter->setRenderHint(QPainter::Antialiasing, false); break; } case PE_PanelButtonTool: @@ -1706,7 +1701,6 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption bool unchanged = button->state & State_NoChange; bool enabled = button->state & State_Enabled; if (on || (enabled && sunken) || unchanged) { - p->setRenderHint(QPainter::Antialiasing); QBrush pointBrush = qMapBrushToRect(button->palette.text(), rect); if (sunken) qBrushSetAlphaF(&pointBrush, qreal(0.5)); @@ -1728,7 +1722,6 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption BEGIN_STYLE_PIXMAPCACHE(QLatin1String("radiobutton")) p->save(); - p->setRenderHint(QPainter::Antialiasing); // The the filled ellipse QBrush border = qMapBrushToRect(option->palette.shadow(), rect); diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp index 7d116fd9b..85ed8108f 100644 --- a/src/gui/styles/qstylehelper.cpp +++ b/src/gui/styles/qstylehelper.cpp @@ -223,7 +223,6 @@ void drawDial(const QStyleOptionSlider *option, QPainter *painter) const qreal penSize = r/20.0; painter->save(); - painter->setRenderHint(QPainter::Antialiasing); // Draw notches if (option->subControls & QStyle::SC_DialTickmarks) { @@ -233,7 +232,6 @@ void drawDial(const QStyleOptionSlider *option, QPainter *painter) // Cache dial background BEGIN_STYLE_PIXMAPCACHE(QString::fromLatin1("qdial")); - p->setRenderHint(QPainter::Antialiasing); const qreal d_ = r / 6; const qreal dx = option->rect.x() + d_ + (width - 2 * r) / 2 + 1; @@ -326,7 +324,6 @@ void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rec int bottom) { QSize size = pixmap.size(); - //painter->setRenderHint(QPainter::SmoothPixmapTransform); //top if (top > 0) { diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index db11c4aa8..1d0571426 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -1130,12 +1130,9 @@ void QRenderRule::drawBorderImage(QPainter *p, const QRect& rect) QMargins targetMargins(targetBorders[LeftEdge], targetBorders[TopEdge], targetBorders[RightEdge], targetBorders[BottomEdge]); - bool wasSmoothPixmapTransform = p->renderHints() & QPainter::SmoothPixmapTransform; - p->setRenderHint(QPainter::SmoothPixmapTransform); qDrawBorderPixmap(p, rect, targetMargins, borderImageData->pixmap, QRect(QPoint(), borderImageData->pixmap.size()), sourceMargins, QTileRules(tileMode2TileRule[borderImageData->horizStretch], tileMode2TileRule[borderImageData->vertStretch])); - p->setRenderHint(QPainter::SmoothPixmapTransform, wasSmoothPixmapTransform); unsetClip(p); } diff --git a/src/gui/styles/qwindowscestyle.cpp b/src/gui/styles/qwindowscestyle.cpp index bedba0a74..1e6a7865d 100644 --- a/src/gui/styles/qwindowscestyle.cpp +++ b/src/gui/styles/qwindowscestyle.cpp @@ -124,7 +124,6 @@ void QWindowsCEStyle::drawPrimitive(PrimitiveElement element, const QStyleOption painter->setPen(QPen(tab->palette.light(), qreal(.8))); painter->setBrush(tab->palette.background()); - painter->setRenderHint(QPainter::Antialiasing); painter->drawPath(path); } break; diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 1ec4797b0..884c4c60a 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -656,7 +656,6 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph) QImage im(glyph_width + 4, glyph_height, QImage::Format_ARGB32_Premultiplied); im.fill(Qt::transparent); QPainter p(&im); - p.setRenderHint(QPainter::Antialiasing); addGlyphsToPath(&glyph, &pt, 1, &path, 0); p.setPen(Qt::NoPen); p.setBrush(Qt::black); diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 0834bea1f..93f90f4bf 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -819,9 +819,6 @@ void QTextDocumentLayoutPrivate::drawBorder(QPainter *painter, const QRectF &rec QCss::BorderStyle cssStyle = static_cast(style + 1); #endif //QT_NO_CSSPARSER - bool turn_off_antialiasing = !(painter->renderHints() & QPainter::Antialiasing); - painter->setRenderHint(QPainter::Antialiasing); - for (int i = topPage; i <= bottomPage; ++i) { QRectF clipped = rect.toRect(); @@ -848,8 +845,6 @@ void QTextDocumentLayoutPrivate::drawBorder(QPainter *painter, const QRectF &rec painter->restore(); #endif //QT_NO_CSSPARSER } - if (turn_off_antialiasing) - painter->setRenderHint(QPainter::Antialiasing, false); } void QTextDocumentLayoutPrivate::drawFrameDecoration(QPainter *painter, QTextFrame *frame, QTextFrameData *fd, const QRectF &clip, const QRectF &rect) const @@ -1421,8 +1416,6 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p painter->save(); - painter->setRenderHint(QPainter::Antialiasing); - if (selectionFormat) { painter->setPen(QPen(selectionFormat->foreground(), 0)); painter->fillRect(r, selectionFormat->background()); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 26991ec49..ec2190cbb 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2449,7 +2449,6 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR } p->save(); - p->setRenderHint(QPainter::Antialiasing); //Currently QPen with a Qt::NoPen style still returns a default //QBrush which != Qt::NoBrush so we need this specialcase to reset it if (p->pen().style() == Qt::NoPen) diff --git a/src/gui/widgets/qlcdnumber.cpp b/src/gui/widgets/qlcdnumber.cpp index 1c85353eb..f0891ac0c 100644 --- a/src/gui/widgets/qlcdnumber.cpp +++ b/src/gui/widgets/qlcdnumber.cpp @@ -720,7 +720,6 @@ void QLCDNumber::paintEvent(QPaintEvent *) Q_D(QLCDNumber); QPainter p(this); drawFrame(&p); - p.setRenderHint(QPainter::Antialiasing); if (d->shadow) p.translate(0.5, 0.5); diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 6f7cef88b..4deeb55e6 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -523,7 +523,6 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const GL_UNSIGNED_BYTE, const_cast(subImage).bits()); QGL2PaintEngineEx *engine = static_cast(painter->paintEngine()); - painter->setRenderHint(QPainter::SmoothPixmapTransform); // texture is flipped on the y-axis targetRectF = QRectF(targetRectF.x(), targetRectF.bottom(), targetRectF.width(), -targetRectF.height()); @@ -594,7 +593,6 @@ bool QGLPixmapDropShadowFilter::processGL(QPainter *painter, const QPointF &pos, filter->setOnPainter(painter); QGL2PaintEngineEx *engine = static_cast(painter->paintEngine()); - painter->setRenderHint(QPainter::SmoothPixmapTransform); engine->drawTexture(targetRect, texture, info->paddedImage().size(), info->paddedImage().rect()); diff --git a/src/svg/qsvgtinydocument.cpp b/src/svg/qsvgtinydocument.cpp index d685301e9..95ea7e72d 100644 --- a/src/svg/qsvgtinydocument.cpp +++ b/src/svg/qsvgtinydocument.cpp @@ -250,7 +250,6 @@ void QSvgTinyDocument::draw(QPainter *p, const QRectF &bounds) pen.setMiterLimit(4); p->setPen(pen); p->setBrush(Qt::black); - p->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); QList::iterator itr = m_renderers.begin(); applyStyle(p, m_states); while (itr != m_renderers.end()) { @@ -292,8 +291,6 @@ void QSvgTinyDocument::draw(QPainter *p, const QString &id, pen.setMiterLimit(4); p->setPen(pen); p->setBrush(Qt::black); - p->setRenderHint(QPainter::Antialiasing); - p->setRenderHint(QPainter::SmoothPixmapTransform); QStack parentApplyStack; QSvgNode *parent = node->parent(); diff --git a/src/tools/designer/qdesigner_actions.cpp b/src/tools/designer/qdesigner_actions.cpp index ab57820be..d06708c47 100644 --- a/src/tools/designer/qdesigner_actions.cpp +++ b/src/tools/designer/qdesigner_actions.cpp @@ -1414,7 +1414,6 @@ void QDesignerActions::printPreviewImage() const double suggestedScaling = static_cast(m_printer->physicalDpiX()) / static_cast(fw->physicalDpiX()); QPainter painter(m_printer); - painter.setRenderHint(QPainter::SmoothPixmapTransform); // Clamp to page const QRectF page = painter.viewport(); -- 2.11.0