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

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

Issue 1037953004: add conics to path ops (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix linux build 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
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 void SkOpContour::addCurve(SkPath::Verb verb, const SkPoint pts[4], SkChunkAlloc * allocator) {
14 switch (verb) { 14 switch (verb) {
15 case SkPath::kLine_Verb: { 15 case SkPath::kLine_Verb: {
16 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 2); 16 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 2);
17 memcpy(ptStorage, pts, sizeof(SkPoint) * 2); 17 memcpy(ptStorage, pts, sizeof(SkPoint) * 2);
18 appendSegment(allocator).addLine(ptStorage, this); 18 appendSegment(allocator).addLine(ptStorage, this);
19 } break; 19 } break;
20 case SkPath::kQuad_Verb: { 20 case SkPath::kQuad_Verb: {
21 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 3); 21 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 3);
22 memcpy(ptStorage, pts, sizeof(SkPoint) * 3); 22 memcpy(ptStorage, pts, sizeof(SkPoint) * 3);
23 appendSegment(allocator).addQuad(ptStorage, this); 23 appendSegment(allocator).addQuad(ptStorage, this);
24 } break; 24 } break;
25 case SkPath::kConic_Verb: {
26 SkASSERT(0); // the original curve is a cubic, which will never red uce to a conic
27 } break;
25 case SkPath::kCubic_Verb: { 28 case SkPath::kCubic_Verb: {
26 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 4); 29 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 4);
27 memcpy(ptStorage, pts, sizeof(SkPoint) * 4); 30 memcpy(ptStorage, pts, sizeof(SkPoint) * 4);
28 appendSegment(allocator).addCubic(ptStorage, this); 31 appendSegment(allocator).addCubic(ptStorage, this);
29 } break; 32 } break;
30 default: 33 default:
31 SkASSERT(0); 34 SkASSERT(0);
32 } 35 }
33 } 36 }
34 37
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 SkOpSegment* segment = &fHead; 106 SkOpSegment* segment = &fHead;
104 do { 107 do {
105 if (segment->done()) { 108 if (segment->done()) {
106 continue; 109 continue;
107 } 110 }
108 segment->undoneSpan(startPtr, endPtr); 111 segment->undoneSpan(startPtr, endPtr);
109 return segment; 112 return segment;
110 } while ((segment = segment->next())); 113 } while ((segment = segment->next()));
111 return NULL; 114 return NULL;
112 } 115 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698