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 "GrDefaultGeoProcFactory.h" | 10 #include "GrDefaultGeoProcFactory.h" |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 !edge->isLeftOf(rightBottom)) { | 951 !edge->isLeftOf(rightBottom)) { |
952 split_edge(edge, rightBottom, activeEdges, alloc); | 952 split_edge(edge, rightBottom, activeEdges, alloc); |
953 } | 953 } |
954 } | 954 } |
955 } | 955 } |
956 | 956 |
957 void split_edge(Edge* edge, Vertex* v, Edge** activeEdges, SkChunkAlloc& alloc)
{ | 957 void split_edge(Edge* edge, Vertex* v, Edge** activeEdges, SkChunkAlloc& alloc)
{ |
958 LOG("splitting edge (%g -> %g) at vertex %g (%g, %g)\n", | 958 LOG("splitting edge (%g -> %g) at vertex %g (%g, %g)\n", |
959 edge->fTop->fID, edge->fBottom->fID, | 959 edge->fTop->fID, edge->fBottom->fID, |
960 v->fID, v->fPoint.fX, v->fPoint.fY); | 960 v->fID, v->fPoint.fX, v->fPoint.fY); |
961 Edge* newEdge = ALLOC_NEW(Edge, (v, edge->fBottom, edge->fWinding), alloc); | 961 if (sweep_lt(v->fPoint, edge->fTop->fPoint)) { |
962 insert_edge_below(newEdge, v); | 962 set_top(edge, v, activeEdges); |
963 insert_edge_above(newEdge, edge->fBottom); | 963 } else if (sweep_gt(v->fPoint, edge->fBottom->fPoint)) { |
964 set_bottom(edge, v, activeEdges); | 964 set_bottom(edge, v, activeEdges); |
965 cleanup_active_edges(edge, activeEdges, alloc); | 965 } else { |
966 fix_active_state(newEdge, activeEdges); | 966 Edge* newEdge = ALLOC_NEW(Edge, (v, edge->fBottom, edge->fWinding), allo
c); |
967 merge_collinear_edges(newEdge, activeEdges); | 967 insert_edge_below(newEdge, v); |
| 968 insert_edge_above(newEdge, edge->fBottom); |
| 969 set_bottom(edge, v, activeEdges); |
| 970 cleanup_active_edges(edge, activeEdges, alloc); |
| 971 fix_active_state(newEdge, activeEdges); |
| 972 merge_collinear_edges(newEdge, activeEdges); |
| 973 } |
968 } | 974 } |
969 | 975 |
970 void merge_vertices(Vertex* src, Vertex* dst, Vertex** head, SkChunkAlloc& alloc
) { | 976 void merge_vertices(Vertex* src, Vertex* dst, Vertex** head, SkChunkAlloc& alloc
) { |
971 LOG("found coincident verts at %g, %g; merging %g into %g\n", src->fPoint.fX
, src->fPoint.fY, | 977 LOG("found coincident verts at %g, %g; merging %g into %g\n", src->fPoint.fX
, src->fPoint.fY, |
972 src->fID, dst->fID); | 978 src->fID, dst->fID); |
973 for (Edge* edge = src->fFirstEdgeAbove; edge;) { | 979 for (Edge* edge = src->fFirstEdgeAbove; edge;) { |
974 Edge* next = edge->fNextEdgeAbove; | 980 Edge* next = edge->fNextEdgeAbove; |
975 set_bottom(edge, dst, NULL); | 981 set_bottom(edge, dst, NULL); |
976 edge = next; | 982 edge = next; |
977 } | 983 } |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 int actualCount = static_cast<int>((static_cast<char*>(end) - static_cast<ch
ar*>(arg.vertices())) / stride); | 1505 int actualCount = static_cast<int>((static_cast<char*>(end) - static_cast<ch
ar*>(arg.vertices())) / stride); |
1500 LOG("actual count: %d\n", actualCount); | 1506 LOG("actual count: %d\n", actualCount); |
1501 SkASSERT(actualCount <= count); | 1507 SkASSERT(actualCount <= count); |
1502 | 1508 |
1503 GrPrimitiveType primitiveType = WIREFRAME ? kLines_GrPrimitiveType | 1509 GrPrimitiveType primitiveType = WIREFRAME ? kLines_GrPrimitiveType |
1504 : kTriangles_GrPrimitiveType; | 1510 : kTriangles_GrPrimitiveType; |
1505 target->drawNonIndexed(pipelineBuilder, gp, primitiveType, 0, actualCount); | 1511 target->drawNonIndexed(pipelineBuilder, gp, primitiveType, 0, actualCount); |
1506 | 1512 |
1507 return true; | 1513 return true; |
1508 } | 1514 } |
OLD | NEW |