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 #include "ui/gfx/path.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "third_party/skia/include/core/SkRegion.h"
12 SkRegion
* Path::CreateNativeRegion() const {
13 // Create a clip region that contains |this| path.
14 const SkRect bounds
= getBounds();
16 bounds
.round(&ibounds
);
18 clip_region
.setRect(ibounds
);
20 SkRegion
* region
= new SkRegion
;
21 region
->setPath(*this, clip_region
);
26 NativeRegion
Path::IntersectRegions(NativeRegion r1
, NativeRegion r2
) {
27 SkRegion
* new_region
= new SkRegion
;
28 new_region
->op(*r1
, *r2
, SkRegion::kIntersect_Op
);
33 NativeRegion
Path::CombineRegions(NativeRegion r1
, NativeRegion r2
) {
34 SkRegion
* new_region
= new SkRegion
;
35 new_region
->op(*r1
, *r2
, SkRegion::kUnion_Op
);
40 NativeRegion
Path::SubtractRegion(NativeRegion r1
, NativeRegion r2
) {
41 SkRegion
* new_region
= new SkRegion
;
42 new_region
->op(*r1
, *r2
, SkRegion::kDifference_Op
);