Remove Qt4Compatible painting

Change-Id: Ie54206ca9b509875568f2158e229fca9cb1860a2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2020-11-10 12:34:22 +01:00
parent 85fe4c8983
commit 94dd2cebdc
23 changed files with 49 additions and 166 deletions

View File

@ -290,7 +290,7 @@ void QCosmeticStroker::setup()
qreal width = state->lastPen.widthF(); qreal width = state->lastPen.widthF();
if (width == 0) if (width == 0)
opacity = 256; opacity = 256;
else if (qt_pen_is_cosmetic(state->lastPen, state->renderHints)) else if (state->lastPen.isCosmetic())
opacity = (int) 256*width; opacity = (int) 256*width;
else else
opacity = (int) 256*width*state->txscale; 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)) if (clipLine(rx1, ry1, rx2, ry2))
return; return;
const int half = legacyRounding ? 31 : 0; int x1 = toF26Dot6(rx1);
int x1 = toF26Dot6(rx1) + half; int y1 = toF26Dot6(ry1);
int y1 = toF26Dot6(ry1) + half; int x2 = toF26Dot6(rx2);
int x2 = toF26Dot6(rx2) + half; int y2 = toF26Dot6(ry2);
int y2 = toF26Dot6(ry2) + half;
int dx = qAbs(x2 - x1); int dx = qAbs(x2 - x1);
int dy = qAbs(y2 - y1); 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)) if (stroker->clipLine(rx1, ry1, rx2, ry2))
return true; return true;
const int half = stroker->legacyRounding ? 31 : 0; int x1 = toF26Dot6(rx1);
int x1 = toF26Dot6(rx1) + half; int y1 = toF26Dot6(ry1);
int y1 = toF26Dot6(ry1) + half; int x2 = toF26Dot6(rx2);
int x2 = toF26Dot6(rx2) + half; int y2 = toF26Dot6(ry2);
int y2 = toF26Dot6(ry2) + half;
int dx = qAbs(x2 - x1); int dx = qAbs(x2 - x1);
int dy = qAbs(y2 - y1); int dy = qAbs(y2 - y1);

View File

@ -103,7 +103,6 @@ public:
patternSize(0), patternSize(0),
patternLength(0), patternLength(0),
patternOffset(0), patternOffset(0),
legacyRounding(false),
current_span(0), current_span(0),
lastDir(NoDirection), lastDir(NoDirection),
lastAxisAligned(false) lastAxisAligned(false)
@ -111,8 +110,6 @@ public:
~QCosmeticStroker() { free(pattern); free(reversePattern); } ~QCosmeticStroker() { free(pattern); free(reversePattern); }
void setLegacyRoundingEnabled(bool legacyRoundingEnabled) { legacyRounding = legacyRoundingEnabled; }
void drawLine(const QPointF &p1, const QPointF &p2); void drawLine(const QPointF &p1, const QPointF &p2);
void drawPath(const QVectorPath &path); void drawPath(const QVectorPath &path);
void drawPoints(const QPoint *points, int num); void drawPoints(const QPoint *points, int num);
@ -135,8 +132,6 @@ public:
int patternLength; int patternLength;
int patternOffset; int patternOffset;
bool legacyRounding;
enum { NSPANS = 255 }; enum { NSPANS = 255 };
QT_FT_Span spans[NSPANS]; QT_FT_Span spans[NSPANS];
int current_span; int current_span;

View File

@ -449,7 +449,7 @@ void QPaintEngine::drawPoints(const QPointF *points, int pointCount)
p->save(); p->save();
QTransform transform; QTransform transform;
if (qt_pen_is_cosmetic(p->pen(), p->renderHints())) { if (p->pen().isCosmetic()) {
transform = p->transform(); transform = p->transform();
p->setTransform(QTransform()); p->setTransform(QTransform());
} }

View File

