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/qtransform.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    4848#include "qvariant.h"
    4949#include <qmath.h>
     50
    5051
    5152#include <private/qbezier_p.h>
     
    148149    QPaintDevice has its origin located at the top-left position. The
    149150    \e x values increase to the right; \e y values increase
    150     downward. For a complete description, see the \l {The Coordinate
    151     System}{coordinate system} documentation.
     151    downward. For a complete description, see the \l {Coordinate
     152    System}{coordinate system} documentation.
    152153
    153154    QPainter has functions to translate, scale, shear and rotate the
     
    223224    \endtable
    224225
    225     \sa QPainter, {The Coordinate System}, {demos/affine}{Affine
     226    \sa QPainter, {Coordinate System}, {demos/affine}{Affine
    226227    Transformations Demo}, {Transformations Example}
    227228*/
     
    411412    if (dx == 0 && dy == 0)
    412413        return *this;
     414
     415
     416
     417
     418
     419
    413420
    414421    switch(inline_type()) {
     
    448455QTransform QTransform::fromTranslate(qreal dx, qreal dy)
    449456{
     457
     458
     459
     460
     461
     462
    450463    QTransform transform(1, 0, 0, 0, 1, 0, dx, dy, 1, true);
    451464    if (dx == 0 && dy == 0)
     
    467480    if (sx == 1 && sy == 1)
    468481        return *this;
     482
     483
     484
     485
     486
     487
    469488
    470489    switch(inline_type()) {
     
    502521QTransform QTransform::fromScale(qreal sx, qreal sy)
    503522{
     523
     524
     525
     526
     527
     528
    504529    QTransform transform(sx, 0, 0, 0, sy, 0, 0, 0, 1, true);
    505530    if (sx == 1. && sy == 1.)
     
    521546    if (sh == 0 && sv == 0)
    522547        return *this;
     548
     549
     550
     551
     552
     553
    523554
    524555    switch(inline_type()) {
     
    576607    if (a == 0)
    577608        return *this;
     609
     610
     611
     612
     613
     614
    578615
    579616    qreal sina = 0;
     
    661698QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis)
    662699{
     700
     701
     702
     703
     704
     705
    663706    qreal sina = qSin(a);
    664707    qreal cosa = qCos(a);
     
    9861029    reference to the stream.
    9871030
    988     \sa {Format of the QDataStream Operators}
     1031    \sa {s}
    9891032*/
    9901033QDataStream & operator<<(QDataStream &s, const QTransform &m)
     
    10101053    reference to the stream.
    10111054
    1012     \sa {Format of the QDataStream Operators}
     1055    \sa {s}
    10131056*/
    10141057QDataStream & operator>>(QDataStream &s, QTransform &t)
     
    10381081QDebug operator<<(QDebug dbg, const QTransform &m)
    10391082{
    1040     dbg.nospace() << "QTransform("
    1041                   << "11="  << m.m11()
     1083    static const char *typeStr[] =
     1084    {
     1085        "TxNone",
     1086        "TxTranslate",
     1087        "TxScale",
     1088        "TxRotate",
     1089        "TxShear",
     1090        "TxProject"
     1091    };
     1092
     1093    dbg.nospace() << "QTransform(type=" << typeStr[m.type()] << ','
     1094                  << " 11=" << m.m11()
    10421095                  << " 12=" << m.m12()
    10431096                  << " 13=" << m.m13()
     
    10491102                  << " 33=" << m.m33()
    10501103                  << ')';
     1104
    10511105    return dbg.space();
    10521106}
     
    14921546    return true;
    14931547}
     1548
    14941549
    14951550static inline bool cubicTo_clipped(QPainterPath &path, const QTransform &transform, const QPointF &a, const QPointF &b, const QPointF &c, const QPointF &d, bool needsMoveTo)
     
    14971552    // Convert projective xformed curves to line
    14981553    // segments so they can be transformed more accurately
    1499     QPolygonF segment = QBezier::fromPoints(a, b, c, d).toPolygon();
     1554
     1555    qreal scale;
     1556    qt_scaleForTransform(transform, &scale);
     1557
     1558    qreal curveThreshold = scale == 0 ? qreal(0.25) : (qreal(0.25) / scale);
     1559
     1560    QPolygonF segment = QBezier::fromPoints(a, b, c, d).toPolygon(curveThreshold);
    15001561
    15011562    for (int i = 0; i < segment.size() - 1; ++i)
     
    15661627{
    15671628    TransformationType t = inline_type();
    1568     if (t == TxNone || path.isEmpty())
     1629    if (t == TxNone || path.)
    15691630        return path;
    15701631
Note: See TracChangeset for help on using the changeset viewer.