- 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/opengl/gl2paintengineex/qtriangulatingstroker.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) … … 74 74 75 75 76 void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen )76 void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen, const QRectF &) 77 77 { 78 78 const qreal *pts = path.points(); … … 112 112 // 113 113 // The curvyness value of PI/14 was based on, 114 // arcLength =2*PI*r/4=PI/2 and splitting length into somewhere114 // arcLength = 2*PI*r/4 = PI*r/2 and splitting length into somewhere 115 115 // between 3 and 8 where 5 seemed to be give pretty good results 116 116 // hence: Q_PI/14. Lower divisors will give more detail at the … … 482 482 483 483 QDashedStrokeProcessor::QDashedStrokeProcessor() 484 : m_dash_stroker(0), m_inv_scale(1) 484 : m_points(0), m_types(0), 485 m_dash_stroker(0), m_inv_scale(1) 485 486 { 486 487 m_dash_stroker.setMoveToHook(qdashprocessor_moveTo); … … 489 490 } 490 491 491 void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen )492 void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, const QRectF &clip) 492 493 { 493 494 … … 496 497 int count = path.elementCount(); 497 498 499 bool cosmetic = pen.isCosmetic(); 500 498 501 m_points.reset(); 499 502 m_types.reset(); 503 m_points.reserve(path.elementCount()); 504 m_types.reserve(path.elementCount()); 500 505 501 506 qreal width = qpen_widthf(pen); … … 504 509 505 510 m_dash_stroker.setDashPattern(pen.dashPattern()); 506 m_dash_stroker.setStrokeWidth(pen.isCosmetic() ? width * m_inv_scale : width); 511 m_dash_stroker.setStrokeWidth(cosmetic ? width * m_inv_scale : width); 512 m_dash_stroker.setDashOffset(pen.dashOffset()); 507 513 m_dash_stroker.setMiterLimit(pen.miterLimit()); 508 qreal curvyness = sqrt(width) * m_inv_scale / 8; 514 m_dash_stroker.setClipRect(clip); 515 516 float curvynessAdd, curvynessMul, roundness = 0; 517 518 // simplfy pens that are thin in device size (2px wide or less) 519 if (width < 2.5 && (cosmetic || m_inv_scale == 1)) { 520 curvynessAdd = 0.5; 521 curvynessMul = CURVE_FLATNESS / m_inv_scale; 522 roundness = 1; 523 } else if (cosmetic) { 524 curvynessAdd= width / 2; 525 curvynessMul= CURVE_FLATNESS; 526 roundness = qMax<int>(4, width * CURVE_FLATNESS); 527 } else { 528 curvynessAdd = width * m_inv_scale; 529 curvynessMul = CURVE_FLATNESS / m_inv_scale; 530 roundness = qMax<int>(4, width * curvynessMul); 531 } 509 532 510 533 if (count < 2) … … 541 564 *(((const QPointF *) pts) + 2)); 542 565 QRectF bounds = b.bounds(); 543 int threshold = qMin<float>(64, qMax(bounds.width(), bounds.height()) * curvyness); 566 float rad = qMax(bounds.width(), bounds.height()); 567 int threshold = qMin<float>(64, (rad + curvynessAdd) * curvynessMul); 544 568 if (threshold < 4) 545 569 threshold = 4; 570 546 571 qreal threshold_minus_1 = threshold - 1; 547 572 for (int i=0; i<threshold; ++i) {
Note:
See TracChangeset
for help on using the changeset viewer.