aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkOpTAllocator.h
blob: 599c445f12a59b1ad803c23f7eb01ad301e11cd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * Copyright 2014 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SkOpTAllocator_DEFINED
#define SkOpTAllocator_DEFINED

#include "SkArenaAlloc.h"

// T is SkOpAngle2, SkOpSpan2, or SkOpSegment2
template<typename T>
class SkOpTAllocator {
public:
    static T* Allocate(SkArenaAlloc* allocator) {
        return allocator->make<T>();
    }

    static T* AllocateArray(SkArenaAlloc* allocator, int count) {
        return allocator->makeArrayDefault<T>(count);
    }

    static T* New(SkArenaAlloc* allocator) {
        return allocator->make<T>();
    }
};

#endif