| 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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 SkSTArray<kPreallocDrawCnt, Draw, true> draws; | 663 SkSTArray<kPreallocDrawCnt, Draw, true> draws; |
| 664 create_vertices(segments, fanPt, &draws, verts, idxs); | 664 create_vertices(segments, fanPt, &draws, verts, idxs); |
| 665 | 665 |
| 666 // This is valid because all the computed verts are within 1 pixel of the pa
th control points. | 666 // This is valid because all the computed verts are within 1 pixel of the pa
th control points. |
| 667 SkRect devBounds; | 667 SkRect devBounds; |
| 668 devBounds = path->getBounds(); | 668 devBounds = path->getBounds(); |
| 669 viewMatrix.mapRect(&devBounds); | 669 viewMatrix.mapRect(&devBounds); |
| 670 devBounds.outset(SK_Scalar1, SK_Scalar1); | 670 devBounds.outset(SK_Scalar1, SK_Scalar1); |
| 671 | 671 |
| 672 // Check devBounds | 672 // Check devBounds |
| 673 #if GR_DEBUG | 673 #ifdef SK_DEBUG |
| 674 SkRect tolDevBounds = devBounds; | 674 SkRect tolDevBounds = devBounds; |
| 675 tolDevBounds.outset(SK_Scalar1 / 10000, SK_Scalar1 / 10000); | 675 tolDevBounds.outset(SK_Scalar1 / 10000, SK_Scalar1 / 10000); |
| 676 SkRect actualBounds; | 676 SkRect actualBounds; |
| 677 actualBounds.set(verts[0].fPos, verts[1].fPos); | 677 actualBounds.set(verts[0].fPos, verts[1].fPos); |
| 678 for (int i = 2; i < vCount; ++i) { | 678 for (int i = 2; i < vCount; ++i) { |
| 679 actualBounds.growToInclude(verts[i].fPos.fX, verts[i].fPos.fY); | 679 actualBounds.growToInclude(verts[i].fPos.fX, verts[i].fPos.fY); |
| 680 } | 680 } |
| 681 SkASSERT(tolDevBounds.contains(actualBounds)); | 681 SkASSERT(tolDevBounds.contains(actualBounds)); |
| 682 #endif | 682 #endif |
| 683 | 683 |
| 684 int vOffset = 0; | 684 int vOffset = 0; |
| 685 for (int i = 0; i < draws.count(); ++i) { | 685 for (int i = 0; i < draws.count(); ++i) { |
| 686 const Draw& draw = draws[i]; | 686 const Draw& draw = draws[i]; |
| 687 target->drawIndexed(kTriangles_GrPrimitiveType, | 687 target->drawIndexed(kTriangles_GrPrimitiveType, |
| 688 vOffset, // start vertex | 688 vOffset, // start vertex |
| 689 0, // start index | 689 0, // start index |
| 690 draw.fVertexCnt, | 690 draw.fVertexCnt, |
| 691 draw.fIndexCnt, | 691 draw.fIndexCnt, |
| 692 &devBounds); | 692 &devBounds); |
| 693 vOffset += draw.fVertexCnt; | 693 vOffset += draw.fVertexCnt; |
| 694 } | 694 } |
| 695 | 695 |
| 696 return true; | 696 return true; |
| 697 } | 697 } |
| OLD | NEW |