OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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 #ifndef UI_GFX_SCOPED_SK_REGION_H_ | |
6 #define UI_GFX_SCOPED_SK_REGION_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "third_party/skia/include/core/SkRegion.h" | |
10 | |
11 namespace gfx { | |
12 | |
13 // Wraps an SkRegion. | |
14 class ScopedSkRegion { | |
15 public: | |
16 ScopedSkRegion() : region_(NULL) {} | |
17 explicit ScopedSkRegion(SkRegion* region) : region_(region) {} | |
18 | |
19 ~ScopedSkRegion() { | |
20 delete region_; | |
21 } | |
22 | |
23 void Set(SkRegion* region) { | |
24 delete region_; | |
25 region_ = region; | |
26 } | |
27 | |
28 SkRegion* Get() { | |
29 return region_; | |
30 } | |
31 | |
32 SkRegion* release() { | |
33 SkRegion* region = region_; | |
34 region_ = NULL; | |
35 return region; | |
36 } | |
37 | |
38 private: | |
39 SkRegion* region_; | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(ScopedSkRegion); | |
42 }; | |
43 | |
44 } // namespace gfx | |
45 | |
46 #endif // UI_GFX_SCOPED_SK_REGION_H_ | |
OLD | NEW |