| 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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 }; | 473 }; |
| 474 SkSTArray<kPreallocSegmentCnt, Segment, true> segments; | 474 SkSTArray<kPreallocSegmentCnt, Segment, true> segments; |
| 475 SkPoint fanPt; | 475 SkPoint fanPt; |
| 476 | 476 |
| 477 if (!get_segments(*path, *vm, &segments, &fanPt, &vCount, &iCount)) { | 477 if (!get_segments(*path, *vm, &segments, &fanPt, &vCount, &iCount)) { |
| 478 return false; | 478 return false; |
| 479 } | 479 } |
| 480 | 480 |
| 481 // position + edge | 481 // position + edge |
| 482 static const GrVertexAttrib kAttribs[] = { | 482 static const GrVertexAttrib kAttribs[] = { |
| 483 GrVertexAttrib(kVec2f_GrVertexAttribType, 0), | 483 {kVec2f_GrVertexAttribType, 0}, |
| 484 GrVertexAttrib(kVec4f_GrVertexAttribType, sizeof(GrPoint)) | 484 {kVec4f_GrVertexAttribType, sizeof(GrPoint)} |
| 485 }; | 485 }; |
| 486 static const GrAttribBindings bindings = GrDrawState::kEdge_AttribBindingsBi
t; | 486 static const GrAttribBindings bindings = GrDrawState::kEdge_AttribBindingsBi
t; |
| 487 | 487 |
| 488 drawState->setVertexAttribs(kAttribs, SK_ARRAY_COUNT(kAttribs)); | 488 drawState->setVertexAttribs(kAttribs, SK_ARRAY_COUNT(kAttribs)); |
| 489 drawState->setAttribIndex(GrDrawState::kPosition_AttribIndex, 0); | 489 drawState->setAttribIndex(GrDrawState::kPosition_AttribIndex, 0); |
| 490 drawState->setAttribIndex(GrDrawState::kEdge_AttribIndex, 1); | 490 drawState->setAttribIndex(GrDrawState::kEdge_AttribIndex, 1); |
| 491 drawState->setAttribBindings(bindings); | 491 drawState->setAttribBindings(bindings); |
| 492 GrDrawTarget::AutoReleaseGeometry arg(target, vCount, iCount); | 492 GrDrawTarget::AutoReleaseGeometry arg(target, vCount, iCount); |
| 493 if (!arg.succeeded()) { | 493 if (!arg.succeeded()) { |
| 494 return false; | 494 return false; |
| 495 } | 495 } |
| 496 GrAssert(sizeof(QuadVertex) == drawState->getVertexSize()); | 496 GrAssert(sizeof(QuadVertex) == drawState->getVertexSize()); |
| 497 verts = reinterpret_cast<QuadVertex*>(arg.vertices()); | 497 verts = reinterpret_cast<QuadVertex*>(arg.vertices()); |
| 498 idxs = reinterpret_cast<uint16_t*>(arg.indices()); | 498 idxs = reinterpret_cast<uint16_t*>(arg.indices()); |
| 499 | 499 |
| 500 create_vertices(segments, fanPt, verts, idxs); | 500 create_vertices(segments, fanPt, verts, idxs); |
| 501 | 501 |
| 502 GrDrawState::VertexEdgeType oldEdgeType = drawState->getVertexEdgeType(); | 502 GrDrawState::VertexEdgeType oldEdgeType = drawState->getVertexEdgeType(); |
| 503 drawState->setVertexEdgeType(GrDrawState::kQuad_EdgeType); | 503 drawState->setVertexEdgeType(GrDrawState::kQuad_EdgeType); |
| 504 target->drawIndexed(kTriangles_GrPrimitiveType, | 504 target->drawIndexed(kTriangles_GrPrimitiveType, |
| 505 0, // start vertex | 505 0, // start vertex |
| 506 0, // start index | 506 0, // start index |
| 507 vCount, | 507 vCount, |
| 508 iCount); | 508 iCount); |
| 509 drawState->setVertexEdgeType(oldEdgeType); | 509 drawState->setVertexEdgeType(oldEdgeType); |
| 510 | 510 |
| 511 return true; | 511 return true; |
| 512 } | 512 } |
| OLD | NEW |