summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qoutlinemapper.cpp9
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp4
-rw-r--r--src/gui/painting/qpaintengineex.cpp8
-rw-r--r--src/gui/painting/qpainterpath_p.h16
4 files changed, 27 insertions, 10 deletions
diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp
index 51b3691..ad0c2eb 100644
--- a/src/gui/painting/qoutlinemapper.cpp
+++ b/src/gui/painting/qoutlinemapper.cpp
@@ -225,9 +225,10 @@ void QOutlineMapper::endOutline()
controlPointRect = boundingRect(elements, element_count);
#ifdef QT_DEBUG_CONVERT
- printf(" - control point rect (%.2f, %.2f) %.2f x %.2f\n",
+ printf(" - control point rect (%.2f, %.2f) %.2f x %.2f, clip=(%d,%d, %dx%d)\n",
controlPointRect.x(), controlPointRect.y(),
- controlPointRect.width(), controlPointRect.height());
+ controlPointRect.width(), controlPointRect.height(),
+ m_clip_rect.x(), m_clip_rect.y(), m_clip_rect.width(), m_clip_rect.height());
#endif
@@ -235,7 +236,9 @@ void QOutlineMapper::endOutline()
const bool do_clip = (controlPointRect.left() < -QT_RASTER_COORD_LIMIT
|| controlPointRect.right() > QT_RASTER_COORD_LIMIT
|| controlPointRect.top() < -QT_RASTER_COORD_LIMIT
- || controlPointRect.bottom() > QT_RASTER_COORD_LIMIT);
+ || controlPointRect.bottom() > QT_RASTER_COORD_LIMIT
+ || controlPointRect.width() > QT_RASTER_COORD_LIMIT
+ || controlPointRect.height() > QT_RASTER_COORD_LIMIT);
if (do_clip) {
clipElements(elements, elementTypes(), element_count);
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 0e7adf3..3f2322e 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -475,8 +475,10 @@ bool QRasterPaintEngine::begin(QPaintDevice *device)
QRasterPaintEngineState *s = state();
ensureOutlineMapper();
d->outlineMapper->m_clip_rect = d->deviceRect.adjusted(-10, -10, 10, 10);
+
+ // This is the upp
QRect bounds(-QT_RASTER_COORD_LIMIT, -QT_RASTER_COORD_LIMIT,
- 2*QT_RASTER_COORD_LIMIT, 2*QT_RASTER_COORD_LIMIT);
+ QT_RASTER_COORD_LIMIT*2 - 1, QT_RASTER_COORD_LIMIT * 2 - 1);
d->outlineMapper->m_clip_rect = bounds.intersected(d->outlineMapper->m_clip_rect);
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 3c07451..058f226 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -860,7 +860,7 @@ void QPaintEngineEx::drawPoints(const QPointF *points, int pointCount)
for (int i=0; i<count; ++i) {
pts[++oset] = points[i].x();
pts[++oset] = points[i].y();
- pts[++oset] = points[i].x() + 0.001;
+ pts[++oset] = points[i].x() + 1/63.;
pts[++oset] = points[i].y();
}
QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint);
@@ -870,7 +870,7 @@ void QPaintEngineEx::drawPoints(const QPointF *points, int pointCount)
}
} else {
for (int i=0; i<pointCount; ++i) {
- qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + 0.001, points[i].y() };
+ qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + 1/63., points[i].y() };
QVectorPath path(pts, 2, 0);
stroke(path, pen);
}
@@ -891,7 +891,7 @@ void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount)
for (int i=0; i<count; ++i) {
pts[++oset] = points[i].x();
pts[++oset] = points[i].y();
- pts[++oset] = points[i].x() + 0.001;
+ pts[++oset] = points[i].x() + 1/63;
pts[++oset] = points[i].y();
}
QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint);
@@ -901,7 +901,7 @@ void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount)
}
} else {
for (int i=0; i<pointCount; ++i) {
- qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + 0.001, points[i].y() };
+ qreal pts[] = { points[i].x(), points[i].y(), points[i].x() +1/63., points[i].y() };
QVectorPath path(pts, 2, 0);
stroke(path, pen);
}
diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h
index be01549..43f548f 100644
--- a/src/gui/painting/qpainterpath_p.h
+++ b/src/gui/painting/qpainterpath_p.h
@@ -97,6 +97,7 @@ public:
flags(0)
{
int ptsPos = 0;
+ bool isLines = true;
for (int i=0; i<path.size(); ++i) {
const QPainterPath::Element &e = path.at(i);
elements[i] = e.type;
@@ -104,6 +105,11 @@ public:
points[ptsPos++] = e.y;
if (e.type == QPainterPath::CurveToElement)
flags |= QVectorPath::CurvedShapeMask;
+
+ // This is to check if the path contains only alternating lineTo/moveTo,
+ // in which case we can set the LinesHint in the path. MoveTo is 0 and
+ // LineTo is 1 so the i%2 gets us what we want cheaply.
+ isLines = isLines && e.type == (QPainterPath::ElementType) (i%2);
}
if (fillRule == Qt::WindingFill)
@@ -111,8 +117,14 @@ public:
else
flags |= QVectorPath::OddEvenFill;
- if (!convex)
- flags |= QVectorPath::NonConvexShapeMask;
+ if (isLines)
+ flags |= QVectorPath::LinesShapeMask;
+ else {
+ flags |= QVectorPath::AreaShapeMask;
+ if (!convex)
+ flags |= QVectorPath::NonConvexShapeMask;
+ }
+
}
QVarLengthArray<QPainterPath::ElementType> elements;
QVarLengthArray<qreal> points;