450 return; |
450 return; |
451 } |
451 } |
452 #endif |
452 #endif |
453 |
453 |
454 if (join == FlatJoin) { |
454 if (join == FlatJoin) { |
|
455 QLineF prevLine(qt_fixed_to_real(m_back2X), qt_fixed_to_real(m_back2Y), |
|
456 qt_fixed_to_real(m_back1X), qt_fixed_to_real(m_back1Y)); |
|
457 QPointF isect; |
|
458 QLineF::IntersectType type = prevLine.intersect(nextLine, &isect); |
|
459 QLineF shortCut(prevLine.p2(), nextLine.p1()); |
|
460 qreal angle = shortCut.angleTo(prevLine); |
|
461 if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { |
|
462 emitLineTo(focal_x, focal_y); |
|
463 emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); |
|
464 return; |
|
465 } |
455 emitLineTo(qt_real_to_fixed(nextLine.x1()), |
466 emitLineTo(qt_real_to_fixed(nextLine.x1()), |
456 qt_real_to_fixed(nextLine.y1())); |
467 qt_real_to_fixed(nextLine.y1())); |
457 |
468 |
458 } else { |
469 } else { |
459 QLineF prevLine(qt_fixed_to_real(m_back2X), qt_fixed_to_real(m_back2Y), |
470 QLineF prevLine(qt_fixed_to_real(m_back2X), qt_fixed_to_real(m_back2Y), |
466 qreal appliedMiterLimit = qt_fixed_to_real(m_strokeWidth * m_miterLimit); |
477 qreal appliedMiterLimit = qt_fixed_to_real(m_strokeWidth * m_miterLimit); |
467 |
478 |
468 // If we are on the inside, do the short cut... |
479 // If we are on the inside, do the short cut... |
469 QLineF shortCut(prevLine.p2(), nextLine.p1()); |
480 QLineF shortCut(prevLine.p2(), nextLine.p1()); |
470 qreal angle = shortCut.angleTo(prevLine); |
481 qreal angle = shortCut.angleTo(prevLine); |
471 |
|
472 if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { |
482 if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { |
|
483 emitLineTo(focal_x, focal_y); |
473 emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); |
484 emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); |
474 return; |
485 return; |
475 } |
486 } |
476 QLineF miterLine(QPointF(qt_fixed_to_real(m_back1X), |
487 QLineF miterLine(QPointF(qt_fixed_to_real(m_back1X), |
477 qt_fixed_to_real(m_back1Y)), isect); |
488 qt_fixed_to_real(m_back1Y)), isect); |
507 |
518 |
508 } else if (join == RoundJoin) { |
519 } else if (join == RoundJoin) { |
509 qfixed offset = m_strokeWidth / 2; |
520 qfixed offset = m_strokeWidth / 2; |
510 |
521 |
511 QLineF shortCut(prevLine.p2(), nextLine.p1()); |
522 QLineF shortCut(prevLine.p2(), nextLine.p1()); |
512 qreal angle = prevLine.angle(shortCut); |
523 qreal angle = shortCut.angleTo(prevLine); |
513 if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { |
524 if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { |
|
525 emitLineTo(focal_x, focal_y); |
514 emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); |
526 emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); |
515 return; |
527 return; |
516 } |
528 } |
517 qreal l1_on_x = adapted_angle_on_x(prevLine); |
529 qreal l1_on_x = adapted_angle_on_x(prevLine); |
518 qreal l2_on_x = adapted_angle_on_x(nextLine); |
530 qreal l2_on_x = adapted_angle_on_x(nextLine); |
579 qt_real_to_fixed(l1.x2()), |
591 qt_real_to_fixed(l1.x2()), |
580 qt_real_to_fixed(l1.y2()), |
592 qt_real_to_fixed(l1.y2()), |
581 qt_real_to_fixed(l1.x1()), |
593 qt_real_to_fixed(l1.x1()), |
582 qt_real_to_fixed(l1.y1())); |
594 qt_real_to_fixed(l1.y1())); |
583 } else if (join == SvgMiterJoin) { |
595 } else if (join == SvgMiterJoin) { |
|
596 QLineF shortCut(prevLine.p2(), nextLine.p1()); |
|
597 qreal angle = shortCut.angleTo(prevLine); |
|
598 if (type == QLineF::BoundedIntersection || (angle > 90 && !qFuzzyCompare(angle, (qreal)90))) { |
|
599 emitLineTo(focal_x, focal_y); |
|
600 emitLineTo(qt_real_to_fixed(nextLine.x1()), qt_real_to_fixed(nextLine.y1())); |
|
601 return; |
|
602 } |
584 QLineF miterLine(QPointF(qt_fixed_to_real(focal_x), |
603 QLineF miterLine(QPointF(qt_fixed_to_real(focal_x), |
585 qt_fixed_to_real(focal_y)), isect); |
604 qt_fixed_to_real(focal_y)), isect); |
586 if (miterLine.length() > qt_fixed_to_real(m_strokeWidth * m_miterLimit) / 2) { |
605 if (miterLine.length() > qt_fixed_to_real(m_strokeWidth * m_miterLimit) / 2) { |
587 emitLineTo(qt_real_to_fixed(nextLine.x1()), |
606 emitLineTo(qt_real_to_fixed(nextLine.x1()), |
588 qt_real_to_fixed(nextLine.y1())); |
607 qt_real_to_fixed(nextLine.y1())); |
889 curves[(*point_count)++] = points[i]; |
908 curves[(*point_count)++] = points[i]; |
890 return points[0]; |
909 return points[0]; |
891 } |
910 } |
892 } |
911 } |
893 |
912 |
894 int startSegment = int(floor(startAngle / 90)); |
913 int startSegment = int(qFloor(startAngle / 90)); |
895 int endSegment = int(floor((startAngle + sweepLength) / 90)); |
914 int endSegment = int(qFloor((startAngle + sweepLength) / 90)); |
896 |
915 |
897 qreal startT = (startAngle - startSegment * 90) / 90; |
916 qreal startT = (startAngle - startSegment * 90) / 90; |
898 qreal endT = (startAngle + sweepLength - endSegment * 90) / 90; |
917 qreal endT = (startAngle + sweepLength - endSegment * 90) / 90; |
899 |
918 |
900 int delta = sweepLength > 0 ? 1 : -1; |
919 int delta = sweepLength > 0 ? 1 : -1; |