| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrAAConvexPathRenderer.h" | 9 #include "GrAAConvexPathRenderer.h" |
| 10 | 10 |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 if (!arg.succeeded()) { | 653 if (!arg.succeeded()) { |
| 654 return false; | 654 return false; |
| 655 } | 655 } |
| 656 GrAssert(sizeof(QuadVertex) == drawState->getVertexSize()); | 656 GrAssert(sizeof(QuadVertex) == drawState->getVertexSize()); |
| 657 verts = reinterpret_cast<QuadVertex*>(arg.vertices()); | 657 verts = reinterpret_cast<QuadVertex*>(arg.vertices()); |
| 658 idxs = reinterpret_cast<uint16_t*>(arg.indices()); | 658 idxs = reinterpret_cast<uint16_t*>(arg.indices()); |
| 659 | 659 |
| 660 SkSTArray<kPreallocDrawCnt, Draw, true> draws; | 660 SkSTArray<kPreallocDrawCnt, Draw, true> draws; |
| 661 create_vertices(segments, fanPt, &draws, verts, idxs); | 661 create_vertices(segments, fanPt, &draws, verts, idxs); |
| 662 | 662 |
| 663 // This is valid because all the computed verts are within 1 pixel of the pa
th control points. |
| 664 SkRect devBounds; |
| 665 devBounds = origPath.getBounds(); |
| 666 adcd.getOriginalMatrix().mapRect(&devBounds); |
| 667 devBounds.outset(SK_Scalar1, SK_Scalar1); |
| 668 |
| 669 // Check devBounds |
| 670 #if GR_DEBUG |
| 671 SkRect tolDevBounds = devBounds; |
| 672 tolDevBounds.outset(SK_Scalar1 / 10000, SK_Scalar1 / 10000); |
| 673 SkRect actualBounds; |
| 674 actualBounds.set(verts[0].fPos, verts[1].fPos); |
| 675 for (int i = 2; i < vCount; ++i) { |
| 676 actualBounds.growToInclude(verts[i].fPos.fX, verts[i].fPos.fY); |
| 677 } |
| 678 GrAssert(tolDevBounds.contains(actualBounds)); |
| 679 #endif |
| 680 |
| 663 int vOffset = 0; | 681 int vOffset = 0; |
| 664 for (int i = 0; i < draws.count(); ++i) { | 682 for (int i = 0; i < draws.count(); ++i) { |
| 665 const Draw& draw = draws[i]; | 683 const Draw& draw = draws[i]; |
| 666 target->drawIndexed(kTriangles_GrPrimitiveType, | 684 target->drawIndexed(kTriangles_GrPrimitiveType, |
| 667 vOffset, // start vertex | 685 vOffset, // start vertex |
| 668 0, // start index | 686 0, // start index |
| 669 draw.fVertexCnt, | 687 draw.fVertexCnt, |
| 670 draw.fIndexCnt); | 688 draw.fIndexCnt, |
| 689 &devBounds); |
| 671 vOffset += draw.fVertexCnt; | 690 vOffset += draw.fVertexCnt; |
| 672 } | 691 } |
| 673 | 692 |
| 674 return true; | 693 return true; |
| 675 } | 694 } |
| OLD | NEW |