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

Side by Side Diff: src/pathops/SkOpContour.cpp

Issue 1096923003: working on initial winding for cubics (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/pathops/SkOpContour.h ('k') | src/pathops/SkOpEdgeBuilder.cpp » ('j') | 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 2013 Google Inc. 2 * Copyright 2013 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 #include "SkOpContour.h" 7 #include "SkOpContour.h"
8 #include "SkOpTAllocator.h" 8 #include "SkOpTAllocator.h"
9 #include "SkPathWriter.h" 9 #include "SkPathWriter.h"
10 #include "SkReduceOrder.h" 10 #include "SkReduceOrder.h"
11 #include "SkTSort.h" 11 #include "SkTSort.h"
12 12
13 void SkOpContour::addCurve(SkPath::Verb verb, const SkPoint pts[4], SkChunkAlloc * allocator) { 13 SkOpSegment* SkOpContour::addCurve(SkPath::Verb verb, const SkPoint pts[4],
14 SkChunkAlloc* allocator) {
14 switch (verb) { 15 switch (verb) {
15 case SkPath::kLine_Verb: { 16 case SkPath::kLine_Verb: {
16 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 2); 17 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 2);
17 memcpy(ptStorage, pts, sizeof(SkPoint) * 2); 18 memcpy(ptStorage, pts, sizeof(SkPoint) * 2);
18 appendSegment(allocator).addLine(ptStorage, this); 19 return appendSegment(allocator).addLine(ptStorage, this);
19 } break; 20 } break;
20 case SkPath::kQuad_Verb: { 21 case SkPath::kQuad_Verb: {
21 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 3); 22 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 3);
22 memcpy(ptStorage, pts, sizeof(SkPoint) * 3); 23 memcpy(ptStorage, pts, sizeof(SkPoint) * 3);
23 appendSegment(allocator).addQuad(ptStorage, this); 24 return appendSegment(allocator).addQuad(ptStorage, this);
24 } break; 25 } break;
25 case SkPath::kConic_Verb: { 26 case SkPath::kConic_Verb: {
26 SkASSERT(0); // the original curve is a cubic, which will never red uce to a conic 27 SkASSERT(0); // the original curve is a cubic, which will never red uce to a conic
27 } break; 28 } break;
28 case SkPath::kCubic_Verb: { 29 case SkPath::kCubic_Verb: {
29 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 4); 30 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 4);
30 memcpy(ptStorage, pts, sizeof(SkPoint) * 4); 31 memcpy(ptStorage, pts, sizeof(SkPoint) * 4);
31 appendSegment(allocator).addCubic(ptStorage, this); 32 return appendSegment(allocator).addCubic(ptStorage, this);
32 } break; 33 } break;
33 default: 34 default:
34 SkASSERT(0); 35 SkASSERT(0);
35 } 36 }
37 return NULL;
36 } 38 }
37 39
38 SkOpSegment* SkOpContour::nonVerticalSegment(SkOpSpanBase** start, SkOpSpanBase* * end) { 40 SkOpSegment* SkOpContour::nonVerticalSegment(SkOpSpanBase** start, SkOpSpanBase* * end) {
39 int segmentCount = fSortedSegments.count(); 41 int segmentCount = fSortedSegments.count();
40 SkASSERT(segmentCount > 0); 42 SkASSERT(segmentCount > 0);
41 for (int sortedIndex = fFirstSorted; sortedIndex < segmentCount; ++sortedInd ex) { 43 for (int sortedIndex = fFirstSorted; sortedIndex < segmentCount; ++sortedInd ex) {
42 SkOpSegment* testSegment = fSortedSegments[sortedIndex]; 44 SkOpSegment* testSegment = fSortedSegments[sortedIndex];
43 if (testSegment->done()) { 45 if (testSegment->done()) {
44 continue; 46 continue;
45 } 47 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 SkOpSegment* segment = &fHead; 108 SkOpSegment* segment = &fHead;
107 do { 109 do {
108 if (segment->done()) { 110 if (segment->done()) {
109 continue; 111 continue;
110 } 112 }
111 segment->undoneSpan(startPtr, endPtr); 113 segment->undoneSpan(startPtr, endPtr);
112 return segment; 114 return segment;
113 } while ((segment = segment->next())); 115 } while ((segment = segment->next()));
114 return NULL; 116 return NULL;
115 } 117 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpContour.h ('k') | src/pathops/SkOpEdgeBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698