summaryrefslogtreecommitdiffstats
path: root/ui/gfx/path_aura.cc
blob: 9ca857daca8475551e0c76e8bfac4fcb1891fe60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// 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.

#include "ui/gfx/path.h"

#include "base/memory/scoped_ptr.h"
#include "third_party/skia/include/core/SkRegion.h"

namespace gfx {

SkRegion* Path::CreateNativeRegion() const {
  SkRegion* region = new SkRegion;
  region->setPath(*this, *region);
  return region;
}

// static
NativeRegion Path::IntersectRegions(NativeRegion r1, NativeRegion r2) {
  SkRegion* new_region = new SkRegion;
  new_region->op(*r1, *r2, SkRegion::kIntersect_Op);
  return new_region;
}

// static
NativeRegion Path::CombineRegions(NativeRegion r1, NativeRegion r2) {
  SkRegion* new_region = new SkRegion;
  new_region->op(*r1, *r2, SkRegion::kUnion_Op);
  return new_region;
}

// static
NativeRegion Path::SubtractRegion(NativeRegion r1, NativeRegion r2) {
  SkRegion* new_region = new SkRegion;
  new_region->op(*r1, *r2, SkRegion::kDifference_Op);
  return new_region;
}

}  // namespace gfx