diff options
Diffstat (limited to 'src/gui/painting/qpainter.cpp')
-rw-r--r-- | src/gui/painting/qpainter.cpp | 417 |
1 files changed, 0 insertions, 417 deletions
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 876b7f632d..988a8782b9 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -56,7 +56,6 @@ #include "qpixmapcache.h" #include "qpolygon.h" #include "qtextlayout.h" -#include "qwidget.h" #include "qstyle.h" #include "qthread.h" #include "qvarlengtharray.h" @@ -4603,82 +4602,6 @@ void QPainter::drawChord(const QRectF &r, int a, int alen) startAngle and \a spanAngle. */ -#ifdef QT3_SUPPORT -/*! - \fn void QPainter::drawLineSegments(const QPolygon &polygon, int - index, int count) - - Draws \a count separate lines from points defined by the \a - polygon, starting at \a{polygon}\e{[index]} (\a index defaults to - 0). If \a count is -1 (the default) all points until the end of - the array are used. - - Use drawLines() combined with QPolygon::constData() instead. - - \oldcode - QPainter painter(this); - painter.drawLineSegments(polygon, index, count); - \newcode - int lineCount = (count == -1) ? (polygon.size() - index) / 2 : count; - - QPainter painter(this); - painter.drawLines(polygon.constData() + index * 2, lineCount); - \endcode -*/ - -void QPainter::drawLineSegments(const QPolygon &a, int index, int nlines) -{ -#ifdef QT_DEBUG_DRAW - if (qt_show_painter_debug_output) - printf("QPainter::drawLineSegments(), count=%d\n", a.size()/2); -#endif - Q_D(QPainter); - - if (!d->engine) - return; - - if (nlines < 0) - nlines = a.size()/2 - index/2; - if (index + nlines*2 > (int)a.size()) - nlines = (a.size() - index)/2; - if (nlines < 1 || index < 0) - return; - - if (d->extended) { - // FALCON: Use QVectorPath - QVector<QLineF> lines; - for (int i=index; i<index + nlines*2; i+=2) - lines << QLineF(a.at(i), a.at(i+1)); - d->extended->drawLines(lines.data(), lines.size()); - return; - } - - d->updateState(d->state); - - QVector<QLineF> lines; - if (d->state->emulationSpecifier) { - if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform - && d->state->matrix.type() == QTransform::TxTranslate) { - QPointF offset(d->state->matrix.dx(), d->state->matrix.dy()); - for (int i=index; i<index + nlines*2; i+=2) - lines << QLineF(a.at(i) + offset, a.at(i+1) + offset); - } else { - QPainterPath linesPath; - for (int i=index; i<index + nlines*2; i+=2) { - linesPath.moveTo(a.at(i)); - linesPath.lineTo(a.at(i+1)); - } - d->draw_helper(linesPath, QPainterPrivate::StrokeDraw); - return; - } - } else { - for (int i=index; i<index + nlines*2; i+=2) - lines << QLineF(a.at(i), a.at(i+1)); - } - - d->engine->drawLines(lines.data(), lines.size()); -} -#endif // QT3_SUPPORT /*! Draws the first \a lineCount lines in the array \a lines @@ -7491,307 +7414,6 @@ void QPainter::setViewTransformEnabled(bool enable) d->updateMatrix(); } -#ifdef QT3_SUPPORT - -/*! - \obsolete - - Use the worldTransform() combined with QTransform::dx() instead. - - \oldcode - QPainter painter(this); - qreal x = painter.translationX(); - \newcode - QPainter painter(this); - qreal x = painter.worldTransform().dx(); - \endcode -*/ -qreal QPainter::translationX() const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::translationX: Painter not active"); - return 0.0; - } - return d->state->worldMatrix.dx(); -} - -/*! - \obsolete - - Use the worldTransform() combined with QTransform::dy() instead. - - \oldcode - QPainter painter(this); - qreal y = painter.translationY(); - \newcode - QPainter painter(this); - qreal y = painter.worldTransform().dy(); - \endcode -*/ -qreal QPainter::translationY() const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::translationY: Painter not active"); - return 0.0; - } - return d->state->worldMatrix.dy(); -} - -/*! - \fn void QPainter::map(int x, int y, int *rx, int *ry) const - - \internal - - Sets (\a{rx}, \a{ry}) to the point that results from applying the - painter's current transformation on the point (\a{x}, \a{y}). -*/ -void QPainter::map(int x, int y, int *rx, int *ry) const -{ - QPoint p(x, y); - p = p * combinedMatrix(); - *rx = p.x(); - *ry = p.y(); -} - -/*! - \fn QPoint QPainter::xForm(const QPoint &point) const - - Use combinedTransform() instead. -*/ - -QPoint QPainter::xForm(const QPoint &p) const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::xForm: Painter not active"); - return QPoint(); - } - if (d->state->matrix.type() == QTransform::TxNone) - return p; - return p * combinedMatrix(); -} - - -/*! - \fn QRect QPainter::xForm(const QRect &rectangle) const - \overload - - Use combinedTransform() instead of this function and call - mapRect() on the result to obtain a QRect. -*/ - -QRect QPainter::xForm(const QRect &r) const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::xForm: Painter not active"); - return QRect(); - } - if (d->state->matrix.type() == QTransform::TxNone) - return r; - return combinedMatrix().mapRect(r); -} - -/*! - \fn QPolygon QPainter::xForm(const QPolygon &polygon) const - \overload - - Use combinedTransform() instead. -*/ - -QPolygon QPainter::xForm(const QPolygon &a) const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::xForm: Painter not active"); - return QPolygon(); - } - if (d->state->matrix.type() == QTransform::TxNone) - return a; - return a * combinedMatrix(); -} - -/*! - \fn QPolygon QPainter::xForm(const QPolygon &polygon, int index, int count) const - \overload - - Use combinedTransform() combined with QPolygon::mid() instead. - - \oldcode - QPainter painter(this); - QPolygon transformed = painter.xForm(polygon, index, count) - \newcode - QPainter painter(this); - QPolygon transformed = polygon.mid(index, count) * painter.combinedTransform(); - \endcode -*/ - -QPolygon QPainter::xForm(const QPolygon &av, int index, int npoints) const -{ - int lastPoint = npoints < 0 ? av.size() : index+npoints; - QPolygon a(lastPoint-index); - memcpy(a.data(), av.data()+index, (lastPoint-index)*sizeof(QPoint)); - return a * combinedMatrix(); -} - -/*! - \fn QPoint QPainter::xFormDev(const QPoint &point) const - \overload - \obsolete - - Use combinedTransform() combined with QTransform::inverted() instead. - - \oldcode - QPainter painter(this); - QPoint transformed = painter.xFormDev(point); - \newcode - QPainter painter(this); - QPoint transformed = point * painter.combinedTransform().inverted(); - \endcode -*/ - -QPoint QPainter::xFormDev(const QPoint &p) const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::xFormDev: Painter not active"); - return QPoint(); - } - if(d->state->matrix.type() == QTransform::TxNone) - return p; - return p * combinedMatrix().inverted(); -} - -/*! - \fn QRect QPainter::xFormDev(const QRect &rectangle) const - \overload - \obsolete - - Use combinedTransform() combined with QTransform::inverted() instead. - - \oldcode - QPainter painter(this); - QRect transformed = painter.xFormDev(rectangle); - \newcode - QPainter painter(this); - QRegion region = QRegion(rectangle) * painter.combinedTransform().inverted(); - QRect transformed = region.boundingRect(); - \endcode -*/ - -QRect QPainter::xFormDev(const QRect &r) const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::xFormDev: Painter not active"); - return QRect(); - } - if (d->state->matrix.type() == QTransform::TxNone) - return r; - return combinedMatrix().inverted().mapRect(r); -} - -/*! - \overload - - \fn QPoint QPainter::xFormDev(const QPolygon &polygon) const - \obsolete - - Use combinedTransform() combined with QTransform::inverted() instead. - - \oldcode - QPainter painter(this); - QPolygon transformed = painter.xFormDev(rectangle); - \newcode - QPainter painter(this); - QPolygon transformed = polygon * painter.combinedTransform().inverted(); - \endcode -*/ - -QPolygon QPainter::xFormDev(const QPolygon &a) const -{ - Q_D(const QPainter); - if (!d->engine) { - qWarning("QPainter::xFormDev: Painter not active"); - return QPolygon(); - } - if (d->state->matrix.type() == QTransform::TxNone) - return a; - return a * combinedMatrix().inverted(); -} - -/*! - \fn QPolygon QPainter::xFormDev(const QPolygon &polygon, int index, int count) const - \overload - \obsolete - - Use combinedTransform() combined with QPolygon::mid() and QTransform::inverted() instead. - - \oldcode - QPainter painter(this); - QPolygon transformed = painter.xFormDev(polygon, index, count); - \newcode - QPainter painter(this); - QPolygon transformed = polygon.mid(index, count) * painter.combinedTransform().inverted(); - \endcode -*/ - -QPolygon QPainter::xFormDev(const QPolygon &ad, int index, int npoints) const -{ - Q_D(const QPainter); - int lastPoint = npoints < 0 ? ad.size() : index+npoints; - QPolygon a(lastPoint-index); - memcpy(a.data(), ad.data()+index, (lastPoint-index)*sizeof(QPoint)); - if (d->state->matrix.type() == QTransform::TxNone) - return a; - return a * combinedMatrix().inverted(); -} - -/*! - \fn void QPainter::drawCubicBezier(const QPolygon &controlPoints, int index) - - Draws a cubic Bezier curve defined by the \a controlPoints, - starting at \a{controlPoints}\e{[index]} (\a index defaults to 0). - Points after \a{controlPoints}\e{[index + 3]} are ignored. Nothing - happens if there aren't enough control points. - - Use strokePath() instead. - - \oldcode - QPainter painter(this); - painter.drawCubicBezier(controlPoints, index) - \newcode - QPainterPath path; - path.moveTo(controlPoints.at(index)); - path.cubicTo(controlPoints.at(index+1), - controlPoints.at(index+2), - controlPoints.at(index+3)); - - QPainter painter(this); - painter.strokePath(path, painter.pen()); - \endcode -*/ -void QPainter::drawCubicBezier(const QPolygon &a, int index) -{ - Q_D(QPainter); - - if (!d->engine) - return; - - if ((int)a.size() - index < 4) { - qWarning("QPainter::drawCubicBezier: Cubic Bezier needs 4 control " - "points"); - return; - } - - QPainterPath path; - path.moveTo(a.at(index)); - path.cubicTo(a.at(index+1), a.at(index+2), a.at(index+3)); - strokePath(path, d->state->pen); -} -#endif struct QPaintDeviceRedirection { @@ -8335,45 +7957,6 @@ void QPainterState::init(QPainter *p) { opacity = 1; } -#ifdef QT3_SUPPORT -static void bitBlt_helper(QPaintDevice *dst, const QPoint &dp, - const QPaintDevice *src, const QRect &sr, bool) -{ - Q_ASSERT(dst); - Q_ASSERT(src); - - if (src->devType() == QInternal::Pixmap) { - const QPixmap *pixmap = static_cast<const QPixmap *>(src); - QPainter pt(dst); - pt.drawPixmap(dp, *pixmap, sr); - - } else { - qWarning("QPainter: bitBlt only works when source is of type pixmap"); - } -} - -void bitBlt(QPaintDevice *dst, int dx, int dy, - const QPaintDevice *src, int sx, int sy, int sw, int sh, - bool ignoreMask ) -{ - bitBlt_helper(dst, QPoint(dx, dy), src, QRect(sx, sy, sw, sh), ignoreMask); -} - -void bitBlt(QPaintDevice *dst, const QPoint &dp, const QPaintDevice *src, const QRect &sr, bool ignoreMask) -{ - bitBlt_helper(dst, dp, src, sr, ignoreMask); -} - -void bitBlt(QPaintDevice *dst, int dx, int dy, - const QImage *src, int sx, int sy, int sw, int sh, int fl) -{ - Qt::ImageConversionFlags flags(fl); - QPixmap srcPixmap = QPixmap::fromImage(*src, flags); - bitBlt_helper(dst, QPoint(dx, dy), &srcPixmap, QRect(sx, sy, sw, sh), false); -} - -#endif // QT3_SUPPORT - /*! \fn void QPainter::setBackgroundColor(const QColor &color) |