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

Side by Side Diff: src/pathops/SkOpTAllocator.h

Issue 1002693002: pathops version two (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix arm 64 inspired coincident handling Created 5 years, 9 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/SkOpSpan.cpp ('k') | src/pathops/SkPathOpsCommon.h » ('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 2014 Google Inc. 2 * Copyright 2014 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 #ifndef SkOpTAllocator_DEFINED 7 #ifndef SkOpTAllocator_DEFINED
8 #define SkOpTAllocator_DEFINED 8 #define SkOpTAllocator_DEFINED
9 9
10 #include "SkChunkAlloc.h" 10 #include "SkChunkAlloc.h"
11 11
12 // T is SkOpAngle2, SkOpSpan2, or SkOpSegment2 12 // T is SkOpAngle2, SkOpSpan2, or SkOpSegment2
13 template<typename T> 13 template<typename T>
14 class SkOpTAllocator { 14 class SkOpTAllocator {
15 public: 15 public:
16 static T* Allocate(SkChunkAlloc* allocator) { 16 static T* Allocate(SkChunkAlloc* allocator) {
17 void* ptr = allocator->allocThrow(sizeof(T)); 17 void* ptr = allocator->allocThrow(sizeof(T));
18 T* record = (T*) ptr; 18 T* record = (T*) ptr;
19 return record; 19 return record;
20 } 20 }
21 21
22 static T* AllocateArray(SkChunkAlloc* allocator, int count) {
23 void* ptr = allocator->allocThrow(sizeof(T) * count);
24 T* record = (T*) ptr;
25 return record;
26 }
27
22 static T* New(SkChunkAlloc* allocator) { 28 static T* New(SkChunkAlloc* allocator) {
23 return new (Allocate(allocator)) T(); 29 return new (Allocate(allocator)) T();
24 } 30 }
25 }; 31 };
26 32
27 #endif 33 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkOpSpan.cpp ('k') | src/pathops/SkPathOpsCommon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698