@ -583,7 +583,6 @@ QRasterPaintEngineState::QRasterPaintEngineState()
flags.non_complex_pen = false; flags.non_complex_pen = false;
flags.antialiased = false; flags.antialiased = false;
flags.bilinear = false; flags.bilinear = false;
flags.legacy_rounding = false;
flags.fast_text = true; flags.fast_text = true;
flags.int_xform = true; flags.int_xform = true;
flags.tx_noshear = true; flags.tx_noshear = true;
@ -716,7 +715,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen)
} else if (pen_style != Qt::NoPen) { } else if (pen_style != Qt::NoPen) {
if (!d->dashStroker) if (!d->dashStroker)
d->dashStroker.reset(new QDashStroker(&d->basicStroker)); d->dashStroker.reset(new QDashStroker(&d->basicStroker));
if (qt_pen_is_cosmetic(pen, s->renderHints)) { if (pen.isCosmetic()) {
d->dashStroker->setClipRect(d->deviceRect); d->dashStroker->setClipRect(d->deviceRect);
} else { } else {
// ### I've seen this inverted devrect multiple places now... // ### 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... 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->flags.fast_pen = pen_style > Qt::NoPen
&& s->penData.blend && s->penData.blend
&& ((cosmetic && penWidth <= 1) && ((cosmetic && penWidth <= 1)
@ -874,7 +873,6 @@ void QRasterPaintEngine::renderHintsChanged()
s->flags.antialiased = bool(s->renderHints & QPainter::Antialiasing); s->flags.antialiased = bool(s->renderHints & QPainter::Antialiasing);
s->flags.bilinear = bool(s->renderHints & QPainter::SmoothPixmapTransform); 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) if (was_aa != s->flags.antialiased)
s->strokeFlags |= DirtyHints; s->strokeFlags |= DirtyHints;
@ -1544,7 +1542,6 @@ void QRasterPaintEngine::drawRects(const QRect *rects, int rectCount)
QRectVectorPath path; QRectVectorPath path;
if (s->flags.fast_pen) { if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i = 0; i < rectCount; ++i) { for (int i = 0; i < rectCount; ++i) {
path.set(rects[i]); path.set(rects[i]);
stroker.drawPath(path); stroker.drawPath(path);
@ -1591,7 +1588,6 @@ void QRasterPaintEngine::drawRects(const QRectF *rects, int rectCount)
QRectVectorPath path; QRectVectorPath path;
if (s->flags.fast_pen) { if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i = 0; i < rectCount; ++i) { for (int i = 0; i < rectCount; ++i) {
path.set(rects[i]); path.set(rects[i]);
stroker.drawPath(path); stroker.drawPath(path);
@ -1625,10 +1621,9 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
if (s->flags.fast_pen) { if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPath(path); stroker.drawPath(path);
} else if (s->flags.non_complex_pen && path.shape() == QVectorPath::LinesHint) { } 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) == 0 ? 1 : qpen_widthf(s->lastPen))
: qpen_widthf(s->lastPen) * s->txscale; : qpen_widthf(s->lastPen) * s->txscale;
int dashIndex = 0; int dashIndex = 0;
@ -1688,12 +1683,10 @@ QRect QRasterPaintEngine::toNormalizedFillRect(const QRectF &rect)
{ {
QRasterPaintEngineState *s = state(); QRasterPaintEngineState *s = state();
qreal delta = s->flags.legacy_rounding ? aliasedCoordinateDelta : qreal(0); int x1 = qRound(rect.x());
int y1 = qRound(rect.y());
int x1 = qRound(rect.x() + delta); int x2 = qRound(rect.right());
int y1 = qRound(rect.y() + delta); int y2 = qRound(rect.bottom());
int x2 = qRound(rect.right() + delta);
int y2 = qRound(rect.bottom() + delta);
if (x2 < x1) if (x2 < x1)
qSwap(x1, x2); 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)); QVectorPath vp((const qreal *) points, pointCount, nullptr, QVectorPath::polygonFlags(mode));
if (s->flags.fast_pen) { if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPath(vp); stroker.drawPath(vp);
} else { } else {
QPaintEngineEx::stroke(vp, s->lastPen); QPaintEngineEx::stroke(vp, s->lastPen);
@ -2041,7 +2033,6 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg
if (s->flags.fast_pen) { if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPath(vp); stroker.drawPath(vp);
} else { } else {
QPaintEngineEx::stroke(vp, s->lastPen); 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 // subtract it here as we don't use it for image drawing
QTransform old = s->matrix; 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. // Do whatever fillRect() does, but without premultiplying the color if it's already premultiplied.
QRgb color = img.pixel(sr_l, sr_t); QRgb color = img.pixel(sr_l, sr_t);
switch (img.format()) { 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) { if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
d->initializeRasterizer(&d->image_filler_xform); d->initializeRasterizer(&d->image_filler_xform);
d->rasterizer->setAntialiased(s->flags.antialiased); 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 QRectF &rect = r.normalized();
const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 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) - offs; const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f);
if (s->flags.tx_noshear) if (s->flags.tx_noshear)
d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); 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; return;
} }
#endif #endif
const qreal offs = s->flags.legacy_rounding ? aliasedCoordinateDelta : qreal(0);
QPainterPath path; QPainterPath path;
path.addRect(r); path.addRect(r);
QTransform m = s->matrix; QTransform m = s->matrix;
s->matrix = QTransform(m.m11(), m.m12(), m.m13(), s->matrix = QTransform(m.m11(), m.m12(), m.m13(),
m.m21(), m.m22(), m.m23(), 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); fillPath(path, &d->image_filler_xform);
s->matrix = m; s->matrix = m;
} else { } else {
@ -2553,7 +2537,6 @@ void QRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap,
if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) { if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
d->initializeRasterizer(&d->image_filler_xform); d->initializeRasterizer(&d->image_filler_xform);
d->rasterizer->setAntialiased(s->flags.antialiased); d->rasterizer->setAntialiased(s->flags.antialiased);
d->rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding);
const QRectF &rect = r.normalized(); const QRectF &rect = r.normalized();
const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f); 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); QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPoints(points, pointCount); stroker.drawPoints(points, pointCount);
} }
@ -3214,7 +3196,6 @@ void QRasterPaintEngine::drawPoints(const QPoint *points, int pointCount)
} }
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
stroker.drawPoints(points, pointCount); stroker.drawPoints(points, pointCount);
} }
@ -3235,7 +3216,6 @@ void QRasterPaintEngine::drawLines(const QLine *lines, int lineCount)
if (s->flags.fast_pen) { if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i=0; i<lineCount; ++i) { for (int i=0; i<lineCount; ++i) {
const QLine &l = lines[i]; const QLine &l = lines[i];
stroker.drawLine(l.p1(), l.p2()); stroker.drawLine(l.p1(), l.p2());
@ -3307,7 +3287,6 @@ void QRasterPaintEngine::drawLines(const QLineF *lines, int lineCount)
return; return;
if (s->flags.fast_pen) { if (s->flags.fast_pen) {
QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding);
for (int i=0; i<lineCount; ++i) { for (int i=0; i<lineCount; ++i) {
QLineF line = lines[i]; QLineF line = lines[i];
stroker.drawLine(line.p1(), line.p2()); stroker.drawLine(line.p1(), line.p2());
@ -3554,7 +3533,6 @@ void QRasterPaintEnginePrivate::initializeRasterizer(QSpanData *data)
QRasterPaintEngineState *s = q->state(); QRasterPaintEngineState *s = q->state();
rasterizer->setAntialiased(s->flags.antialiased); rasterizer->setAntialiased(s->flags.antialiased);
rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding);
QRect clipRect(deviceRect); QRect clipRect(deviceRect);
ProcessSpans blend; ProcessSpans blend;
@ -3619,7 +3597,6 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
if (!s->flags.antialiased) { if (!s->flags.antialiased) {
rasterizer->setAntialiased(s->flags.antialiased); rasterizer->setAntialiased(s->flags.antialiased);
rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding);
rasterizer->setClipRect(deviceRect); rasterizer->setClipRect(deviceRect);
rasterizer->initialize(callback, userData); rasterizer->initialize(callback, userData);

View File

@ -109,7 +109,6 @@ public:
uint non_complex_pen : 1; // can use rasterizer, rather than stroker uint non_complex_pen : 1; // can use rasterizer, rather than stroker
uint antialiased : 1; uint antialiased : 1;
uint bilinear : 1; uint bilinear : 1;
uint legacy_rounding : 1;
uint fast_text : 1; uint fast_text : 1;
uint int_xform : 1; uint int_xform : 1;
uint tx_noshear : 1; uint tx_noshear : 1;

View File

@ -431,7 +431,7 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
} }
if (pen.style() > Qt::SolidLine) { if (pen.style() > Qt::SolidLine) {
if (qt_pen_is_cosmetic(pen, state()->renderHints)){ if (pen.isCosmetic()) {
d->activeStroker->setClipRect(d->exDeviceRect); d->activeStroker->setClipRect(d->exDeviceRect);
} else { } else {
QRectF clipRect = state()->matrix.inverted().mapRect(QRectF(d->exDeviceRect)); 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; flags |= QVectorPath::CurvedShapeMask;
// ### Perspective Xforms are currently not supported... // ### 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 // We include cosmetic pens in this case to avoid having to
// change the current transform. Normal transformed, // change the current transform. Normal transformed,
// non-cosmetic pens will be transformed as part of fill // non-cosmetic pens will be transformed as part of fill

View File

@ -1429,11 +1429,6 @@ void QPainterPrivate::updateState(QPainterState *newState)
a smooth pixmap transformation algorithm (such as bilinear) rather a smooth pixmap transformation algorithm (such as bilinear) rather
than nearest neighbor. 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. \value LosslessImageRendering Use a lossless image rendering, whenever possible.
Currently, this hint is only used when QPainter is employed to output a PDF Currently, this hint is only used when QPainter is employed to output a PDF
file through QPrinter or QPdfWriter, where drawImage()/drawPixmap() calls 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()); 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(); const qreal underlineOffset = fe->underlinePosition().toReal();
if (underlineStyle == QTextCharFormat::SpellCheckUnderline) { if (underlineStyle == QTextCharFormat::SpellCheckUnderline) {
@ -6081,9 +6070,6 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
painter->setPen(oldPen); painter->setPen(oldPen);
painter->setBrush(oldBrush); painter->setBrush(oldBrush);
if (wasCompatiblePainting)
painter->setRenderHint(QPainter::Qt4CompatiblePainting);
} }
static void qt_draw_decoration_for_glyphs(QPainter *painter, static void qt_draw_decoration_for_glyphs(QPainter *painter,

View File

@ -87,7 +87,6 @@ public:
Antialiasing = 0x01, Antialiasing = 0x01,
TextAntialiasing = 0x02, TextAntialiasing = 0x02,
SmoothPixmapTransform = 0x04, SmoothPixmapTransform = 0x04,
Qt4CompatiblePainting = 0x20,
LosslessImageRendering = 0x40, LosslessImageRendering = 0x40,
}; };
Q_FLAG(RenderHint) Q_FLAG(RenderHint)

View File

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

View File

@ -657,7 +657,7 @@ void QPdf::Stroker::setPen(const QPen &pen, QPainter::RenderHints hints)
} }
qreal w = pen.widthF(); qreal w = pen.widthF();
bool zeroWidth = w < 0.0001; bool zeroWidth = w < 0.0001;
cosmeticPen = qt_pen_is_cosmetic(pen, hints); cosmeticPen = pen.isCosmetic();
if (zeroWidth) if (zeroWidth)
w = .1; w = .1;
@ -1137,7 +1137,7 @@ void QPdfEngine::updateState(const QPaintEngineState &state)
d->hasPen = d->pen.style() != Qt::NoPen; d->hasPen = d->pen.style() != Qt::NoPen;
d->stroker.setPen(d->pen, state.renderHints()); d->stroker.setPen(d->pen, state.renderHints());
QBrush penBrush = d->pen.brush(); QBrush penBrush = d->pen.brush();
bool cosmeticPen = qt_pen_is_cosmetic(d->pen, state.renderHints()); bool cosmeticPen = d->pen.isCosmetic();
bool oldSimple = d->simplePen; bool oldSimple = d->simplePen;
d->simplePen = (d->hasPen && !cosmeticPen && (penBrush.style() == Qt::SolidPattern) && penBrush.isOpaque() && d->opacity == 1.0); d->simplePen = (d->hasPen && !cosmeticPen && (penBrush.style() == Qt::SolidPattern) && penBrush.isOpaque() && d->opacity == 1.0);
if (oldSimple != d->simplePen) if (oldSimple != d->simplePen)

View File

@ -137,7 +137,7 @@ public:
~QScanConverter(); ~QScanConverter();
void begin(int top, int bottom, int left, int right, 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 end();
void mergeCurve(const QT_FT_Vector &a, const QT_FT_Vector &b, void mergeCurve(const QT_FT_Vector &a, const QT_FT_Vector &b,
@ -185,7 +185,6 @@ private:
QScFixed m_rightFP; QScFixed m_rightFP;
int m_fillRuleMask; int m_fillRuleMask;
bool m_legacyRounding;
int m_x; int m_x;
int m_y; int m_y;
@ -205,7 +204,6 @@ class QRasterizerPrivate
{ {
public: public:
bool antialiased; bool antialiased;
bool legacyRounding;
ProcessSpans blend; ProcessSpans blend;
void *data; void *data;
QRect clipRect; QRect clipRect;
@ -229,7 +227,7 @@ QScanConverter::~QScanConverter()
} }
void QScanConverter::begin(int top, int bottom, int left, int right, void QScanConverter::begin(int top, int bottom, int left, int right,
Qt::FillRule fillRule, bool legacyRounding, Qt::FillRule fillRule,
QSpanBuffer *spanBuffer) QSpanBuffer *spanBuffer)
{ {
m_top = top; m_top = top;
@ -240,7 +238,6 @@ void QScanConverter::begin(int top, int bottom, int left, int right,
m_lines.reset(); m_lines.reset();
m_fillRuleMask = fillRule == Qt::WindingFill ? ~0x0 : 0x1; m_fillRuleMask = fillRule == Qt::WindingFill ? ~0x0 : 0x1;
m_legacyRounding = legacyRounding;
m_spanBuffer = spanBuffer; m_spanBuffer = spanBuffer;
} }
@ -596,20 +593,11 @@ void QScanConverter::mergeLine(QT_FT_Vector a, QT_FT_Vector b)
winding = -1; winding = -1;
} }
if (m_legacyRounding) { int iTop = qMax(m_top, int((a.y + 32) >> 6));
a.x += COORD_OFFSET; int iBottom = qMin(m_bottom, int((b.y - 32) >> 6));
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));
if (iTop <= iBottom) { if (iTop <= iBottom) {
QScFixed aFP = QScFixedFactor/2 + FTPosToQScFixed(a.x - rounding); QScFixed aFP = QScFixedFactor/2 + FTPosToQScFixed(a.x);
if (b.x == a.x) { if (b.x == a.x) {
Line line = { qBound(m_leftFP, aFP, m_rightFP), 0, iTop, iBottom, winding }; 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() QRasterizer::QRasterizer()
: d(new QRasterizerPrivate) : d(new QRasterizerPrivate)
{ {
d->legacyRounding = false;
} }
QRasterizer::~QRasterizer() QRasterizer::~QRasterizer()
@ -664,11 +651,6 @@ void QRasterizer::setClipRect(const QRect &clipRect)
d->clipRect = 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) static QScFixed intersectPixelFP(int x, QScFixed top, QScFixed bottom, QScFixed leftIntersectX, QScFixed rightIntersectX, QScFixed slope, QScFixed invSlope)
{ {
QScFixed leftX = IntToQScFixed(x); QScFixed leftX = IntToQScFixed(x);
@ -803,13 +785,6 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
pb = npb; 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 // old delta
const QPointF d0 = a - b; 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); 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) >> 6));
int iBottomBound = qMin(d->clipRect.bottom(), int((max_y - 32) >> 6));
int iTopBound = qMax(d->clipRect.top(), int((min_y + 32 + rounding) >> 6));
int iBottomBound = qMin(d->clipRect.bottom(), int((max_y - 32 + rounding) >> 6));
if (iTopBound > iBottomBound) if (iTopBound > iBottomBound)
return; 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; int first = 0;
for (int i = 0; i < outline->n_contours; ++i) { 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(); 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));
int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - 0.5));
int iTopBound = qMax(d->clipRect.top(), int(bounds.top() + 0.5 + rounding));
int iBottomBound = qMin(d->clipRect.bottom(), int(bounds.bottom() - 0.5 + rounding));
if (iTopBound > iBottomBound) if (iTopBound > iBottomBound)
return; 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; int subpathStart = 0;
QT_FT_Vector last = { 0, 0 }; QT_FT_Vector last = { 0, 0 };

View File

@ -72,7 +72,6 @@ public:
void setAntialiased(bool antialiased); void setAntialiased(bool antialiased);
void setClipRect(const QRect &clipRect); void setClipRect(const QRect &clipRect);
void setLegacyRoundingEnabled(bool legacyRoundingEnabled);
void initialize(ProcessSpans blend, void *data); void initialize(ProcessSpans blend, void *data);

View File

@ -94,7 +94,7 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen, co
m_width = realWidth / 2; m_width = realWidth / 2;
bool cosmetic = qt_pen_is_cosmetic(pen, hints); bool cosmetic = pen.isCosmetic();
if (cosmetic) { if (cosmetic) {
m_width = m_width * m_inv_scale; 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(); const QPainterPath::ElementType *types = path.elements();
int count = path.elementCount(); int count = path.elementCount();
bool cosmetic = qt_pen_is_cosmetic(pen, hints); bool cosmetic = pen.isCosmetic();
bool implicitClose = path.hasImplicitClose(); bool implicitClose = path.hasImplicitClose();
m_points.reset(); m_points.reset();

View File

@ -3661,12 +3661,6 @@ void QTextEngine::drawDecorations(QPainter *painter)
{ {
QPen oldPen = painter->pen(); QPen oldPen = painter->pen();
bool wasCompatiblePainting = painter->renderHints()
& QPainter::Qt4CompatiblePainting;
if (wasCompatiblePainting)
painter->setRenderHint(QPainter::Qt4CompatiblePainting, false);
adjustUnderlines(); adjustUnderlines();
drawItemDecorationList(painter, underlineList); drawItemDecorationList(painter, underlineList);
drawItemDecorationList(painter, strikeOutList); drawItemDecorationList(painter, strikeOutList);
@ -3674,9 +3668,6 @@ void QTextEngine::drawDecorations(QPainter *painter)
clearDecorations(); clearDecorations();
if (wasCompatiblePainting)
painter->setRenderHint(QPainter::Qt4CompatiblePainting);
painter->setPen(oldPen); painter->setPen(oldPen);
} }

View File

@ -1364,7 +1364,7 @@ void QOpenGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
return; return;
QOpenGL2PaintEngineState *s = state(); 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. // QTriangulatingStroker class is not meant to support cosmetically sheared strokes.
QPaintEngineEx::stroke(path, pen); QPaintEngineEx::stroke(path, pen);
return; return;
@ -1426,7 +1426,7 @@ void QOpenGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &p
? qMax(pen.miterLimit() * width, width) ? qMax(pen.miterLimit() * width, width)
: width; : width;
if (qt_pen_is_cosmetic(pen, q->state()->renderHints)) if (pen.isCosmetic())
extra = extra * inverseScale; extra = extra * inverseScale;
QRectF bounds = path.controlPointRect().adjusted(-extra, -extra, extra, extra); QRectF bounds = path.controlPointRect().adjusted(-extra, -extra, extra, extra);

View File

@ -546,7 +546,7 @@ public:
if (newPen.widthF() == 0) if (newPen.widthF() == 0)
props.transformType = D2D1_STROKE_TRANSFORM_TYPE_HAIRLINE; 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; props.transformType = D2D1_STROKE_TRANSFORM_TYPE_FIXED;
else else
props.transformType = D2D1_STROKE_TRANSFORM_TYPE_NORMAL; props.transformType = D2D1_STROKE_TRANSFORM_TYPE_NORMAL;

View File

@ -150,17 +150,11 @@ public:
|| (render_hints & QPainter::Antialiasing); || (render_hints & QPainter::Antialiasing);
} }
void decideCoordAdjust() { void decideCoordAdjust() {
adjust_coords = !(render_hints & QPainter::Antialiasing) adjust_coords = false;
&& (render_hints & QPainter::Qt4CompatiblePainting)
&& (has_alpha_pen
|| (has_alpha_brush && has_pen && !has_alpha_pen)
|| (cpen.style() > Qt::SolidLine));
} }
void clipPolygon_dev(const QPolygonF &poly, QPolygonF *clipped_poly); void clipPolygon_dev(const QPolygonF &poly, QPolygonF *clipped_poly);
void systemStateChanged() override; void systemStateChanged() override;
inline bool isCosmeticPen() const { inline bool isCosmeticPen() const {
if ((render_hints & QPainter::Qt4CompatiblePainting) && cpen == QPen())
return true;
return cpen.isCosmetic(); return cpen.isCosmetic();
} }

View File

@ -413,7 +413,7 @@ QRectF QAlphaPaintEnginePrivate::addPenWidth(const QPainterPath &path)
if (m_pen.style() == Qt::NoPen) if (m_pen.style() == Qt::NoPen)
return (path.controlPointRect() * m_transform).boundingRect(); return (path.controlPointRect() * m_transform).boundingRect();
bool cosmetic = qt_pen_is_cosmetic(m_pen, q->state->renderHints()); bool cosmetic = m_pen.isCosmetic();
if (cosmetic) if (cosmetic)
tmp = path * m_transform; tmp = path * m_transform;

View File

@ -499,7 +499,7 @@ QCoreGraphicsPaintEngine::updateState(const QPaintEngineState &state)
updateCompositionMode(state.compositionMode()); updateCompositionMode(state.compositionMode());
if (flags & (DirtyPen | DirtyTransform | DirtyHints)) { if (flags & (DirtyPen | DirtyTransform | DirtyHints)) {
if (!qt_pen_is_cosmetic(d->current.pen, state.renderHints())) { if (!d->current.pen.isCosmetic()) {
d->cosmeticPen = QCoreGraphicsPaintEnginePrivate::CosmeticNone; d->cosmeticPen = QCoreGraphicsPaintEnginePrivate::CosmeticNone;
} else if (d->current.transform.m11() < d->current.transform.m22()-1.0 || } else if (d->current.transform.m11() < d->current.transform.m22()-1.0 ||
d->current.transform.m11() > d->current.transform.m22()+1.0) { d->current.transform.m11() > d->current.transform.m22()+1.0) {

View File

@ -765,7 +765,7 @@ void QWin32PrintEnginePrivate::strokePath(const QPainterPath &path, const QColor
QPainterPath stroke; QPainterPath stroke;
qreal width = pen.widthF(); 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)) { if (pen.style() == Qt::SolidLine && (cosmetic || matrix.type() < QTransform::TxScale)) {
strokePath_dev(path * matrix, color, width); strokePath_dev(path * matrix, color, width);
} else { } else {

View File

@ -213,10 +213,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
if (opt->state & (State_Sunken | State_On)) { if (opt->state & (State_Sunken | State_On)) {
ir.adjust(2, 2, -2, -2); ir.adjust(2, 2, -2, -2);
p->setBrush(opt->palette.windowText()); p->setBrush(opt->palette.windowText());
bool oldQt4CompatiblePainting = p->testRenderHint(QPainter::Qt4CompatiblePainting);
p->setRenderHint(QPainter::Qt4CompatiblePainting);
p->drawEllipse(ir); p->drawEllipse(ir);
p->setRenderHint(QPainter::Qt4CompatiblePainting, oldQt4CompatiblePainting);
} }
break; } break; }
case PE_FrameFocusRect: case PE_FrameFocusRect:
@ -570,7 +567,6 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
p->translate(sx + bsx, sy + bsy); p->translate(sx + bsx, sy + bsy);
p->setPen(opt->palette.buttonText().color()); p->setPen(opt->palette.buttonText().color());
p->setBrush(opt->palette.buttonText()); p->setBrush(opt->palette.buttonText());
p->setRenderHint(QPainter::Qt4CompatiblePainting);
if (pe == PE_IndicatorSpinDown) { if (pe == PE_IndicatorSpinDown) {
const QPoint points[] = { QPoint(0, 1), QPoint(sw-1, 1), QPoint(sh-2, sh-1) }; const QPoint points[] = { QPoint(0, 1), QPoint(sw-1, 1), QPoint(sh-2, sh-1) };
p->drawPolygon(points, sizeof points / sizeof *points); 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.translate(sx + bsx, sy + bsy);
imagePainter.setPen(opt->palette.buttonText().color()); imagePainter.setPen(opt->palette.buttonText().color());
imagePainter.setBrush(opt->palette.buttonText()); imagePainter.setBrush(opt->palette.buttonText());
imagePainter.setRenderHint(QPainter::Qt4CompatiblePainting);
if (!(opt->state & State_Enabled)) { if (!(opt->state & State_Enabled)) {
imagePainter.translate(1, 1); imagePainter.translate(1, 1);
@ -1769,8 +1764,6 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
case CE_ToolBoxTabShape: case CE_ToolBoxTabShape:
if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) { if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
p->setPen(tb->palette.mid().color().darker(150)); 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; int d = 20 + tb->rect.height() - 3;
if (tb->direction != Qt::RightToLeft) { if (tb->direction != Qt::RightToLeft) {
const QPoint points[] = { const QPoint points[] = {
@ -1795,7 +1788,6 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
}; };
p->drawPolygon(points, sizeof points / sizeof *points); p->drawPolygon(points, sizeof points / sizeof *points);
} }
p->setRenderHint(QPainter::Qt4CompatiblePainting, oldQt4CompatiblePainting);
p->setPen(tb->palette.light().color()); p->setPen(tb->palette.light().color());
if (tb->direction != Qt::RightToLeft) { if (tb->direction != Qt::RightToLeft) {
p->drawLine(0, 2, tb->rect.width() - d, 2); 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->setPen(Qt::NoPen);
p->setBrush(pal.button()); p->setBrush(pal.button());
p->setRenderHint(QPainter::Qt4CompatiblePainting);
p->drawPolygon(arrow.cbegin(), arrow.size()); p->drawPolygon(arrow.cbegin(), arrow.size());
a = QStyleHelper::angle(QPointF(width / 2, height / 2), arrow[0]); a = QStyleHelper::angle(QPointF(width / 2, height / 2), arrow[0]);

View File

@ -2034,10 +2034,8 @@ void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComp
} }
QBrush oldBrush = p->brush(); QBrush oldBrush = p->brush();
bool oldQt4CompatiblePainting = p->testRenderHint(QPainter::Qt4CompatiblePainting);
p->setPen(Qt::NoPen); p->setPen(Qt::NoPen);
p->setBrush(handleBrush); p->setBrush(handleBrush);
p->setRenderHint(QPainter::Qt4CompatiblePainting);
Qt::BGMode oldMode = p->backgroundMode(); Qt::BGMode oldMode = p->backgroundMode();
p->setBackgroundMode(Qt::OpaqueMode); p->setBackgroundMode(Qt::OpaqueMode);
p->drawRect(x1, y1, x2-x1+1, y2-y1+1); 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); p->drawLine(x2, y2-1, x2+d, y2-1-d);
break; break;
} }
p->setRenderHint(QPainter::Qt4CompatiblePainting, oldQt4CompatiblePainting);
} }
} }
break; break;

View File

@ -792,7 +792,6 @@ void tst_QPainter::drawLine()
{ // unclipped { // unclipped
pixmapUnclipped.fill(Qt::white); pixmapUnclipped.fill(Qt::white);
QPainter p(&pixmapUnclipped); QPainter p(&pixmapUnclipped);
p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.translate(offset, offset); p.translate(offset, offset);
p.setPen(QPen(Qt::black)); p.setPen(QPen(Qt::black));
p.drawLine(line); p.drawLine(line);
@ -819,7 +818,6 @@ void tst_QPainter::drawLine()
pixmapClipped.fill(Qt::white); pixmapClipped.fill(Qt::white);
QPainter p(&pixmapClipped); QPainter p(&pixmapClipped);
p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.translate(offset, offset); p.translate(offset, offset);
p.setClipRect(clip); p.setClipRect(clip);
p.setPen(QPen(Qt::black)); p.setPen(QPen(Qt::black));
@ -856,7 +854,6 @@ void tst_QPainter::drawLine_task121143()
image.fill(0xffffffff); image.fill(0xffffffff);
QPainter p(&image); QPainter p(&image);
p.setPen(pen); p.setPen(pen);
p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.drawLine(QLine(0, 0+4, 0+4, 0)); p.drawLine(QLine(0, 0+4, 0+4, 0));
p.end(); 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); QTransform transform(0.368567, 0, 0, 0, 0.368567, 0, 0.0289, 0.0289, 1);
QPainter p(&image); QPainter p(&image);
p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.setTransform(transform); p.setTransform(transform);
p.setBrush(Qt::red); p.setBrush(Qt::red);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
@ -1048,13 +1044,12 @@ void tst_QPainter::drawRect2()
image.fill(0xffffffff); image.fill(0xffffffff);
p.begin(&image); p.begin(&image);
p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.setTransform(transform); p.setTransform(transform);
p.drawRect(QRect(14, 14, 39, 39)); p.drawRect(QRect(14, 14, 39, 39));
p.end(); p.end();
QRect stroke = getPaintedSize(image, Qt::white); 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; QPainterPath p;
p.addRect(2.25, 2.25, 10, 10); 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; QPainterPath p;
p.addRect(2.25, 2.25, 10.5, 10.5); 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()); image.fill(QColor(Qt::white).rgb());
QPainter p(&image); QPainter p(&image);
p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(Qt::black); p.setBrush(Qt::black);
p.translate(offset - expectedBounds.left(), offset - expectedBounds.top()); p.translate(offset - expectedBounds.left(), offset - expectedBounds.top());
@ -1536,7 +1530,6 @@ void tst_QPainter::drawRoundedRect()
{ {
pixmap.fill(Qt::white); pixmap.fill(Qt::white);
QPainter p(&pixmap); QPainter p(&pixmap);
p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.setPen(usePen ? QPen(Qt::black) : QPen(Qt::NoPen)); p.setPen(usePen ? QPen(Qt::black) : QPen(Qt::NoPen));
p.setBrush(Qt::black); p.setBrush(Qt::black);
p.drawRoundedRect(rect, 25, 25, Qt::RelativeSize); p.drawRoundedRect(rect, 25, 25, Qt::RelativeSize);
@ -1613,9 +1606,8 @@ void tst_QPainter::setWindow()
pixmap.fill(QColor(Qt::white)); pixmap.fill(QColor(Qt::white));
QPainter painter(&pixmap); QPainter painter(&pixmap);
painter.setRenderHint(QPainter::Qt4CompatiblePainting); painter.setWindow(0, 0, 28, 28);
painter.setWindow(0, 0, 3, 3); painter.drawLine(10, 10, 18, 18);
painter.drawLine(1, 1, 2, 2);
const QRect painted = getPaintedSize(pixmap, Qt::white); const QRect painted = getPaintedSize(pixmap, Qt::white);
QVERIFY(195 < painted.y() && painted.y() < 205); // correct value is around 200 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); baseLine.fill(Qt::white);
{ {
QPainter p(&baseLine); QPainter p(&baseLine);
p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.drawText(0, fm.ascent(), QString::fromLatin1("e")); p.drawText(0, fm.ascent(), QString::fromLatin1("e"));
} }
@ -4605,7 +4596,6 @@ void tst_QPainter::drawText_subPixelPositionsInRaster_qtbug5053()
{ {
QPainter p(&comparison); QPainter p(&comparison);
p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.drawText(QPointF(i / 12.0, fm.ascent()), QString::fromLatin1("e")); p.drawText(QPointF(i / 12.0, fm.ascent()), QString::fromLatin1("e"));
} }