1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
8 ** |
8 ** |
415 if (style == Qt::SolidLine) { |
415 if (style == Qt::SolidLine) { |
416 d->activeStroker = &d->stroker; |
416 d->activeStroker = &d->stroker; |
417 } else if (style == Qt::NoPen) { |
417 } else if (style == Qt::NoPen) { |
418 d->activeStroker = 0; |
418 d->activeStroker = 0; |
419 } else { |
419 } else { |
420 // ### re-enable... |
|
421 if (pen.isCosmetic()) { |
|
422 d->dasher.setClipRect(d->exDeviceRect); |
|
423 } else { |
|
424 QRectF clipRect = state()->matrix.inverted().mapRect(QRectF(d->exDeviceRect)); |
|
425 d->dasher.setClipRect(clipRect); |
|
426 } |
|
427 d->dasher.setDashPattern(pen.dashPattern()); |
420 d->dasher.setDashPattern(pen.dashPattern()); |
428 d->dasher.setDashOffset(pen.dashOffset()); |
421 d->dasher.setDashOffset(pen.dashOffset()); |
429 d->activeStroker = &d->dasher; |
422 d->activeStroker = &d->dasher; |
430 } |
423 } |
431 } |
424 } |
432 |
425 |
433 if (!d->activeStroker) { |
426 if (!d->activeStroker) { |
434 return; |
427 return; |
|
428 } |
|
429 |
|
430 if (pen.style() > Qt::SolidLine) { |
|
431 if (pen.isCosmetic()) { |
|
432 d->activeStroker->setClipRect(d->exDeviceRect); |
|
433 } else { |
|
434 QRectF clipRect = state()->matrix.inverted().mapRect(QRectF(d->exDeviceRect)); |
|
435 d->activeStroker->setClipRect(clipRect); |
|
436 } |
435 } |
437 } |
436 |
438 |
437 const QPainterPath::ElementType *types = path.elements(); |
439 const QPainterPath::ElementType *types = path.elements(); |
438 const qreal *points = path.points(); |
440 const qreal *points = path.points(); |
439 int pointCount = path.elementCount(); |
441 int pointCount = path.elementCount(); |
858 qreal pts[64]; |
860 qreal pts[64]; |
859 int oset = -1; |
861 int oset = -1; |
860 for (int i=0; i<count; ++i) { |
862 for (int i=0; i<count; ++i) { |
861 pts[++oset] = points[i].x(); |
863 pts[++oset] = points[i].x(); |
862 pts[++oset] = points[i].y(); |
864 pts[++oset] = points[i].y(); |
863 pts[++oset] = points[i].x() + 0.001; |
865 pts[++oset] = points[i].x() + 1/63.; |
864 pts[++oset] = points[i].y(); |
866 pts[++oset] = points[i].y(); |
865 } |
867 } |
866 QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint); |
868 QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint); |
867 stroke(path, pen); |
869 stroke(path, pen); |
868 pointCount -= 16; |
870 pointCount -= 16; |
869 points += 16; |
871 points += 16; |
870 } |
872 } |
871 } else { |
873 } else { |
872 for (int i=0; i<pointCount; ++i) { |
874 for (int i=0; i<pointCount; ++i) { |
873 qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + 0.001, points[i].y() }; |
875 qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + 1/63., points[i].y() }; |
874 QVectorPath path(pts, 2, 0); |
876 QVectorPath path(pts, 2, 0); |
875 stroke(path, pen); |
877 stroke(path, pen); |
876 } |
878 } |
877 } |
879 } |
878 } |
880 } |
889 qreal pts[64]; |
891 qreal pts[64]; |
890 int oset = -1; |
892 int oset = -1; |
891 for (int i=0; i<count; ++i) { |
893 for (int i=0; i<count; ++i) { |
892 pts[++oset] = points[i].x(); |
894 pts[++oset] = points[i].x(); |
893 pts[++oset] = points[i].y(); |
895 pts[++oset] = points[i].y(); |
894 pts[++oset] = points[i].x() + 0.001; |
896 pts[++oset] = points[i].x() + 1/63; |
895 pts[++oset] = points[i].y(); |
897 pts[++oset] = points[i].y(); |
896 } |
898 } |
897 QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint); |
899 QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint); |
898 stroke(path, pen); |
900 stroke(path, pen); |
899 pointCount -= 16; |
901 pointCount -= 16; |
900 points += 16; |
902 points += 16; |
901 } |
903 } |
902 } else { |
904 } else { |
903 for (int i=0; i<pointCount; ++i) { |
905 for (int i=0; i<pointCount; ++i) { |
904 qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + 0.001, points[i].y() }; |
906 qreal pts[] = { points[i].x(), points[i].y(), points[i].x() +1/63., points[i].y() }; |
905 QVectorPath path(pts, 2, 0); |
907 QVectorPath path(pts, 2, 0); |
906 stroke(path, pen); |
908 stroke(path, pen); |
907 } |
909 } |
908 } |
910 } |
909 } |
911 } |