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

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

Issue 2357353002: split tight quads and cubics (Closed)
Patch Set: fix linux build Created 4 years, 3 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 SkOpSegment* SkOpContour::addCurve(SkPath::Verb verb, const SkPoint pts[4]) { 13 SkOpSegment* SkOpContour::addCurve(SkPath::Verb verb, const SkPoint pts[4], SkSc alar weight) {
14 SkChunkAlloc* allocator = this->globalState()->allocator(); 14 SkChunkAlloc* allocator = this->globalState()->allocator();
15 switch (verb) { 15 switch (verb) {
16 case SkPath::kLine_Verb: { 16 case SkPath::kLine_Verb: {
17 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 2); 17 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 2);
18 memcpy(ptStorage, pts, sizeof(SkPoint) * 2); 18 memcpy(ptStorage, pts, sizeof(SkPoint) * 2);
19 return appendSegment().addLine(ptStorage, this); 19 return appendSegment().addLine(ptStorage, this);
20 } break; 20 } break;
21 case SkPath::kQuad_Verb: { 21 case SkPath::kQuad_Verb: {
22 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 3); 22 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 3);
23 memcpy(ptStorage, pts, sizeof(SkPoint) * 3); 23 memcpy(ptStorage, pts, sizeof(SkPoint) * 3);
24 return appendSegment().addQuad(ptStorage, this); 24 return appendSegment().addQuad(ptStorage, this);
25 } break; 25 } break;
26 case SkPath::kConic_Verb: { 26 case SkPath::kConic_Verb: {
27 SkASSERT(0); // the original curve is a cubic, which will never red uce to a conic 27 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 3);
28 memcpy(ptStorage, pts, sizeof(SkPoint) * 3);
29 return appendSegment().addConic(ptStorage, weight, this);
28 } break; 30 } break;
29 case SkPath::kCubic_Verb: { 31 case SkPath::kCubic_Verb: {
30 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 4); 32 SkPoint* ptStorage = SkOpTAllocator<SkPoint>::AllocateArray(allocato r, 4);
31 memcpy(ptStorage, pts, sizeof(SkPoint) * 4); 33 memcpy(ptStorage, pts, sizeof(SkPoint) * 4);
32 return appendSegment().addCubic(ptStorage, this); 34 return appendSegment().addCubic(ptStorage, this);
33 } break; 35 } break;
34 default: 36 default:
35 SkASSERT(0); 37 SkASSERT(0);
36 } 38 }
37 return nullptr; 39 return nullptr;
(...skipping 21 matching lines...) Expand all
59 SkOpSegment* segment = &fHead; 61 SkOpSegment* segment = &fHead;
60 do { 62 do {
61 if (segment->done()) { 63 if (segment->done()) {
62 continue; 64 continue;
63 } 65 }
64 segment->undoneSpan(startPtr, endPtr); 66 segment->undoneSpan(startPtr, endPtr);
65 return segment; 67 return segment;
66 } while ((segment = segment->next())); 68 } while ((segment = segment->next()));
67 return nullptr; 69 return nullptr;
68 } 70 }
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