diff options
Diffstat (limited to 'chromium/ui/gfx/scoped_sk_region.h')
-rw-r--r-- | chromium/ui/gfx/scoped_sk_region.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/chromium/ui/gfx/scoped_sk_region.h b/chromium/ui/gfx/scoped_sk_region.h new file mode 100644 index 00000000000..077b7492295 --- /dev/null +++ b/chromium/ui/gfx/scoped_sk_region.h @@ -0,0 +1,45 @@ +// Copyright (c) 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 UI_GFX_SCOPED_SK_REGION_H_ +#define UI_GFX_SCOPED_SK_REGION_H_ + +#include "third_party/skia/include/core/SkRegion.h" + +namespace gfx { + +// Wraps an SkRegion. +class ScopedSkRegion { + public: + ScopedSkRegion() : region_(NULL) {} + explicit ScopedSkRegion(SkRegion* region) : region_(region) {} + + ~ScopedSkRegion() { + delete region_; + } + + void Set(SkRegion* region) { + delete region_; + region_ = region; + } + + SkRegion* Get() { + return region_; + } + + SkRegion* release() { + SkRegion* region = region_; + region_ = NULL; + return region; + } + + private: + SkRegion* region_; + + DISALLOW_COPY_AND_ASSIGN(ScopedSkRegion); +}; + +} // namespace gfx + +#endif // UI_GFX_SCOPED_SK_REGION_H_ |