Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/painting/qpaintengineex.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    150150
    151151struct StrokeHandler {
     152    StrokeHandler(int reserve) : pts(reserve), types(reserve) {}
    152153    QDataBuffer<qreal> pts;
    153154    QDataBuffer<QPainterPath::ElementType> types;
     
    395396
    396397    if (!d->strokeHandler) {
    397         d->strokeHandler = new StrokeHandler;
     398        d->strokeHandler = new StrokeHandler(path.elementCount()+4);
    398399        d->stroker.setMoveToHook(qpaintengineex_moveTo);
    399400        d->stroker.setLineToHook(qpaintengineex_lineTo);
     
    461462        // non-cosmetic pens will be transformed as part of fill
    462463        // later, so they are also covered here..
     464        d->activeStroker->setCurveThresholdFromTransform(state()->matrix);
    463465        d->activeStroker->begin(d->strokeHandler);
    464466        if (types) {
     
    493495            d->activeStroker->moveTo(points[0], points[1]);
    494496            points += 2;
    495             ++types;
    496497            while (points < lastPoint) {
    497498                d->activeStroker->lineTo(points[0], points[1]);
    498499                points += 2;
    499                 ++types;
    500500            }
    501501            if (path.hasImplicitClose())
     
    518518            d->activeStroker->strokePath(painterPath, d->strokeHandler, QTransform());
    519519        } else {
     520            d->activeStroker->setCurveThresholdFromTransform(QTransform());
    520521            d->activeStroker->begin(d->strokeHandler);
    521522            if (types) {
     
    559560                d->activeStroker->moveTo(p.x(), p.y());
    560561                points += 2;
    561                 ++types;
    562562                while (points < lastPoint) {
    563563                    QPointF p = ((QPointF *)points)[0] * state()->matrix;
    564564                    d->activeStroker->lineTo(p.x(), p.y());
    565565                    points += 2;
    566                     ++types;
    567566                }
    568567                if (path.hasImplicitClose())
     
    608607    qreal right = r.x() + r.width();
    609608    qreal bottom = r.y() + r.height();
    610     qreal pts[] = { r.x(), r.y(),
    611                     right, r.y(),
     609    qreal pts[] = { qreal(r.x()), qreal(r.y()),
     610                    right, qreal(r.y()),
    612611                    right, bottom,
    613                     r.x(), bottom,
    614                     r.x(), r.y() };
     612                    qreal(r.x()), bottom,
     613                    qreal(r.x()), qreal(r.y()) };
    615614    QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint);
    616615    clip(vp, op);
     
    712711        qreal right = r.x() + r.width();
    713712        qreal bottom = r.y() + r.height();
    714         qreal pts[] = { r.x(), r.y(),
    715                         right, r.y(),
     713        qreal pts[] = { qreal(r.x()), qreal(r.y()),
     714                        right, qreal(r.y()),
    716715                        right, bottom,
    717                         r.x(), bottom,
    718                         r.x(), r.y() };
     716                        qreal(r.x()), bottom,
     717                        qreal(r.x()), qreal(r.y()) };
    719718        QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint);
    720719        draw(vp);
     
    770769        x1, y2 - yRadius,
    771770        x1, y1 + yRadius,                   // LineTo
    772         x1, y1 + KAPPA * yRadius,           // CurveTo
     771        x1, y1 + (1 - KAPPA) * yRadius,           // CurveTo
    773772        x1 + (1 - KAPPA) * xRadius, y1,
    774773        x1 + xRadius, y1
     
    833832    int point_count = 0;
    834833    x.points[0] = qt_curves_for_arc(r, 0, -360, x.points + 1, &point_count);
    835     QVectorPath vp((qreal *) pts, 13, qpaintengineex_ellipse_types, QVectorPath::EllipseHint);
     834    QVectorPath vp((qreal *) pts, point_count, qpaintengineex_ellipse_types, QVectorPath::EllipseHint);
    836835    draw(vp);
    837836}
     
    894893                pts[++oset] = points[i].x();
    895894                pts[++oset] = points[i].y();
    896                 pts[++oset] = points[i].x() + 1/63;
     895                pts[++oset] = points[i].x() + 1/63.;
    897896                pts[++oset] = points[i].y();
    898897            }
     
    904903    } else {
    905904        for (int i=0; i<pointCount; ++i) {
    906             qreal pts[] = { points[i].x(), points[i].y(), points[i].x() +1/63., points[i].y() };
     905            qreal pts[] = { qreal(points[i].x()), qreal(points[i].y()),
     906                            qreal(points[i].x() +1/63.), qreal(points[i].y()) };
    907907            QVectorPath path(pts, 2, 0);
    908908            stroke(path, pen);
     
    971971}
    972972
    973 void QPaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints /*hints*/)
    974 {
     973void QPaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount,
     974                                         const QPixmap &pixmap, QPainter::PixmapFragmentHints /*hints*/)
     975{
     976    if (pixmap.isNull())
     977        return;
     978
    975979    qreal oldOpacity = state()->opacity;
    976980    QTransform oldTransform = state()->matrix;
    977981
    978     for (int i = 0; i < dataCount; ++i) {
     982    for (int i = 0; i < fragmentCount; ++i) {
    979983        QTransform transform = oldTransform;
    980         transform.translate(drawingData[i].point.x(), drawingData[i].point.y());
    981         transform.rotate(drawingData[i].rotation);
    982         state()->opacity = oldOpacity * drawingData[i].opacity;
     984        transform.translate(fragments[i].x, fragments[i].y);
     985        transform.rotate(fragments[i].rotation);
     986        state()->opacity = oldOpacity * fragments[i].opacity;
    983987        state()->matrix = transform;
    984988        opacityChanged();
    985989        transformChanged();
    986990
    987         qreal w = drawingData[i].scaleX * drawingData[i].source.width();
    988         qreal h = drawingData[i].scaleY * drawingData[i].source.height();
    989         drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, drawingData[i].source);
     991        qreal w = fragments[i].scaleX * fragments[i].width;
     992        qreal h = fragments[i].scaleY * fragments[i].height;
     993        QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop,
     994                          fragments[i].width, fragments[i].height);
     995        drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, sourceRect);
    990996    }
    991997
Note: See TracChangeset for help on using the changeset viewer.