do not force rendering hints

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2016-08-13 01:42:16 +00:00
parent fd02946163
commit a013029c5c
29 changed files with 6 additions and 209 deletions

View file

@ -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);
}

View file

@ -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())

View file

@ -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();
}

View file

@ -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; i<d->imagecache.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 <moc_qdeclarativepainteditem_p.h>
#include "moc_qdeclarativepainteditem_p.h"

View file

@ -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&);

View file

@ -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

View file

@ -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);
}
}
}

View file

@ -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();

View file

@ -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;
@ -9456,39 +9445,6 @@ QPixmap QGraphicsPixmapItem::pixmap() const
return d->pixmap;
}
/*!
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)

View file

@ -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);

View file

@ -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 {

View file

@ -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);
}
}

View file

@ -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).

View file

@ -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

View file

@ -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);

View file

@ -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())),

View file

@ -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;

View file

@ -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();

View file

@ -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);

View file

@ -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) {

View file

@ -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);
}

View file

@ -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;

View file

@ -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);

View file

@ -819,9 +819,6 @@ void QTextDocumentLayoutPrivate::drawBorder(QPainter *painter, const QRectF &rec
QCss::BorderStyle cssStyle = static_cast<QCss::BorderStyle>(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());

View file

@ -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)

View file

@ -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);

View file

@ -523,7 +523,6 @@ bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const
GL_UNSIGNED_BYTE, const_cast<const QImage &>(subImage).bits());
QGL2PaintEngineEx *engine = static_cast<QGL2PaintEngineEx *>(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<QGL2PaintEngineEx *>(painter->paintEngine());
painter->setRenderHint(QPainter::SmoothPixmapTransform);
engine->drawTexture(targetRect, texture, info->paddedImage().size(), info->paddedImage().rect());

View file

@ -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<QSvgNode*>::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<QSvgNode*> parentApplyStack;
QSvgNode *parent = node->parent();

View file

@ -1414,7 +1414,6 @@ void QDesignerActions::printPreviewImage()
const double suggestedScaling = static_cast<double>(m_printer->physicalDpiX()) / static_cast<double>(fw->physicalDpiX());
QPainter painter(m_printer);
painter.setRenderHint(QPainter::SmoothPixmapTransform);
// Clamp to page
const QRectF page = painter.viewport();