summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp20
-rw-r--r--src/gui/painting/qcosmeticstroker_p.h5
-rw-r--r--src/gui/painting/qpaintengine.cpp2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp43
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h1
-rw-r--r--src/gui/painting/qpaintengineex.cpp4
-rw-r--r--src/gui/painting/qpainter.cpp14
-rw-r--r--src/gui/painting/qpainter.h1
-rw-r--r--src/gui/painting/qpainter_p.h4
-rw-r--r--src/gui/painting/qpdf.cpp4
-rw-r--r--src/gui/painting/qrasterizer.cpp51
-rw-r--r--src/gui/painting/qrasterizer_p.h1
-rw-r--r--src/gui/painting/qtriangulatingstroker.cpp4
-rw-r--r--src/gui/text/qtextengine.cpp9
-rw-r--r--src/opengl/qopenglpaintengine.cpp4
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp2
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp8
-rw-r--r--src/printsupport/kernel/qpaintengine_alpha.cpp2
-rw-r--r--src/printsupport/platform/macos/qpaintengine_mac.mm2
-rw-r--r--src/printsupport/platform/windows/qprintengine_win.cpp2
-rw-r--r--src/widgets/styles/qcommonstyle.cpp9
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp3
-rw-r--r--tests/auto/gui/painting/qpainter/tst_qpainter.cpp20
23 files changed, 49 insertions, 166 deletions
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index 9e06a3f109..168e493b41 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -290,7 +290,7 @@ void QCosmeticStroker::setup()
qreal width = state->lastPen.widthF();
if (width == 0)
opacity = 256;
- else if (qt_pen_is_cosmetic(state->lastPen, state->renderHints))
+ else if (state->lastPen.isCosmetic())
opacity = (int) 256*width;
else
opacity = (int) 256*width*state->txscale;
@@ -434,11 +434,10 @@ void QCosmeticStroker::calculateLastPoint(qreal rx1, qreal ry1, qreal rx2, qreal
if (clipLine(rx1, ry1, rx2, ry2))
return;
- const int half = legacyRounding ? 31 : 0;
- int x1 = toF26Dot6(rx1) + half;
- int y1 = toF26Dot6(ry1) + half;
- int x2 = toF26Dot6(rx2) + half;
- int y2 = toF26Dot6(ry2) + half;
+ int x1 = toF26Dot6(rx1);
+ int y1 = toF26Dot6(ry1);
+ int x2 = toF26Dot6(rx2);
+ int y2 = toF26Dot6(ry2);
int dx = qAbs(x2 - x1);
int dy = qAbs(y2 - y1);
@@ -748,11 +747,10 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2,
if (stroker->clipLine(rx1, ry1, rx2, ry2))
return true;
- const int half = stroker->legacyRounding ? 31 : 0;
- int x1 = toF26Dot6(rx1) + half;
- int y1 = toF26Dot6(ry1) + half;
- int x2 = toF26Dot6(rx2) + half;
- int y2 = toF26Dot6(ry2) + half;
+ int x1 = toF26Dot6(rx1);
+ int y1 = toF26Dot6(ry1);
+ int x2 = toF26Dot6(rx2);
+ int y2 = toF26Dot6(ry2);
int dx = qAbs(x2 - x1);
int dy = qAbs(y2 - y1);
diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h
index 8571b0476a..20ebe7bc1e 100644
--- a/src/gui/painting/qcosmeticstroker_p.h
+++ b/src/gui/painting/qcosmeticstroker_p.h
@@ -103,7 +103,6 @@ public:
patternSize(0),
patternLength(0),
patternOffset(0),
- legacyRounding(false),
current_span(0),
lastDir(NoDirection),
lastAxisAligned(false)
@@ -111,8 +110,6 @@ public:
~QCosmeticStroker() { free(pattern); free(reversePattern); }
- void setLegacyRoundingEnabled(bool legacyRoundingEnabled) { legacyRounding = legacyRoundingEnabled; }
-
void drawLine(const QPointF &p1, const QPointF &p2);
void drawPath(const QVectorPath &path);
void drawPoints(const QPoint *points, int num);
@@ -135,8 +132,6 @@ public:
int patternLength;
int patternOffset;
- bool legacyRounding;
-
enum { NSPANS = 255 };
QT_FT_Span spans[NSPANS];
int current_span;
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index 075a802a6e..5a0d268c1e 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -449,7 +449,7 @@ void QPaintEngine::drawPoints(const QPointF *points, int pointCount)
p->save();
QTransform transform;
- if (qt_pen_is_cosmetic(p->pen(), p->renderHints())) {
+ if (p->pen().isCosmetic()) {
transform = p->transform();
p->setTransform(QTransform());
}
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index b458a2d627..d424845c68 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -583,7 +583,6 @@ QRasterPaintEngineState::QRasterPaintEngineState()
flags.non_complex_pen = false;
flags.antialiased = false;
flags.bilinear = false;
- flags.legacy_rounding = false;
flags.fast_text = true;
flags.int_xform = true;
flags.tx_noshear = true;
@@ -716,7 +715,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen)
} else if (pen_style != Qt::NoPen) {
if (!d->dashStroker)
d->dashStroker.reset(new QDashStroker(&d->basicStroker));
- if (qt_pen_is_cosmetic(pen, s->renderHints)) {
+ if (pen.isCosmetic()) {
d->dashStroker->setClipRect(d->deviceRect);
} else {
// ### I've seen this inverted devrect multiple places now...
@@ -731,7 +730,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen)
}
ensureRasterState(); // needed because of tx_noshear...
- bool cosmetic = qt_pen_is_cosmetic(pen, s->renderHints);
+ bool cosmetic = pen.isCosmetic();
s->flags.fast_pen = pen_style > Qt::NoPen
&& s->penData.blend
&& ((cosmetic && penWidth <= 1)
@@ -874,7 +873,6 @@ void QRasterPaintEngine::renderHintsChanged()
s->flags.antialiased = bool(s->renderHints & QPainter::Antialiasing);
s->flags.bilinear = bool(s->renderHints & QPainter::SmoothPixmapTransform);
- s->flags.legacy_rounding = !bool(s->renderHints & QPainter::Antialiasing) && bool(s->renderHints & QPainter::Qt4CompatiblePainting);
if (was_aa != s->flags.antialiased)
s->strokeFlags |= DirtyHints;
@@ -1544,7 +1542,6 @@ void QRasterPaintEngine::drawRects(const QRect *rects, int rectCount)
QRectVectorPath path;
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i = 0; i < rectCount; ++i) {
path.set(rects[i]);
stroker.drawPath(path);
@@ -1591,7 +1588,6 @@ void QRasterPaintEngine::drawRects(const QRectF *rects, int rectCount)
QRectVectorPath path;
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i = 0; i < rectCount; ++i) {
path.set(rects[i]);
stroker.drawPath(path);
@@ -1625,10 +1621,9 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPath(path);
} else if (s->flags.non_complex_pen && path.shape() == QVectorPath::LinesHint) {
- qreal width = qt_pen_is_cosmetic(s->lastPen, s->renderHints)
+ qreal width = s->lastPen.isCosmetic()
? (qpen_widthf(s->lastPen) == 0 ? 1 : qpen_widthf(s->lastPen))
: qpen_widthf(s->lastPen) * s->txscale;
int dashIndex = 0;
@@ -1688,12 +1683,10 @@ QRect QRasterPaintEngine::toNormalizedFillRect(const QRectF &rect)
{
QRasterPaintEngineState *s = state();
- qreal delta = s->flags.legacy_rounding ? aliasedCoordinateDelta : qreal(0);
-
- int x1 = qRound(rect.x() + delta);
- int y1 = qRound(rect.y() + delta);
- int x2 = qRound(rect.right() + delta);
- int y2 = qRound(rect.bottom() + delta);
+ int x1 = qRound(rect.x());
+ int y1 = qRound(rect.y());
+ int x2 = qRound(rect.right());
+ int y2 = qRound(rect.bottom());
if (x2 < x1)
qSwap(x1, x2);
@@ -1976,7 +1969,6 @@ void QRasterPaintEngine::drawPolygon(const QPointF *points, int pointCount, Poly
QVectorPath vp((const qreal *) points, pointCount, nullptr, QVectorPath::polygonFlags(mode));
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPath(vp);
} else {
QPaintEngineEx::stroke(vp, s->lastPen);
@@ -2041,7 +2033,6 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPath(vp);
} else {
QPaintEngineEx::stroke(vp, s->lastPen);
@@ -2286,9 +2277,6 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
// subtract it here as we don't use it for image drawing
QTransform old = s->matrix;
- if (s->flags.legacy_rounding)
- s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta);
-
// Do whatever fillRect() does, but without premultiplying the color if it's already premultiplied.
QRgb color = img.pixel(sr_l, sr_t);
switch (img.format()) {
@@ -2445,13 +2433,10 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
d->initializeRasterizer(&d->image_filler_xform);
d->rasterizer->setAntialiased(s->flags.antialiased);
- d->rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding);
-
- const QPointF offs = s->flags.legacy_rounding ? QPointF(aliasedCoordinateDelta, aliasedCoordinateDelta) : QPointF();
const QRectF &rect = r.normalized();
- const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f) - offs;
- const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f) - offs;
+ const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f);
+ const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f);
if (s->flags.tx_noshear)
d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width());
@@ -2460,13 +2445,12 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
return;
}
#endif
- const qreal offs = s->flags.legacy_rounding ? aliasedCoordinateDelta : qreal(0);
QPainterPath path;
path.addRect(r);
QTransform m = s->matrix;
s->matrix = QTransform(m.m11(), m.m12(), m.m13(),
m.m21(), m.m22(), m.m23(),
- m.m31() - offs, m.m32() - offs, m.m33());
+ m.m31(), m.m32(), m.m33());
fillPath(path, &d->image_filler_xform);
s->matrix = m;
} else {
@@ -2553,7 +2537,6 @@ void QRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap,
if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
d->initializeRasterizer(&d->image_filler_xform);
d->rasterizer->setAntialiased(s->flags.antialiased);
- d->rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding);
const QRectF &rect = r.normalized();
const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f);
@@ -3194,7 +3177,6 @@ void QRasterPaintEngine::drawPoints(const QPointF *points, int pointCount)
}
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPoints(points, pointCount);
}
@@ -3214,7 +3196,6 @@ void QRasterPaintEngine::drawPoints(const QPoint *points, int pointCount)
}
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPoints(points, pointCount);
}
@@ -3235,7 +3216,6 @@ void QRasterPaintEngine::drawLines(const QLine *lines, int lineCount)
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i=0; i<lineCount; ++i) {
const QLine &l = lines[i];
stroker.drawLine(l.p1(), l.p2());
@@ -3307,7 +3287,6 @@ void QRasterPaintEngine::drawLines(const QLineF *lines, int lineCount)
return;
if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
- stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i=0; i<lineCount; ++i) {
QLineF line = lines[i];
stroker.drawLine(line.p1(), line.p2());
@@ -3554,7 +3533,6 @@ void QRasterPaintEnginePrivate::initializeRasterizer(QSpanData *data)
QRasterPaintEngineState *s = q->state();
rasterizer->setAntialiased(s->flags.antialiased);
- rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding);
QRect clipRect(deviceRect);
ProcessSpans blend;
@@ -3619,7 +3597,6 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
if (!s->flags.antialiased) {
rasterizer->setAntialiased(s->flags.antialiased);
- rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding);
rasterizer->setClipRect(deviceRect);
rasterizer->initialize(callback, userData);
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index 1244ea6709..62cef10d32 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -109,7 +109,6 @@ public:
uint non_complex_pen : 1; // can use rasterizer, rather than stroker
uint antialiased : 1;
uint bilinear : 1;
- uint legacy_rounding : 1;
uint fast_text : 1;
uint int_xform : 1;
uint tx_noshear : 1;
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 8b91f13bde..7e26928e32 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -431,7 +431,7 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
}
if (pen.style() > Qt::SolidLine) {
- if (qt_pen_is_cosmetic(pen, state()->renderHints)){
+ if (pen.isCosmetic()) {
d->activeStroker->setClipRect(d->exDeviceRect);
} else {
QRectF clipRect = state()->matrix.inverted().mapRect(QRectF(d->exDeviceRect));
@@ -461,7 +461,7 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
flags |= QVectorPath::CurvedShapeMask;
// ### Perspective Xforms are currently not supported...
- if (!qt_pen_is_cosmetic(pen, state()->renderHints)) {
+ if (!pen.isCosmetic()) {
// We include cosmetic pens in this case to avoid having to
// change the current transform. Normal transformed,
// non-cosmetic pens will be transformed as part of fill
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 175c576111..8326b10083 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -1429,11 +1429,6 @@ void QPainterPrivate::updateState(QPainterState *newState)
a smooth pixmap transformation algorithm (such as bilinear) rather
than nearest neighbor.
- \value Qt4CompatiblePainting Compatibility hint telling the engine to use the
- same X11 based fill rules as in Qt 4, where aliased rendering is offset
- by slightly less than half a pixel. Also will treat default constructed pens
- as cosmetic. Potentially useful when porting a Qt 4 application to Qt 5.
-
\value LosslessImageRendering Use a lossless image rendering, whenever possible.
Currently, this hint is only used when QPainter is employed to output a PDF
file through QPrinter or QPdfWriter, where drawImage()/drawPixmap() calls
@@ -6004,12 +5999,6 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
QLineF line(qFloor(pos.x()), pos.y(), qFloor(pos.x() + width), pos.y());
- bool wasCompatiblePainting = painter->renderHints()
- & QPainter::Qt4CompatiblePainting;
-
- if (wasCompatiblePainting)
- painter->setRenderHint(QPainter::Qt4CompatiblePainting, false);
-
const qreal underlineOffset = fe->underlinePosition().toReal();
if (underlineStyle == QTextCharFormat::SpellCheckUnderline) {
@@ -6081,9 +6070,6 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
painter->setPen(oldPen);
painter->setBrush(oldBrush);
-
- if (wasCompatiblePainting)
- painter->setRenderHint(QPainter::Qt4CompatiblePainting);
}
static void qt_draw_decoration_for_glyphs(QPainter *painter,
diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h
index 498e443108..68f5fc421b 100644
--- a/src/gui/painting/qpainter.h
+++ b/src/gui/painting/qpainter.h
@@ -87,7 +87,6 @@ public:
Antialiasing = 0x01,
TextAntialiasing = 0x02,
SmoothPixmapTransform = 0x04,
- Qt4CompatiblePainting = 0x20,
LosslessImageRendering = 0x40,
};
Q_FLAG(RenderHint)
diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h
index fe029c66a5..29e2aca175 100644
--- a/src/gui/painting/qpainter_p.h
+++ b/src/gui/painting/qpainter_p.h
@@ -272,10 +272,6 @@ Q_GUI_EXPORT void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, Q
QString qt_generate_brush_key(const QBrush &brush);
-inline bool qt_pen_is_cosmetic(const QPen &pen, QPainter::RenderHints hints)
-{
- return pen.isCosmetic() || (const_cast<QPen &>(pen).data_ptr()->defaultWidth && (hints & QPainter::Qt4CompatiblePainting));
-}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 0d175adaa8..0ef3b968a1 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -657,7 +657,7 @@ void QPdf::Stroker::setPen(const QPen &pen, QPainter::RenderHints hints)
}
qreal w = pen.widthF();
bool zeroWidth = w < 0.0001;
- cosmeticPen = qt_pen_is_cosmetic(pen, hints);
+ cosmeticPen = pen.isCosmetic();
if (zeroWidth)
w = .1;
@@ -1137,7 +1137,7 @@ void QPdfEngine::updateState(const QPaintEngineState &state)
d->hasPen = d->pen.style() != Qt::NoPen;
d->stroker.setPen(d->pen, state.renderHints());
QBrush penBrush = d->pen.brush();
- bool cosmeticPen = qt_pen_is_cosmetic(d->pen, state.renderHints());
+ bool cosmeticPen = d->pen.isCosmetic();
bool oldSimple = d->simplePen;
d->simplePen = (d->hasPen && !cosmeticPen && (penBrush.style() == Qt::SolidPattern) && penBrush.isOpaque() && d->opacity == 1.0);
if (oldSimple != d->simplePen)
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index 3902b072c9..921d260320 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -137,7 +137,7 @@ public:
~QScanConverter();
void begin(int top, int bottom, int left, int right,
- Qt::FillRule fillRule, bool legacyRounding, QSpanBuffer *spanBuffer);
+ Qt::FillRule fillRule, QSpanBuffer *spanBuffer);
void end();
void mergeCurve(const QT_FT_Vector &a, const QT_FT_Vector &b,
@@ -185,7 +185,6 @@ private:
QScFixed m_rightFP;
int m_fillRuleMask;
- bool m_legacyRounding;
int m_x;
int m_y;
@@ -205,7 +204,6 @@ class QRasterizerPrivate
{
public:
bool antialiased;
- bool legacyRounding;
ProcessSpans blend;
void *data;
QRect clipRect;
@@ -229,7 +227,7 @@ QScanConverter::~QScanConverter()
}
void QScanConverter::begin(int top, int bottom, int left, int right,
- Qt::FillRule fillRule, bool legacyRounding,
+ Qt::FillRule fillRule,
QSpanBuffer *spanBuffer)
{
m_top = top;
@@ -240,7 +238,6 @@ void QScanConverter::begin(int top, int bottom, int left, int right,
m_lines.reset();
m_fillRuleMask = fillRule == Qt::WindingFill ? ~0x0 : 0x1;
- m_legacyRounding = legacyRounding;
m_spanBuffer = spanBuffer;
}
@@ -596,20 +593,11 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b)
winding = -1;
}
- if (m_legacyRounding) {
- a.x += COORD_OFFSET;
- a.y += COORD_OFFSET;
- b.x += COORD_OFFSET;
- b.y += COORD_OFFSET;
- }
-
- int rounding = m_legacyRounding ? COORD_ROUNDING : 0;
-
- int iTop = qMax(m_top, int((a.y + 32 - rounding) >> 6));
- int iBottom = qMin(m_bottom, int((b.y - 32 - rounding) >> 6));
+ int iTop = qMax(m_top, int((a.y + 32) >> 6));
+ int iBottom = qMin(m_bottom, int((b.y - 32) >> 6));
if (iTop <= iBottom) {
- QScFixed aFP = QScFixedFactor/2 + FTPosToQScFixed(a.x - rounding);
+ QScFixed aFP = QScFixedFactor/2 + FTPosToQScFixed(a.x);
if (b.x == a.x) {
Line line = { qBound(m_leftFP, aFP, m_rightFP), 0, iTop, iBottom, winding };
@@ -640,7 +628,6 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b)
QRasterizer::QRasterizer()
: d(new QRasterizerPrivate)
{
- d->legacyRounding = false;
}
QRasterizer::~QRasterizer()
@@ -664,11 +651,6 @@ void QRasterizer::setClipRect(const QRect &clipRect)
d->clipRect = clipRect;
}
-void QRasterizer::setLegacyRoundingEnabled(bool legacyRoundingEnabled)
-{
- d->legacyRounding = legacyRoundingEnabled;
-}
-
static QScFixed intersectPixelFP(int x, QScFixed top, QScFixed bottom, QScFixed leftIntersectX, QScFixed rightIntersectX, QScFixed slope, QScFixed invSlope)
{
QScFixed leftX = IntToQScFixed(x);
@@ -803,13 +785,6 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
pb = npb;
}
- if (!d->antialiased && d->legacyRounding) {
- pa.rx() += (COORD_OFFSET - COORD_ROUNDING)/64.;
- pa.ry() += (COORD_OFFSET - COORD_ROUNDING)/64.;
- pb.rx() += (COORD_OFFSET - COORD_ROUNDING)/64.;
- pb.ry() += (COORD_OFFSET - COORD_ROUNDING)/64.;
- }
-
{
// old delta
const QPointF d0 = a - b;
@@ -1207,15 +1182,13 @@ void QRasterizer::rasterize(const QT_FT_Outline *outline, Qt::FillRule fillRule)
max_y = qMax(p.y, max_y);
}
- int rounding = d->legacyRounding ? COORD_OFFSET - COORD_ROUNDING : 0;
-
- int iTopBound = qMax(d->clipRect.top(), int((min_y + 32 + rounding) >> 6));
- int iBottomBound = qMin(d->clipRect.bottom(), int((max_y - 32 + rounding) >> 6));
+ int iTopBound = qMax(d->clipRect.top(), int((min_y + 32) >> 6));
+ int iBottomBound = qMin(d->clipRect.bottom(), int((max_y - 32) >> 6));
if (iTopBound > iBottomBound)
return;
- d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, d->legacyRounding, &buffer);
+ d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, &buffer);
int first = 0;
for (int i = 0; i < outline->n_contours; ++i) {
@@ -1245,15 +1218,13 @@ void QRasterizer::rasterize(const QPainterPath &path, Qt::FillRule fillRule)
QRectF bounds = path.controlPointRect();
- double rounding = d->legacyRounding ? (COORD_OFFSET - COORD_ROUNDING) / 64. : 0.0;
-
- int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + 0.5 + rounding));
- int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - 0.5 + rounding));
+ int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + 0.5));
+ int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - 0.5));
if (iTopBound > iBottomBound)
return;
- d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, d->legacyRounding, &buffer);
+ d->scanConverter.begin(iTopBound, iBottomBound, d->clipRect.left(), d->clipRect.right(), fillRule, &buffer);
int subpathStart = 0;
QT_FT_Vector last = { 0, 0 };
diff --git a/src/gui/painting/qrasterizer_p.h b/src/gui/painting/qrasterizer_p.h
index 955577f4a3..b6f3e83c6c 100644
--- a/src/gui/painting/qrasterizer_p.h
+++ b/src/gui/painting/qrasterizer_p.h
@@ -72,7 +72,6 @@ public:
void setAntialiased(bool antialiased);
void setClipRect(const QRect &clipRect);
- void setLegacyRoundingEnabled(bool legacyRoundingEnabled);
void initialize(ProcessSpans blend, void *data);
diff --git a/src/gui/painting/qtriangulatingstroker.cpp b/src/gui/painting/qtriangulatingstroker.cpp
index 9490e11dd9..0719b9a76d 100644
--- a/src/gui/painting/qtriangulatingstroker.cpp
+++ b/src/gui/painting/qtriangulatingstroker.cpp
@@ -94,7 +94,7 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen, co
m_width = realWidth / 2;
- bool cosmetic = qt_pen_is_cosmetic(pen, hints);
+ bool cosmetic = pen.isCosmetic();
if (cosmetic) {
m_width = m_width * m_inv_scale;
}
@@ -544,7 +544,7 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, c
const QPainterPath::ElementType *types = path.elements();
int count = path.elementCount();
- bool cosmetic = qt_pen_is_cosmetic(pen, hints);
+ bool cosmetic = pen.isCosmetic();
bool implicitClose = path.hasImplicitClose();
m_points.reset();
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 074771beaa..21670b8d4c 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -3661,12 +3661,6 @@ void QTextEngine::drawDecorations(QPainter *painter)
{
QPen oldPen = painter->pen();
- bool wasCompatiblePainting = painter->renderHints()
- & QPainter::Qt4CompatiblePainting;
-
- if (wasCompatiblePainting)
- painter->setRenderHint(QPainter::Qt4CompatiblePainting, false);
-
adjustUnderlines();
drawItemDecorationList(painter, underlineList);
drawItemDecorationList(painter, strikeOutList);
@@ -3674,9 +3668,6 @@ void QTextEngine::drawDecorations(QPainter *painter)
clearDecorations();
- if (wasCompatiblePainting)
- painter->setRenderHint(QPainter::Qt4CompatiblePainting);
-
painter->setPen(oldPen);
}
diff --git a/src/opengl/qopenglpaintengine.cpp b/src/opengl/qopenglpaintengine.cpp
index a3f0a0ca02..3bb3496de5 100644
--- a/src/opengl/qopenglpaintengine.cpp
+++ b/src/opengl/qopenglpaintengine.cpp
@@ -1364,7 +1364,7 @@ void QOpenGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
return;
QOpenGL2PaintEngineState *s = state();
- if (qt_pen_is_cosmetic(pen, state()->renderHints) && !qt_scaleForTransform(s->transform(), nullptr)) {
+ if (pen.isCosmetic() && !qt_scaleForTransform(s->transform(), nullptr)) {
// QTriangulatingStroker class is not meant to support cosmetically sheared strokes.
QPaintEngineEx::stroke(path, pen);
return;
@@ -1426,7 +1426,7 @@ void QOpenGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &p
? qMax(pen.miterLimit() * width, width)
: width;
- if (qt_pen_is_cosmetic(pen, q->state()->renderHints))
+ if (pen.isCosmetic())
extra = extra * inverseScale;
QRectF bounds = path.controlPointRect().adjusted(-extra, -extra, extra, extra);
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
index 028344a37d..9ff107e7df 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
@@ -546,7 +546,7 @@ public:
if (newPen.widthF() == 0)
props.transformType = D2D1_STROKE_TRANSFORM_TYPE_HAIRLINE;
- else if (qt_pen_is_cosmetic(newPen, q->state()->renderHints))
+ else if (newPen.isCosmetic())
props.transformType = D2D1_STROKE_TRANSFORM_TYPE_FIXED;
else
props.transformType = D2D1_STROKE_TRANSFORM_TYPE_NORMAL;
diff --git a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp
index e69030ca97..ef22efa164 100644
--- a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp
+++ b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp
@@ -150,17 +150,11 @@ public:
|| (render_hints & QPainter::Antialiasing);
}
void decideCoordAdjust() {
- adjust_coords = !(render_hints & QPainter::Antialiasing)
- && (render_hints & QPainter::Qt4CompatiblePainting)
- && (has_alpha_pen
- || (has_alpha_brush && has_pen && !has_alpha_pen)
- || (cpen.style() > Qt::SolidLine));
+ adjust_coords = false;
}
void clipPolygon_dev(const QPolygonF &poly, QPolygonF *clipped_poly);
void systemStateChanged() override;
inline bool isCosmeticPen() const {
- if ((render_hints & QPainter::Qt4CompatiblePainting) && cpen == QPen())
- return true;
return cpen.isCosmetic();
}
diff --git a/src/printsupport/kernel/qpaintengine_alpha.cpp b/src/printsupport/kernel/qpaintengine_alpha.cpp
index 8106db4edb..05a774656b 100644
--- a/src/printsupport/kernel/qpaintengine_alpha.cpp
+++ b/src/printsupport/kernel/qpaintengine_alpha.cpp
@@ -413,7 +413,7 @@ QRectF QAlphaPaintEnginePrivate::addPenWidth(const QPainterPath &path)
if (m_pen.style() == Qt::NoPen)
return (path.controlPointRect() * m_transform).boundingRect();
- bool cosmetic = qt_pen_is_cosmetic(m_pen, q->state->renderHints());
+ bool cosmetic = m_pen.isCosmetic();
if (cosmetic)
tmp = path * m_transform;
diff --git a/src/printsupport/platform/macos/qpaintengine_mac.mm b/src/printsupport/platform/macos/qpaintengine_mac.mm
index fd82539df6..f2edf4867b 100644
--- a/src/printsupport/platform/macos/qpaintengine_mac.mm
+++ b/src/printsupport/platform/macos/qpaintengine_mac.mm
@@ -499,7 +499,7 @@ QCoreGraphicsPaintEngine::updateState(const QPaintEngineState &state)
updateCompositionMode(state.compositionMode());
if (flags & (DirtyPen | DirtyTransform | DirtyHints)) {
- if (!qt_pen_is_cosmetic(d->current.pen, state.renderHints())) {
+ if (!d->current.pen.isCosmetic()) {
d->cosmeticPen = QCoreGraphicsPaintEnginePrivate::CosmeticNone;
} else if (d->current.transform.m11() < d->current.transform.m22()-1.0 ||
d->current.transform.m11() > d->current.transform.m22()+1.0) {
diff --git a/src/printsupport/platform/windows/qprintengine_win.cpp b/src/printsupport/platform/windows/qprintengine_win.cpp
index 017d99300d..fea8c12e65 100644
--- a/src/printsupport/platform/windows/qprintengine_win.cpp
+++ b/src/printsupport/platform/windows/qprintengine_win.cpp
@@ -765,7 +765,7 @@ void QWin32PrintEnginePrivate::strokePath(const QPainterPath &path, const QColor
QPainterPath stroke;
qreal width = pen.widthF();
- bool cosmetic = qt_pen_is_cosmetic(pen, q->state->renderHints());
+ bool cosmetic = pen.isCosmetic();
if (pen.style() == Qt::SolidLine && (cosmetic || matrix.type() < QTransform::TxScale)) {
strokePath_dev(path * matrix, color, width);
} else {
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 3d447671df..0594213e06 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -213,10 +213,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
if (opt->state & (State_Sunken | State_On)) {
ir.adjust(2, 2, -2, -2);
p->setBrush(opt->palette.windowText());
- bool oldQt4CompatiblePainting = p->testRenderHint(QPainter::Qt4CompatiblePainting);
- p->setRenderHint(QPainter::Qt4CompatiblePainting);
p->drawEllipse(ir);
- p->setRenderHint(QPainter::Qt4CompatiblePainting, oldQt4CompatiblePainting);
}
break; }
case PE_FrameFocusRect:
@@ -570,7 +567,6 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
p->translate(sx + bsx, sy + bsy);
p->setPen(opt->palette.buttonText().color());
p->setBrush(opt->palette.buttonText());
- p->setRenderHint(QPainter::Qt4CompatiblePainting);
if (pe == PE_IndicatorSpinDown) {
const QPoint points[] = { QPoint(0, 1), QPoint(sw-1, 1), QPoint(sh-2, sh-1) };
p->drawPolygon(points, sizeof points / sizeof *points);
@@ -788,7 +784,6 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
imagePainter.translate(sx + bsx, sy + bsy);
imagePainter.setPen(opt->palette.buttonText().color());
imagePainter.setBrush(opt->palette.buttonText());
- imagePainter.setRenderHint(QPainter::Qt4CompatiblePainting);
if (!(opt->state & State_Enabled)) {
imagePainter.translate(1, 1);
@@ -1769,8 +1764,6 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
case CE_ToolBoxTabShape:
if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
p->setPen(tb->palette.mid().color().darker(150));
- bool oldQt4CompatiblePainting = p->testRenderHint(QPainter::Qt4CompatiblePainting);
- p->setRenderHint(QPainter::Qt4CompatiblePainting);
int d = 20 + tb->rect.height() - 3;
if (tb->direction != Qt::RightToLeft) {
const QPoint points[] = {
@@ -1795,7 +1788,6 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
};
p->drawPolygon(points, sizeof points / sizeof *points);
}
- p->setRenderHint(QPainter::Qt4CompatiblePainting, oldQt4CompatiblePainting);
p->setPen(tb->palette.light().color());
if (tb->direction != Qt::RightToLeft) {
p->drawLine(0, 2, tb->rect.width() - d, 2);
@@ -3735,7 +3727,6 @@ void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCompl
p->setPen(Qt::NoPen);
p->setBrush(pal.button());
- p->setRenderHint(QPainter::Qt4CompatiblePainting);
p->drawPolygon(arrow.cbegin(), arrow.size());
a = QStyleHelper::angle(QPointF(width / 2, height / 2), arrow[0]);
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index 28a195bba8..02188c5b29 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -2034,10 +2034,8 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
}
QBrush oldBrush = p->brush();
- bool oldQt4CompatiblePainting = p->testRenderHint(QPainter::Qt4CompatiblePainting);
p->setPen(Qt::NoPen);
p->setBrush(handleBrush);
- p->setRenderHint(QPainter::Qt4CompatiblePainting);
Qt::BGMode oldMode = p->backgroundMode();
p->setBackgroundMode(Qt::OpaqueMode);
p->drawRect(x1, y1, x2-x1+1, y2-y1+1);
@@ -2120,7 +2118,6 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
p->drawLine(x2, y2-1, x2+d, y2-1-d);
break;
}
- p->setRenderHint(QPainter::Qt4CompatiblePainting, oldQt4CompatiblePainting);
}
}
break;
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index 6b58994daf..c777a90282 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -792,7 +792,6 @@ void tst_QPainter::drawLine()
{ // unclipped
pixmapUnclipped.fill(Qt::white);
QPainter p(&pixmapUnclipped);
- p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.translate(offset, offset);
p.setPen(QPen(Qt::black));
p.drawLine(line);
@@ -819,7 +818,6 @@ void tst_QPainter::drawLine()
pixmapClipped.fill(Qt::white);
QPainter p(&pixmapClipped);
- p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.translate(offset, offset);
p.setClipRect(clip);
p.setPen(QPen(Qt::black));
@@ -856,7 +854,6 @@ void tst_QPainter::drawLine_task121143()
image.fill(0xffffffff);
QPainter p(&image);
p.setPen(pen);
- p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.drawLine(QLine(0, 0+4, 0+4, 0));
p.end();
@@ -1037,7 +1034,6 @@ void tst_QPainter::drawRect2()
QTransform transform(0.368567, 0, 0, 0, 0.368567, 0, 0.0289, 0.0289, 1);
QPainter p(&image);
- p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.setTransform(transform);
p.setBrush(Qt::red);
p.setPen(Qt::NoPen);
@@ -1048,13 +1044,12 @@ void tst_QPainter::drawRect2()
image.fill(0xffffffff);
p.begin(&image);
- p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.setTransform(transform);
p.drawRect(QRect(14, 14, 39, 39));
p.end();
QRect stroke = getPaintedSize(image, Qt::white);
- QCOMPARE(stroke.adjusted(1, 1, 0, 0), fill.adjusted(0, 0, 1, 1));
+ QCOMPARE(stroke.adjusted(1, 1, 0, 0), fill.adjusted(1, 1, 0, 0));
}
}
@@ -1264,13 +1259,13 @@ void tst_QPainter::drawPath_data()
{
QPainterPath p;
p.addRect(2.25, 2.25, 10, 10);
- QTest::newRow("non-aligned rect") << p << QRect(3, 3, 10, 10) << 10 * 10;
+ QTest::newRow("non-aligned rect") << p << QRect(2, 2, 10, 10) << 10 * 10;
}
{
QPainterPath p;
p.addRect(2.25, 2.25, 10.5, 10.5);
- QTest::newRow("non-aligned rect 2") << p << QRect(3, 3, 10, 10) << 10 * 10;
+ QTest::newRow("non-aligned rect 2") << p << QRect(2, 2, 11, 11) << 11 * 11;
}
{
@@ -1308,7 +1303,6 @@ void tst_QPainter::drawPath()
image.fill(QColor(Qt::white).rgb());
QPainter p(&image);
- p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.setPen(Qt::NoPen);
p.setBrush(Qt::black);
p.translate(offset - expectedBounds.left(), offset - expectedBounds.top());
@@ -1536,7 +1530,6 @@ void tst_QPainter::drawRoundedRect()
{
pixmap.fill(Qt::white);
QPainter p(&pixmap);
- p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.setPen(usePen ? QPen(Qt::black) : QPen(Qt::NoPen));
p.setBrush(Qt::black);
p.drawRoundedRect(rect, 25, 25, Qt::RelativeSize);
@@ -1613,9 +1606,8 @@ void tst_QPainter::setWindow()
pixmap.fill(QColor(Qt::white));
QPainter painter(&pixmap);
- painter.setRenderHint(QPainter::Qt4CompatiblePainting);
- painter.setWindow(0, 0, 3, 3);
- painter.drawLine(1, 1, 2, 2);
+ painter.setWindow(0, 0, 28, 28);
+ painter.drawLine(10, 10, 18, 18);
const QRect painted = getPaintedSize(pixmap, Qt::white);
QVERIFY(195 < painted.y() && painted.y() < 205); // correct value is around 200
@@ -4594,7 +4586,6 @@ void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053()
baseLine.fill(Qt::white);
{
QPainter p(&baseLine);
- p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.drawText(0, fm.ascent(), QString::fromLatin1("e"));
}
@@ -4605,7 +4596,6 @@ void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053()
{
QPainter p(&comparison);
- p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.drawText(QPointF(i / 12.0, fm.ascent()), QString::fromLatin1("e"));
}