| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ui/gfx/path_win.h" | 5 #include "ui/gfx/path_win.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/win/scoped_gdi_object.h" | 8 #include "base/win/scoped_gdi_object.h" |
| 9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
| 10 #include "ui/gfx/path.h" | 10 #include "ui/gfx/path.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 | 26 |
| 27 HRGN CreateHRGNFromSkPath(const SkPath& path) { | 27 HRGN CreateHRGNFromSkPath(const SkPath& path) { |
| 28 SkRegion clip_region; | 28 SkRegion clip_region; |
| 29 clip_region.setRect(path.getBounds().round()); | 29 clip_region.setRect(path.getBounds().round()); |
| 30 SkRegion region; | 30 SkRegion region; |
| 31 region.setPath(path, clip_region); | 31 region.setPath(path, clip_region); |
| 32 return CreateHRGNFromSkRegion(region); | 32 return CreateHRGNFromSkRegion(region); |
| 33 } | 33 } |
| 34 | 34 |
| 35 // See path_aura.cc for Aura definition of these methods: | |
| 36 #if !defined(USE_AURA) | |
| 37 | |
| 38 NativeRegion Path::CreateNativeRegion() const { | |
| 39 return CreateHRGNFromSkPath(*this); | |
| 40 } | |
| 41 | |
| 42 // static | |
| 43 NativeRegion Path::IntersectRegions(NativeRegion r1, NativeRegion r2) { | |
| 44 HRGN dest = CreateRectRgn(0, 0, 1, 1); | |
| 45 CombineRgn(dest, r1, r2, RGN_AND); | |
| 46 return dest; | |
| 47 } | |
| 48 | |
| 49 // static | |
| 50 NativeRegion Path::CombineRegions(NativeRegion r1, NativeRegion r2) { | |
| 51 HRGN dest = CreateRectRgn(0, 0, 1, 1); | |
| 52 CombineRgn(dest, r1, r2, RGN_OR); | |
| 53 return dest; | |
| 54 } | |
| 55 | |
| 56 // static | |
| 57 NativeRegion Path::SubtractRegion(NativeRegion r1, NativeRegion r2) { | |
| 58 HRGN dest = CreateRectRgn(0, 0, 1, 1); | |
| 59 CombineRgn(dest, r1, r2, RGN_DIFF); | |
| 60 return dest; | |
| 61 } | |
| 62 | |
| 63 #endif | |
| 64 | |
| 65 } // namespace gfx | 35 } // namespace gfx |
| OLD | NEW |