| 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 APP_GFX_PATH_H_ | 5 #ifndef APP_GFX_PATH_H_ |
| 6 #define APP_GFX_PATH_H_ | 6 #define APP_GFX_PATH_H_ |
| 7 | 7 |
| 8 #include "app/gfx/native_widget_types.h" |
| 8 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 9 | 10 |
| 10 #if defined(OS_WIN) | |
| 11 #include <windows.h> | |
| 12 #elif defined(OS_LINUX) | |
| 13 typedef struct _GdkRegion GdkRegion; | |
| 14 #endif | |
| 15 | |
| 16 #include "third_party/skia/include/core/SkPath.h" | 11 #include "third_party/skia/include/core/SkPath.h" |
| 17 | 12 |
| 18 namespace gfx { | 13 namespace gfx { |
| 19 | 14 |
| 20 class Path : public SkPath { | 15 class Path : public SkPath { |
| 21 public: | 16 public: |
| 17 // Used by Path(Point,size_t) constructor. |
| 18 struct Point { |
| 19 int x; |
| 20 int y; |
| 21 }; |
| 22 |
| 22 Path() : SkPath() { moveTo(0, 0); } | 23 Path() : SkPath() { moveTo(0, 0); } |
| 23 | 24 |
| 24 #if defined(OS_WIN) | 25 // Creates a path populated with the specified points. |
| 25 // Creates a HRGN from the path. The caller is responsible for freeing | 26 Path(const Point* points, size_t count); |
| 26 // resources used by this region. This only supports polygon paths. | 27 |
| 27 HRGN CreateHRGN() const; | 28 #if defined(OS_WIN) || defined(USE_X11) |
| 28 #elif defined(OS_LINUX) | 29 // Creates a NativeRegion from the path. The caller is responsible for freeing |
| 29 // Creates a Gdkregion from the path. The caller is responsible for freeing | 30 // resources used by this region. This only supports polygon paths. |
| 30 // resources used by this region. This only supports polygon paths. | 31 NativeRegion CreateNativeRegion() const; |
| 31 // WARNING: this returns NULL for an empty Path. | 32 |
| 32 GdkRegion* CreateGdkRegion() const; | 33 // Returns the intersection of the two regions. The caller owns the returned |
| 34 // object. |
| 35 static gfx::NativeRegion IntersectRegions(gfx::NativeRegion r1, |
| 36 gfx::NativeRegion r2); |
| 37 |
| 38 // Returns the union of the two regions. The caller owns the returned object. |
| 39 static gfx::NativeRegion CombineRegions(gfx::NativeRegion r1, |
| 40 gfx::NativeRegion r2); |
| 41 |
| 42 // Returns the difference of the two regions. The caller owns the returned |
| 43 // object. |
| 44 static gfx::NativeRegion SubtractRegion(gfx::NativeRegion r1, |
| 45 gfx::NativeRegion r2); |
| 33 #endif | 46 #endif |
| 34 | 47 |
| 35 private: | 48 private: |
| 36 DISALLOW_COPY_AND_ASSIGN(Path); | 49 DISALLOW_COPY_AND_ASSIGN(Path); |
| 37 }; | 50 }; |
| 38 | 51 |
| 39 } | 52 } |
| 40 | 53 |
| 41 #endif // APP_GFX_PATH_H_ | 54 #endif // APP_GFX_PATH_H_ |
| OLD | NEW |