Changeset 846 for trunk/src/gui/painting/qpaintengineex.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/qpaintengineex.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 150 150 151 151 struct StrokeHandler { 152 StrokeHandler(int reserve) : pts(reserve), types(reserve) {} 152 153 QDataBuffer<qreal> pts; 153 154 QDataBuffer<QPainterPath::ElementType> types; … … 395 396 396 397 if (!d->strokeHandler) { 397 d->strokeHandler = new StrokeHandler ;398 d->strokeHandler = new StrokeHandler(path.elementCount()+4); 398 399 d->stroker.setMoveToHook(qpaintengineex_moveTo); 399 400 d->stroker.setLineToHook(qpaintengineex_lineTo); … … 461 462 // non-cosmetic pens will be transformed as part of fill 462 463 // later, so they are also covered here.. 464 d->activeStroker->setCurveThresholdFromTransform(state()->matrix); 463 465 d->activeStroker->begin(d->strokeHandler); 464 466 if (types) { … … 493 495 d->activeStroker->moveTo(points[0], points[1]); 494 496 points += 2; 495 ++types;496 497 while (points < lastPoint) { 497 498 d->activeStroker->lineTo(points[0], points[1]); 498 499 points += 2; 499 ++types;500 500 } 501 501 if (path.hasImplicitClose()) … … 518 518 d->activeStroker->strokePath(painterPath, d->strokeHandler, QTransform()); 519 519 } else { 520 d->activeStroker->setCurveThresholdFromTransform(QTransform()); 520 521 d->activeStroker->begin(d->strokeHandler); 521 522 if (types) { … … 559 560 d->activeStroker->moveTo(p.x(), p.y()); 560 561 points += 2; 561 ++types;562 562 while (points < lastPoint) { 563 563 QPointF p = ((QPointF *)points)[0] * state()->matrix; 564 564 d->activeStroker->lineTo(p.x(), p.y()); 565 565 points += 2; 566 ++types;567 566 } 568 567 if (path.hasImplicitClose()) … … 608 607 qreal right = r.x() + r.width(); 609 608 qreal bottom = r.y() + r.height(); 610 qreal pts[] = { r.x(), r.y(),611 right, r.y(),609 qreal pts[] = { qreal(r.x()), qreal(r.y()), 610 right, qreal(r.y()), 612 611 right, bottom, 613 r.x(), bottom,614 r.x(), r.y() };612 qreal(r.x()), bottom, 613 qreal(r.x()), qreal(r.y()) }; 615 614 QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint); 616 615 clip(vp, op); … … 712 711 qreal right = r.x() + r.width(); 713 712 qreal bottom = r.y() + r.height(); 714 qreal pts[] = { r.x(), r.y(),715 right, r.y(),713 qreal pts[] = { qreal(r.x()), qreal(r.y()), 714 right, qreal(r.y()), 716 715 right, bottom, 717 r.x(), bottom,718 r.x(), r.y() };716 qreal(r.x()), bottom, 717 qreal(r.x()), qreal(r.y()) }; 719 718 QVectorPath vp(pts, 5, 0, QVectorPath::RectangleHint); 720 719 draw(vp); … … 770 769 x1, y2 - yRadius, 771 770 x1, y1 + yRadius, // LineTo 772 x1, y1 + KAPPA* yRadius, // CurveTo771 x1, y1 + (1 - KAPPA) * yRadius, // CurveTo 773 772 x1 + (1 - KAPPA) * xRadius, y1, 774 773 x1 + xRadius, y1 … … 833 832 int point_count = 0; 834 833 x.points[0] = qt_curves_for_arc(r, 0, -360, x.points + 1, &point_count); 835 QVectorPath vp((qreal *) pts, 13, qpaintengineex_ellipse_types, QVectorPath::EllipseHint);834 QVectorPath vp((qreal *) pts, point_count, qpaintengineex_ellipse_types, QVectorPath::EllipseHint); 836 835 draw(vp); 837 836 } … … 894 893 pts[++oset] = points[i].x(); 895 894 pts[++oset] = points[i].y(); 896 pts[++oset] = points[i].x() + 1/63 ;895 pts[++oset] = points[i].x() + 1/63.; 897 896 pts[++oset] = points[i].y(); 898 897 } … … 904 903 } else { 905 904 for (int i=0; i<pointCount; ++i) { 906 qreal pts[] = { points[i].x(), points[i].y(), points[i].x() +1/63., points[i].y() }; 905 qreal pts[] = { qreal(points[i].x()), qreal(points[i].y()), 906 qreal(points[i].x() +1/63.), qreal(points[i].y()) }; 907 907 QVectorPath path(pts, 2, 0); 908 908 stroke(path, pen); … … 971 971 } 972 972 973 void QPaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints /*hints*/) 974 { 973 void QPaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, 974 const QPixmap &pixmap, QPainter::PixmapFragmentHints /*hints*/) 975 { 976 if (pixmap.isNull()) 977 return; 978 975 979 qreal oldOpacity = state()->opacity; 976 980 QTransform oldTransform = state()->matrix; 977 981 978 for (int i = 0; i < dataCount; ++i) {982 for (int i = 0; i < fragmentCount; ++i) { 979 983 QTransform transform = oldTransform; 980 transform.translate( drawingData[i].point.x(), drawingData[i].point.y());981 transform.rotate( drawingData[i].rotation);982 state()->opacity = oldOpacity * drawingData[i].opacity;984 transform.translate(fragments[i].x, fragments[i].y); 985 transform.rotate(fragments[i].rotation); 986 state()->opacity = oldOpacity * fragments[i].opacity; 983 987 state()->matrix = transform; 984 988 opacityChanged(); 985 989 transformChanged(); 986 990 987 qreal w = drawingData[i].scaleX * drawingData[i].source.width(); 988 qreal h = drawingData[i].scaleY * drawingData[i].source.height(); 989 drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, drawingData[i].source); 991 qreal w = fragments[i].scaleX * fragments[i].width; 992 qreal h = fragments[i].scaleY * fragments[i].height; 993 QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop, 994 fragments[i].width, fragments[i].height); 995 drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, sourceRect); 990 996 } 991 997
Note:
See TracChangeset
for help on using the changeset viewer.