blob: 7e27fd59c5b3a5130d1dc930efabae990c7df423 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CCScopedTexture_h
#define CCScopedTexture_h
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "CCTexture.h"
#if !ASSERT_DISABLED
#include "base/threading/platform_thread.h"
#endif
namespace cc {
class CCScopedTexture : protected CCTexture {
public:
static scoped_ptr<CCScopedTexture> create(CCResourceProvider* resourceProvider) { return make_scoped_ptr(new CCScopedTexture(resourceProvider)); }
virtual ~CCScopedTexture();
using CCTexture::id;
using CCTexture::size;
using CCTexture::format;
using CCTexture::bytes;
bool allocate(int pool, const IntSize&, GC3Denum format, CCResourceProvider::TextureUsageHint);
void free();
void leak();
protected:
explicit CCScopedTexture(CCResourceProvider*);
private:
CCResourceProvider* m_resourceProvider;
#if !ASSERT_DISABLED
base::PlatformThreadId m_allocateThreadIdentifier;
#endif
DISALLOW_COPY_AND_ASSIGN(CCScopedTexture);
};
}
#endif
|