Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: src/gpu/GrTessellatingPathRenderer.cpp

Issue 1080113004: Enable tessellating GPU path renderer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add back enable Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrAddPathRenderers_default.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTessellatingPathRenderer.cpp
diff --git a/src/gpu/GrTessellatingPathRenderer.cpp b/src/gpu/GrTessellatingPathRenderer.cpp
index e9e8da240b0a93bc46b5490f237c3cf5395719fe..14176db4ecef0e2b2dbd7c31f2c3ed3658e0a41b 100644
--- a/src/gpu/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/GrTessellatingPathRenderer.cpp
@@ -1072,24 +1072,36 @@ void merge_sort(Vertex** head) {
*head = sorted_merge(a, b);
}
-Vertex* sorted_merge(Vertex* a, Vertex* b) {
- if (!a) {
- return b;
- } else if (!b) {
- return a;
- }
+inline void append_vertex(Vertex* v, Vertex** head, Vertex** tail) {
+ insert<Vertex, &Vertex::fPrev, &Vertex::fNext>(v, *tail, NULL, head, tail);
+}
- Vertex* result = NULL;
+inline void append_vertex_list(Vertex* v, Vertex** head, Vertex** tail) {
+ insert<Vertex, &Vertex::fPrev, &Vertex::fNext>(v, *tail, v->fNext, head, tail);
+}
- if (sweep_lt(a->fPoint, b->fPoint)) {
- result = a;
- result->fNext = sorted_merge(a->fNext, b);
- } else {
- result = b;
- result->fNext = sorted_merge(a, b->fNext);
+Vertex* sorted_merge(Vertex* a, Vertex* b) {
+ Vertex* head = NULL;
+ Vertex* tail = NULL;
+
+ while (a && b) {
+ if (sweep_lt(a->fPoint, b->fPoint)) {
+ Vertex* next = a->fNext;
+ append_vertex(a, &head, &tail);
+ a = next;
+ } else {
+ Vertex* next = b->fNext;
+ append_vertex(b, &head, &tail);
+ b = next;
+ }
+ }
+ if (a) {
+ append_vertex_list(a, &head, &tail);
+ }
+ if (b) {
+ append_vertex_list(b, &head, &tail);
}
- result->fNext->fPrev = result;
- return result;
+ return head;
}
// Stage 4: Simplify the mesh by inserting new vertices at intersecting edges.
« no previous file with comments | « src/gpu/GrAddPathRenderers_default.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698