[Cronet] Handle redirects in CronetHttpURLConnection
[chromium-blink-merge.git] / ui / gfx / path_aura.cc
blobcc68458902e81c1e68a738ef2260cd1ba63007b9
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"
10 namespace gfx {
12 SkRegion* Path::CreateNativeRegion() const {
13 // Create a clip region that contains |this| path.
14 const SkRect bounds = getBounds();
15 SkIRect ibounds;
16 bounds.round(&ibounds);
17 SkRegion clip_region;
18 clip_region.setRect(ibounds);
20 SkRegion* region = new SkRegion;
21 region->setPath(*this, clip_region);
22 return region;
25 // static
26 NativeRegion Path::IntersectRegions(NativeRegion r1, NativeRegion r2) {
27 SkRegion* new_region = new SkRegion;
28 new_region->op(*r1, *r2, SkRegion::kIntersect_Op);
29 return new_region;
32 // static
33 NativeRegion Path::CombineRegions(NativeRegion r1, NativeRegion r2) {
34 SkRegion* new_region = new SkRegion;
35 new_region->op(*r1, *r2, SkRegion::kUnion_Op);
36 return new_region;
39 // static
40 NativeRegion Path::SubtractRegion(NativeRegion r1, NativeRegion r2) {
41 SkRegion* new_region = new SkRegion;
42 new_region->op(*r1, *r2, SkRegion::kDifference_Op);
43 return new_region;
46 } // namespace gfx