Changeset 846 for trunk/src/gui/painting/qtransform.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/painting/qtransform.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 48 48 #include "qvariant.h" 49 49 #include <qmath.h> 50 50 51 51 52 #include <private/qbezier_p.h> … … 148 149 QPaintDevice has its origin located at the top-left position. The 149 150 \e x values increase to the right; \e y values increase 150 downward. For a complete description, see the \l { TheCoordinate151 System} {coordinate system} documentation.151 downward. For a complete description, see the \l {Coordinate 152 System}{coordinate system} documentation. 152 153 153 154 QPainter has functions to translate, scale, shear and rotate the … … 223 224 \endtable 224 225 225 \sa QPainter, { TheCoordinate System}, {demos/affine}{Affine226 \sa QPainter, {Coordinate System}, {demos/affine}{Affine 226 227 Transformations Demo}, {Transformations Example} 227 228 */ … … 411 412 if (dx == 0 && dy == 0) 412 413 return *this; 414 415 416 417 418 419 413 420 414 421 switch(inline_type()) { … … 448 455 QTransform QTransform::fromTranslate(qreal dx, qreal dy) 449 456 { 457 458 459 460 461 462 450 463 QTransform transform(1, 0, 0, 0, 1, 0, dx, dy, 1, true); 451 464 if (dx == 0 && dy == 0) … … 467 480 if (sx == 1 && sy == 1) 468 481 return *this; 482 483 484 485 486 487 469 488 470 489 switch(inline_type()) { … … 502 521 QTransform QTransform::fromScale(qreal sx, qreal sy) 503 522 { 523 524 525 526 527 528 504 529 QTransform transform(sx, 0, 0, 0, sy, 0, 0, 0, 1, true); 505 530 if (sx == 1. && sy == 1.) … … 521 546 if (sh == 0 && sv == 0) 522 547 return *this; 548 549 550 551 552 553 523 554 524 555 switch(inline_type()) { … … 576 607 if (a == 0) 577 608 return *this; 609 610 611 612 613 614 578 615 579 616 qreal sina = 0; … … 661 698 QTransform & QTransform::rotateRadians(qreal a, Qt::Axis axis) 662 699 { 700 701 702 703 704 705 663 706 qreal sina = qSin(a); 664 707 qreal cosa = qCos(a); … … 986 1029 reference to the stream. 987 1030 988 \sa { Format of the QDataStream Operators}1031 \sa {s} 989 1032 */ 990 1033 QDataStream & operator<<(QDataStream &s, const QTransform &m) … … 1010 1053 reference to the stream. 1011 1054 1012 \sa { Format of the QDataStream Operators}1055 \sa {s} 1013 1056 */ 1014 1057 QDataStream & operator>>(QDataStream &s, QTransform &t) … … 1038 1081 QDebug operator<<(QDebug dbg, const QTransform &m) 1039 1082 { 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() 1042 1095 << " 12=" << m.m12() 1043 1096 << " 13=" << m.m13() … … 1049 1102 << " 33=" << m.m33() 1050 1103 << ')'; 1104 1051 1105 return dbg.space(); 1052 1106 } … … 1492 1546 return true; 1493 1547 } 1548 1494 1549 1495 1550 static inline bool cubicTo_clipped(QPainterPath &path, const QTransform &transform, const QPointF &a, const QPointF &b, const QPointF &c, const QPointF &d, bool needsMoveTo) … … 1497 1552 // Convert projective xformed curves to line 1498 1553 // 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); 1500 1561 1501 1562 for (int i = 0; i < segment.size() - 1; ++i) … … 1566 1627 { 1567 1628 TransformationType t = inline_type(); 1568 if (t == TxNone || path. isEmpty())1629 if (t == TxNone || path.) 1569 1630 return path; 1570 1631
Note:
See TracChangeset
for help on using the changeset viewer.