OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GFX_PATH_H_ | 5 #ifndef GFX_PATH_H_ |
6 #define GFX_PATH_H_ | 6 #define GFX_PATH_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "gfx/native_widget_types.h" | 10 #include "gfx/native_widget_types.h" |
11 | 11 |
12 #include "third_party/skia/include/core/SkPath.h" | 12 #include "third_party/skia/include/core/SkPath.h" |
13 | 13 |
14 namespace gfx { | 14 namespace gfx { |
15 | 15 |
16 class Path : public SkPath { | 16 class Path : public SkPath { |
17 public: | 17 public: |
18 // Used by Path(Point,size_t) constructor. | 18 // Used by Path(Point,size_t) constructor. |
19 struct Point { | 19 struct Point { |
20 int x; | 20 int x; |
21 int y; | 21 int y; |
22 }; | 22 }; |
23 | 23 |
24 Path() : SkPath() { moveTo(0, 0); } | 24 Path(); |
25 | 25 |
26 // Creates a path populated with the specified points. | 26 // Creates a path populated with the specified points. |
27 Path(const Point* points, size_t count); | 27 Path(const Point* points, size_t count); |
28 | 28 |
| 29 ~Path(); |
| 30 |
29 #if defined(OS_WIN) || defined(USE_X11) | 31 #if defined(OS_WIN) || defined(USE_X11) |
30 // Creates a NativeRegion from the path. The caller is responsible for freeing | 32 // Creates a NativeRegion from the path. The caller is responsible for freeing |
31 // resources used by this region. This only supports polygon paths. | 33 // resources used by this region. This only supports polygon paths. |
32 NativeRegion CreateNativeRegion() const; | 34 NativeRegion CreateNativeRegion() const; |
33 | 35 |
34 // Returns the intersection of the two regions. The caller owns the returned | 36 // Returns the intersection of the two regions. The caller owns the returned |
35 // object. | 37 // object. |
36 static gfx::NativeRegion IntersectRegions(gfx::NativeRegion r1, | 38 static gfx::NativeRegion IntersectRegions(gfx::NativeRegion r1, |
37 gfx::NativeRegion r2); | 39 gfx::NativeRegion r2); |
38 | 40 |
39 // Returns the union of the two regions. The caller owns the returned object. | 41 // Returns the union of the two regions. The caller owns the returned object. |
40 static gfx::NativeRegion CombineRegions(gfx::NativeRegion r1, | 42 static gfx::NativeRegion CombineRegions(gfx::NativeRegion r1, |
41 gfx::NativeRegion r2); | 43 gfx::NativeRegion r2); |
42 | 44 |
43 // Returns the difference of the two regions. The caller owns the returned | 45 // Returns the difference of the two regions. The caller owns the returned |
44 // object. | 46 // object. |
45 static gfx::NativeRegion SubtractRegion(gfx::NativeRegion r1, | 47 static gfx::NativeRegion SubtractRegion(gfx::NativeRegion r1, |
46 gfx::NativeRegion r2); | 48 gfx::NativeRegion r2); |
47 #endif | 49 #endif |
48 | 50 |
49 private: | 51 private: |
50 DISALLOW_COPY_AND_ASSIGN(Path); | 52 DISALLOW_COPY_AND_ASSIGN(Path); |
51 }; | 53 }; |
52 | 54 |
53 } | 55 } |
54 | 56 |
55 #endif // GFX_PATH_H_ | 57 #endif // GFX_PATH_H_ |
OLD | NEW |