--- a/src/gui/painting/qpaintengineex.cpp Wed Jun 23 19:07:03 2010 +0300
+++ b/src/gui/painting/qpaintengineex.cpp Tue Jul 06 15:10:48 2010 +0300
@@ -149,6 +149,7 @@
struct StrokeHandler {
+ StrokeHandler(int reserve) : pts(reserve), types(reserve) {}
QDataBuffer<qreal> pts;
QDataBuffer<QPainterPath::ElementType> types;
};
@@ -394,7 +395,7 @@
return;
if (!d->strokeHandler) {
- d->strokeHandler = new StrokeHandler;
+ d->strokeHandler = new StrokeHandler(path.elementCount()+4);
d->stroker.setMoveToHook(qpaintengineex_moveTo);
d->stroker.setLineToHook(qpaintengineex_lineTo);
d->stroker.setCubicToHook(qpaintengineex_cubicTo);
@@ -460,6 +461,7 @@
// change the current transform. Normal transformed,
// non-cosmetic pens will be transformed as part of fill
// later, so they are also covered here..
+ d->activeStroker->setCurveThresholdFromTransform(state()->matrix);
d->activeStroker->begin(d->strokeHandler);
if (types) {
while (points < lastPoint) {
@@ -517,6 +519,7 @@
QPainterPath painterPath = state()->matrix.map(path.convertToPainterPath());
d->activeStroker->strokePath(painterPath, d->strokeHandler, QTransform());
} else {
+ d->activeStroker->setCurveThresholdFromTransform(state()->matrix);
d->activeStroker->begin(d->strokeHandler);
if (types) {
while (points < lastPoint) {
@@ -607,11 +610,11 @@
{
qreal right = r.x() + r.width();
qreal bottom = r.y() + r.height();
- qreal pts[] = { r.x(), r.y(),
- right, r.y(),
+ qreal pts[] = { qreal(r.x()), qreal(r.y()),
+ right, qreal(r.y()),
right, bottom,
- r.x(), bottom,
- r.x(), r.y() };
+ qreal(r.x()), bottom,
+ qreal(r.x()), qreal(r.y()) };
QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint);
clip(vp, op);
}
@@ -711,11 +714,11 @@
// ### Is there a one off here?
qreal right = r.x() + r.width();
qreal bottom = r.y() + r.height();
- qreal pts[] = { r.x(), r.y(),
- right, r.y(),
+ qreal pts[] = { qreal(r.x()), qreal(r.y()),
+ right, qreal(r.y()),
right, bottom,
- r.x(), bottom,
- r.x(), r.y() };
+ qreal(r.x()), bottom,
+ qreal(r.x()), qreal(r.y()) };
QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint);
draw(vp);
}
@@ -893,7 +896,7 @@
for (int i=0; i<count; ++i) {
pts[++oset] = points[i].x();
pts[++oset] = points[i].y();
- pts[++oset] = points[i].x() + 1/63;
+ pts[++oset] = points[i].x() + 1/63.;
pts[++oset] = points[i].y();
}
QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint);
@@ -903,7 +906,8 @@
}
} else {
for (int i=0; i<pointCount; ++i) {
- qreal pts[] = { points[i].x(), points[i].y(), points[i].x() +1/63., points[i].y() };
+ qreal pts[] = { qreal(points[i].x()), qreal(points[i].y()),
+ qreal(points[i].x() +1/63.), qreal(points[i].y()) };
QVectorPath path(pts, 2, 0);
stroke(path, pen);
}
@@ -970,23 +974,29 @@
fill(path, brush);
}
-void QPaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints /*hints*/)
+void QPaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount,
+ const QPixmap &pixmap, QPainter::PixmapFragmentHints /*hints*/)
{
+ if (pixmap.isNull())
+ return;
+
qreal oldOpacity = state()->opacity;
QTransform oldTransform = state()->matrix;
- for (int i = 0; i < dataCount; ++i) {
+ for (int i = 0; i < fragmentCount; ++i) {
QTransform transform = oldTransform;
- transform.translate(drawingData[i].point.x(), drawingData[i].point.y());
- transform.rotate(drawingData[i].rotation);
- state()->opacity = oldOpacity * drawingData[i].opacity;
+ transform.translate(fragments[i].x, fragments[i].y);
+ transform.rotate(fragments[i].rotation);
+ state()->opacity = oldOpacity * fragments[i].opacity;
state()->matrix = transform;
opacityChanged();
transformChanged();
- qreal w = drawingData[i].scaleX * drawingData[i].source.width();
- qreal h = drawingData[i].scaleY * drawingData[i].source.height();
- drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, drawingData[i].source);
+ qreal w = fragments[i].scaleX * fragments[i].width;
+ qreal h = fragments[i].scaleY * fragments[i].height;
+ QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop,
+ fragments[i].width, fragments[i].height);
+ drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, sourceRect);
}
state()->opacity = oldOpacity;