OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SkEdgeBuilder.h" | 8 #include "SkEdgeBuilder.h" |
9 #include "SkPath.h" | 9 #include "SkPath.h" |
10 #include "SkEdge.h" | 10 #include "SkEdge.h" |
11 #include "SkEdgeClipper.h" | 11 #include "SkEdgeClipper.h" |
12 #include "SkLineClipper.h" | 12 #include "SkLineClipper.h" |
13 #include "SkGeometry.h" | 13 #include "SkGeometry.h" |
14 | 14 |
15 template <typename T> static T* typedAllocThrow(SkChunkAlloc& alloc) { | 15 template <typename T> static T* typedAllocThrow(SkChunkAlloc& alloc) { |
16 return static_cast<T*>(alloc.allocThrow(sizeof(T))); | 16 return static_cast<T*>(alloc.allocThrow(sizeof(T))); |
17 } | 17 } |
18 | 18 |
19 /////////////////////////////////////////////////////////////////////////////// | 19 /////////////////////////////////////////////////////////////////////////////// |
20 | 20 |
21 SkEdgeBuilder::SkEdgeBuilder() : fAlloc(16*1024) { | 21 SkEdgeBuilder::SkEdgeBuilder() : fAlloc(16*1024) { |
22 fEdgeList = NULL; | 22 fEdgeList = nullptr; |
23 } | 23 } |
24 | 24 |
25 void SkEdgeBuilder::addLine(const SkPoint pts[]) { | 25 void SkEdgeBuilder::addLine(const SkPoint pts[]) { |
26 SkEdge* edge = typedAllocThrow<SkEdge>(fAlloc); | 26 SkEdge* edge = typedAllocThrow<SkEdge>(fAlloc); |
27 if (edge->setLine(pts[0], pts[1], fShiftUp)) { | 27 if (edge->setLine(pts[0], pts[1], fShiftUp)) { |
28 fList.push(edge); | 28 fList.push(edge); |
29 } else { | 29 } else { |
30 // TODO: unallocate edge from storage... | 30 // TODO: unallocate edge from storage... |
31 } | 31 } |
32 } | 32 } |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 } | 256 } |
257 default: | 257 default: |
258 SkDEBUGFAIL("unexpected verb"); | 258 SkDEBUGFAIL("unexpected verb"); |
259 break; | 259 break; |
260 } | 260 } |
261 } | 261 } |
262 } | 262 } |
263 fEdgeList = fList.begin(); | 263 fEdgeList = fList.begin(); |
264 return fList.count(); | 264 return fList.count(); |
265 } | 265 } |
OLD | NEW |