Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / gfx / scoped_sk_region.h
blob077b74922958ff22b27bbc2df110c08b0bdb950b
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.
5 #ifndef UI_GFX_SCOPED_SK_REGION_H_
6 #define UI_GFX_SCOPED_SK_REGION_H_
8 #include "third_party/skia/include/core/SkRegion.h"
10 namespace gfx {
12 // Wraps an SkRegion.
13 class ScopedSkRegion {
14 public:
15 ScopedSkRegion() : region_(NULL) {}
16 explicit ScopedSkRegion(SkRegion* region) : region_(region) {}
18 ~ScopedSkRegion() {
19 delete region_;
22 void Set(SkRegion* region) {
23 delete region_;
24 region_ = region;
27 SkRegion* Get() {
28 return region_;
31 SkRegion* release() {
32 SkRegion* region = region_;
33 region_ = NULL;
34 return region;
37 private:
38 SkRegion* region_;
40 DISALLOW_COPY_AND_ASSIGN(ScopedSkRegion);
43 } // namespace gfx
45 #endif // UI_GFX_SCOPED_SK_REGION_H_