1419 QRegion copy(r); |
1419 QRegion copy(r); |
1420 copy.translate(qRound(affine._dx), qRound(affine._dy)); |
1420 copy.translate(qRound(affine._dx), qRound(affine._dy)); |
1421 return copy; |
1421 return copy; |
1422 } |
1422 } |
1423 |
1423 |
1424 if (t == TxScale && r.numRects() == 1) |
1424 if (t == TxScale && r.rectCount() == 1) |
1425 return QRegion(mapRect(r.boundingRect())); |
1425 return QRegion(mapRect(r.boundingRect())); |
1426 |
1426 |
1427 QPainterPath p = map(qt_regionToPath(r)); |
1427 QPainterPath p = map(qt_regionToPath(r)); |
1428 return p.toFillPolygon(QTransform()).toPolygon(); |
1428 return p.toFillPolygon(QTransform()).toPolygon(); |
1429 } |
1429 } |
2212 Q_GUI_EXPORT |
2212 Q_GUI_EXPORT |
2213 bool qt_scaleForTransform(const QTransform &transform, qreal *scale) |
2213 bool qt_scaleForTransform(const QTransform &transform, qreal *scale) |
2214 { |
2214 { |
2215 const QTransform::TransformationType type = transform.type(); |
2215 const QTransform::TransformationType type = transform.type(); |
2216 if (type <= QTransform::TxTranslate) { |
2216 if (type <= QTransform::TxTranslate) { |
2217 *scale = 1; |
2217 if (scale) |
|
2218 *scale = 1; |
2218 return true; |
2219 return true; |
2219 } else if (type == QTransform::TxScale) { |
2220 } else if (type == QTransform::TxScale) { |
2220 const qreal xScale = qAbs(transform.m11()); |
2221 const qreal xScale = qAbs(transform.m11()); |
2221 const qreal yScale = qAbs(transform.m22()); |
2222 const qreal yScale = qAbs(transform.m22()); |
2222 *scale = qMax(xScale, yScale); |
2223 if (scale) |
|
2224 *scale = qMax(xScale, yScale); |
2223 return qFuzzyCompare(xScale, yScale); |
2225 return qFuzzyCompare(xScale, yScale); |
2224 } |
2226 } |
2225 |
2227 |
2226 const qreal xScale = transform.m11() * transform.m11() |
2228 const qreal xScale = transform.m11() * transform.m11() |
2227 + transform.m21() * transform.m21(); |
2229 + transform.m21() * transform.m21(); |
2228 const qreal yScale = transform.m12() * transform.m12() |
2230 const qreal yScale = transform.m12() * transform.m12() |
2229 + transform.m22() * transform.m22(); |
2231 + transform.m22() * transform.m22(); |
2230 *scale = qSqrt(qMax(xScale, yScale)); |
2232 if (scale) |
|
2233 *scale = qSqrt(qMax(xScale, yScale)); |
2231 return type == QTransform::TxRotate && qFuzzyCompare(xScale, yScale); |
2234 return type == QTransform::TxRotate && qFuzzyCompare(xScale, yScale); |
2232 } |
2235 } |
2233 |
2236 |
2234 QT_END_NAMESPACE |
2237 QT_END_NAMESPACE |