OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrTessellatingPathRenderer.h" | 8 #include "GrTessellatingPathRenderer.h" |
9 | 9 |
10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 head = prev = NULL; | 558 head = prev = NULL; |
559 } | 559 } |
560 SkAutoConicToQuads converter; | 560 SkAutoConicToQuads converter; |
561 while (!done) { | 561 while (!done) { |
562 SkPath::Verb verb = iter.next(pts); | 562 SkPath::Verb verb = iter.next(pts); |
563 switch (verb) { | 563 switch (verb) { |
564 case SkPath::kConic_Verb: { | 564 case SkPath::kConic_Verb: { |
565 SkScalar weight = iter.conicWeight(); | 565 SkScalar weight = iter.conicWeight(); |
566 const SkPoint* quadPts = converter.computeQuads(pts, weight, tol
eranceSqd); | 566 const SkPoint* quadPts = converter.computeQuads(pts, weight, tol
eranceSqd); |
567 for (int i = 0; i < converter.countQuads(); ++i) { | 567 for (int i = 0; i < converter.countQuads(); ++i) { |
568 int pointsLeft = GrPathUtils::quadraticPointCount(quadPts, t
oleranceSqd); | 568 int pointsLeft = GrPathUtils::quadraticPointCount(quadPts, t
olerance); |
569 prev = generate_quadratic_points(quadPts[0], quadPts[1], qua
dPts[2], | 569 prev = generate_quadratic_points(quadPts[0], quadPts[1], qua
dPts[2], |
570 toleranceSqd, prev, &head,
pointsLeft, alloc); | 570 toleranceSqd, prev, &head,
pointsLeft, alloc); |
571 quadPts += 2; | 571 quadPts += 2; |
572 } | 572 } |
573 break; | 573 break; |
574 } | 574 } |
575 case SkPath::kMove_Verb: | 575 case SkPath::kMove_Verb: |
576 if (head) { | 576 if (head) { |
577 head->fPrev = prev; | 577 head->fPrev = prev; |
578 prev->fNext = head; | 578 prev->fNext = head; |
579 *contours++ = head; | 579 *contours++ = head; |
580 } | 580 } |
581 head = prev = NULL; | 581 head = prev = NULL; |
582 prev = append_point_to_contour(pts[0], prev, &head, alloc); | 582 prev = append_point_to_contour(pts[0], prev, &head, alloc); |
583 break; | 583 break; |
584 case SkPath::kLine_Verb: { | 584 case SkPath::kLine_Verb: { |
585 prev = append_point_to_contour(pts[1], prev, &head, alloc); | 585 prev = append_point_to_contour(pts[1], prev, &head, alloc); |
586 break; | 586 break; |
587 } | 587 } |
588 case SkPath::kQuad_Verb: { | 588 case SkPath::kQuad_Verb: { |
589 int pointsLeft = GrPathUtils::quadraticPointCount(pts, tolerance
Sqd); | 589 int pointsLeft = GrPathUtils::quadraticPointCount(pts, tolerance
); |
590 prev = generate_quadratic_points(pts[0], pts[1], pts[2], toleran
ceSqd, prev, | 590 prev = generate_quadratic_points(pts[0], pts[1], pts[2], toleran
ceSqd, prev, |
591 &head, pointsLeft, alloc); | 591 &head, pointsLeft, alloc); |
592 break; | 592 break; |
593 } | 593 } |
594 case SkPath::kCubic_Verb: { | 594 case SkPath::kCubic_Verb: { |
595 int pointsLeft = GrPathUtils::cubicPointCount(pts, toleranceSqd)
; | 595 int pointsLeft = GrPathUtils::cubicPointCount(pts, tolerance); |
596 prev = generate_cubic_points(pts[0], pts[1], pts[2], pts[3], | 596 prev = generate_cubic_points(pts[0], pts[1], pts[2], pts[3], |
597 toleranceSqd, prev, &head, pointsLeft, alloc); | 597 toleranceSqd, prev, &head, pointsLeft, alloc); |
598 break; | 598 break; |
599 } | 599 } |
600 case SkPath::kClose_Verb: | 600 case SkPath::kClose_Verb: |
601 if (head) { | 601 if (head) { |
602 head->fPrev = prev; | 602 head->fPrev = prev; |
603 prev->fNext = head; | 603 prev->fNext = head; |
604 *contours++ = head; | 604 *contours++ = head; |
605 } | 605 } |
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 SkMatrix vmi; | 1511 SkMatrix vmi; |
1512 if (!viewM.invert(&vmi)) { | 1512 if (!viewM.invert(&vmi)) { |
1513 return false; | 1513 return false; |
1514 } | 1514 } |
1515 vmi.mapRect(&clipBounds); | 1515 vmi.mapRect(&clipBounds); |
1516 SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM
, clipBounds)); | 1516 SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM
, clipBounds)); |
1517 target->drawBatch(pipelineBuilder, batch); | 1517 target->drawBatch(pipelineBuilder, batch); |
1518 | 1518 |
1519 return true; | 1519 return true; |
1520 } | 1520 } |
OLD | NEW |