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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrAddPathRenderers_default.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrBatch.h" 10 #include "GrBatch.h"
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 Vertex* a; 1065 Vertex* a;
1066 Vertex* b; 1066 Vertex* b;
1067 front_back_split(*head, &a, &b); 1067 front_back_split(*head, &a, &b);
1068 1068
1069 merge_sort(&a); 1069 merge_sort(&a);
1070 merge_sort(&b); 1070 merge_sort(&b);
1071 1071
1072 *head = sorted_merge(a, b); 1072 *head = sorted_merge(a, b);
1073 } 1073 }
1074 1074
1075 inline void append_vertex(Vertex* v, Vertex** head, Vertex** tail) {
1076 insert<Vertex, &Vertex::fPrev, &Vertex::fNext>(v, *tail, NULL, head, tail);
1077 }
1078
1079 inline void append_vertex_list(Vertex* v, Vertex** head, Vertex** tail) {
1080 insert<Vertex, &Vertex::fPrev, &Vertex::fNext>(v, *tail, v->fNext, head, tai l);
1081 }
1082
1075 Vertex* sorted_merge(Vertex* a, Vertex* b) { 1083 Vertex* sorted_merge(Vertex* a, Vertex* b) {
1076 if (!a) { 1084 Vertex* head = NULL;
1077 return b; 1085 Vertex* tail = NULL;
1078 } else if (!b) { 1086
1079 return a; 1087 while (a && b) {
1088 if (sweep_lt(a->fPoint, b->fPoint)) {
1089 Vertex* next = a->fNext;
1090 append_vertex(a, &head, &tail);
1091 a = next;
1092 } else {
1093 Vertex* next = b->fNext;
1094 append_vertex(b, &head, &tail);
1095 b = next;
1096 }
1080 } 1097 }
1081 1098 if (a) {
1082 Vertex* result = NULL; 1099 append_vertex_list(a, &head, &tail);
1083
1084 if (sweep_lt(a->fPoint, b->fPoint)) {
1085 result = a;
1086 result->fNext = sorted_merge(a->fNext, b);
1087 } else {
1088 result = b;
1089 result->fNext = sorted_merge(a, b->fNext);
1090 } 1100 }
1091 result->fNext->fPrev = result; 1101 if (b) {
1092 return result; 1102 append_vertex_list(b, &head, &tail);
1103 }
1104 return head;
1093 } 1105 }
1094 1106
1095 // Stage 4: Simplify the mesh by inserting new vertices at intersecting edges. 1107 // Stage 4: Simplify the mesh by inserting new vertices at intersecting edges.
1096 1108
1097 void simplify(Vertex* vertices, SkChunkAlloc& alloc) { 1109 void simplify(Vertex* vertices, SkChunkAlloc& alloc) {
1098 LOG("simplifying complex polygons\n"); 1110 LOG("simplifying complex polygons\n");
1099 Edge* activeEdges = NULL; 1111 Edge* activeEdges = NULL;
1100 for (Vertex* v = vertices; v != NULL; v = v->fNext) { 1112 for (Vertex* v = vertices; v != NULL; v = v->fNext) {
1101 if (!v->fFirstEdgeAbove && !v->fFirstEdgeBelow) { 1113 if (!v->fFirstEdgeAbove && !v->fFirstEdgeBelow) {
1102 continue; 1114 continue;
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 SkMatrix vmi; 1492 SkMatrix vmi;
1481 if (!viewM.invert(&vmi)) { 1493 if (!viewM.invert(&vmi)) {
1482 return false; 1494 return false;
1483 } 1495 }
1484 vmi.mapRect(&clipBounds); 1496 vmi.mapRect(&clipBounds);
1485 SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM , clipBounds)); 1497 SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM , clipBounds));
1486 target->drawBatch(pipelineBuilder, batch); 1498 target->drawBatch(pipelineBuilder, batch);
1487 1499
1488 return true; 1500 return true;
1489 } 1501 }
OLDNEW
« 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