aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkOpTAllocator.h
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2017-03-07 11:11:47 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-07 17:56:41 +0000
commitc3cc5fa6de0a8237d9241dbf3e6c0786a9040069 (patch)
tree62f9d4a1aec2b8edb89ef2dc962d126e560f7703 /src/pathops/SkOpTAllocator.h
parent5c7780e350f44c3415ba17304dd50a21da74e051 (diff)
Move from SkChunkAlloc to SkArenaAlloc for PathOps
Attempt two. Remove ~SkOpContour because it is handled by the SkArenaAlloc. Change-Id: Id3049db97aebcc1009d403a031f2fac219f58f2f Reviewed-on: https://skia-review.googlesource.com/9381 Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'src/pathops/SkOpTAllocator.h')
-rw-r--r--src/pathops/SkOpTAllocator.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/pathops/SkOpTAllocator.h b/src/pathops/SkOpTAllocator.h
index e8835f02e6..599c445f12 100644
--- a/src/pathops/SkOpTAllocator.h
+++ b/src/pathops/SkOpTAllocator.h
@@ -7,26 +7,22 @@
#ifndef SkOpTAllocator_DEFINED
#define SkOpTAllocator_DEFINED
-#include "SkChunkAlloc.h"
+#include "SkArenaAlloc.h"
// T is SkOpAngle2, SkOpSpan2, or SkOpSegment2
template<typename T>
class SkOpTAllocator {
public:
- static T* Allocate(SkChunkAlloc* allocator) {
- void* ptr = allocator->allocThrow(sizeof(T));
- T* record = (T*) ptr;
- return record;
+ static T* Allocate(SkArenaAlloc* allocator) {
+ return allocator->make<T>();
}
- static T* AllocateArray(SkChunkAlloc* allocator, int count) {
- void* ptr = allocator->allocThrow(sizeof(T) * count);
- T* record = (T*) ptr;
- return record;
+ static T* AllocateArray(SkArenaAlloc* allocator, int count) {
+ return allocator->makeArrayDefault<T>(count);
}
- static T* New(SkChunkAlloc* allocator) {
- return new (Allocate(allocator)) T();
+ static T* New(SkArenaAlloc* allocator) {
+ return allocator->make<T>();
}
};