OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "cc/resources/ui_resource_manager.h" | |
6 | |
7 namespace cc { | |
8 | |
9 scoped_refptr<UIResourceBitmap> | |
10 UIResourceBitmap::Create(void* pixels, | |
11 UIResourceFormat format, | |
12 gfx::Size size) { | |
13 scoped_refptr<UIResourceBitmap> ret = new UIResourceBitmap(); | |
14 ret->pixels_ = pixels; | |
15 ret->format_ = format; | |
16 ret->size_ = size; | |
17 | |
18 return ret; | |
19 } | |
20 | |
21 UIResourceBitmap::~UIResourceBitmap() { | |
22 // this class has ownership of the pixels | |
23 if (format_ == RGBA8) | |
24 delete [] reinterpret_cast<uint8_t*>(pixels_); | |
aelias_OOO_until_Jul13
2013/07/10 23:07:22
There should be a way to do this with a scoped_ptr
powei
2013/07/11 23:54:44
Done.
| |
25 | |
26 // handle other formats? | |
27 } | |
28 | |
29 } // namespace cc | |
30 | |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
55 | |
56 | |
57 | |
58 | |
59 | |
60 | |
61 | |
62 | |
63 | |
64 | |
65 | |
66 | |
67 | |
OLD | NEW |