summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-06-10 10:13:06 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-06-10 14:49:48 (GMT)
commit9eeec42f67e3e5c344d024eb28ac4f09d7c96c41 (patch)
tree819b9e2a61274acb792084bcb10042fbf16775e7 /src/gui/painting
parent32f32ee3e752a6cc03505ddaa48d2849eaedc2a6 (diff)
downloadQt-9eeec42f67e3e5c344d024eb28ac4f09d7c96c41.zip
Qt-9eeec42f67e3e5c344d024eb28ac4f09d7c96c41.tar.gz
Qt-9eeec42f67e3e5c344d024eb28ac4f09d7c96c41.tar.bz2
Make QVectorPath::controlPointRect() return a QRectF.
This makes debugging etc much easier, plus most of the places controlPointRect() was called the caller had to convert the rect to a QRectF manually.
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qemulationpaintengine.cpp12
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp3
-rw-r--r--src/gui/painting/qpaintengineex.cpp12
-rw-r--r--src/gui/painting/qvectorpath_p.h2
4 files changed, 13 insertions, 16 deletions
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp
index 175f1ab..5ce1136 100644
--- a/src/gui/painting/qemulationpaintengine.cpp
+++ b/src/gui/painting/qemulationpaintengine.cpp
@@ -99,9 +99,9 @@ void QEmulationPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
} else if (g->coordinateMode() == QGradient::ObjectBoundingMode) {
QBrush copy = brush;
QTransform mat = copy.transform();
- QRealRect r = path.controlPointRect();
- mat.translate(r.x1, r.y1);
- mat.scale(r.x2 - r.x1, r.y2 - r.y1);
+ QRectF r = path.controlPointRect();
+ mat.translate(r.x(), r.y());
+ mat.scale(r.width(), r.height());
copy.setTransform(mat);
real_engine->fill(path, copy);
return;
@@ -139,9 +139,9 @@ void QEmulationPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
return;
} else if (g->coordinateMode() == QGradient::ObjectBoundingMode) {
QTransform mat = brush.transform();
- QRealRect r = path.controlPointRect();
- mat.translate(r.x1, r.y1);
- mat.scale(r.x2 - r.x1, r.y2 - r.y1);
+ QRectF r = path.controlPointRect();
+ mat.translate(r.x(), r.y());
+ mat.scale(r.width(), r.height());
brush.setTransform(mat);
copy.setBrush(brush);
real_engine->stroke(path, copy);
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 7ed2dfd..2ce1d09 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1852,8 +1852,7 @@ void QRasterPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
}
// ### Optimize for non transformed ellipses and rectangles...
- QRealRect r = path.controlPointRect();
- QRectF cpRect(r.x1, r.y1, r.x2 - r.x1, r.y2 - r.y1);
+ QRectF cpRect = path.controlPointRect();
const QRect deviceRect = s->matrix.mapRect(cpRect).toRect();
ProcessSpans blend = d->getBrushFunc(deviceRect, &s->brushData);
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index d2671c8..67a3fa9 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -56,15 +56,15 @@ QT_BEGIN_NAMESPACE
*
*/
-const QRealRect &QVectorPath::controlPointRect() const
+QRectF QVectorPath::controlPointRect() const
{
if (m_hints & ControlPointRect)
- return m_cp_rect;
+ return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2));
if (m_count == 0) {
m_cp_rect.x1 = m_cp_rect.x2 = m_cp_rect.y1 = m_cp_rect.y2 = 0;
m_hints |= ControlPointRect;
- return m_cp_rect;
+ return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2));
}
Q_ASSERT(m_points && m_count > 0);
@@ -88,7 +88,7 @@ const QRealRect &QVectorPath::controlPointRect() const
}
m_hints |= ControlPointRect;
- return m_cp_rect;
+ return QRectF(QPointF(m_cp_rect.x1, m_cp_rect.y1), QPointF(m_cp_rect.x2, m_cp_rect.y2));
}
const QVectorPath &qtVectorPathForPath(const QPainterPath &path)
@@ -100,9 +100,7 @@ const QVectorPath &qtVectorPathForPath(const QPainterPath &path)
#ifndef QT_NO_DEBUG_STREAM
QDebug Q_GUI_EXPORT &operator<<(QDebug &s, const QVectorPath &path)
{
- QRealRect vectorPathBounds = path.controlPointRect();
- QRectF rf(vectorPathBounds.x1, vectorPathBounds.y1,
- vectorPathBounds.x2 - vectorPathBounds.x1, vectorPathBounds.y2 - vectorPathBounds.y1);
+ QRectF rf = path.controlPointRect();
s << "QVectorPath(size:" << path.elementCount()
<< " hints:" << hex << path.hints()
<< rf << ')';
diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h
index 2602a3d..b073f8c 100644
--- a/src/gui/painting/qvectorpath_p.h
+++ b/src/gui/painting/qvectorpath_p.h
@@ -112,7 +112,7 @@ public:
{
}
- const QRealRect &controlPointRect() const;
+ QRectF controlPointRect() const;
inline Hint shape() const { return (Hint) (m_hints & ShapeHintMask); }