OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 5 |
6 #ifndef BASE_GFX_SKIA_UTILS_MAC_H__ | 6 #ifndef BASE_GFX_SKIA_UTILS_MAC_H__ |
7 #define BASE_GFX_SKIA_UTILS_MAC_H__ | 7 #define BASE_GFX_SKIA_UTILS_MAC_H__ |
8 | 8 |
9 #include "SkColor.h" | 9 #include "SkColor.h" |
10 #include <CoreGraphics/CGColor.h> | 10 #include <CoreGraphics/CGColor.h> |
11 | 11 |
| 12 struct SkMatrix; |
12 struct SkIRect; | 13 struct SkIRect; |
13 struct SkPoint; | 14 struct SkPoint; |
14 struct SkRect; | 15 struct SkRect; |
15 | 16 |
16 namespace gfx { | 17 namespace gfx { |
17 | 18 |
18 // Converts a Skia point to a CoreGraphics CGPoint. | 19 // Converts a Skia point to a CoreGraphics CGPoint. |
19 // Both use same in-memory format. | 20 // Both use same in-memory format. |
20 inline const CGPoint& SkPointToCGPoint(const SkPoint& point) { | 21 inline const CGPoint& SkPointToCGPoint(const SkPoint& point) { |
21 return reinterpret_cast<const CGPoint&>(point); | 22 return reinterpret_cast<const CGPoint&>(point); |
22 } | 23 } |
23 | 24 |
24 // Converts a CoreGraphics point to a Skia CGPoint. | 25 // Converts a CoreGraphics point to a Skia CGPoint. |
25 // Both use same in-memory format. | 26 // Both use same in-memory format. |
26 inline const SkPoint& CGPointToSkPoint(const CGPoint& point) { | 27 inline const SkPoint& CGPointToSkPoint(const CGPoint& point) { |
27 return reinterpret_cast<const SkPoint&>(point); | 28 return reinterpret_cast<const SkPoint&>(point); |
28 } | 29 } |
| 30 |
| 31 // Matrix converters. |
| 32 CGAffineTransform SkMatrixToCGAffineTransform(const SkMatrix& matrix); |
29 | 33 |
30 // Rectangle converters. | 34 // Rectangle converters. |
31 SkRect CGRectToSkRect(const CGRect& rect); | 35 SkRect CGRectToSkRect(const CGRect& rect); |
32 SkIRect CGRectToSkIRect(const CGRect& rect); | 36 SkIRect CGRectToSkIRect(const CGRect& rect); |
33 | 37 |
34 // Converts a Skia rect to a CoreGraphics CGRect. | 38 // Converts a Skia rect to a CoreGraphics CGRect. |
35 CGRect SkIRectToCGRect(const SkIRect& rect); | 39 CGRect SkIRectToCGRect(const SkIRect& rect); |
36 CGRect SkRectToCGRect(const SkRect& rect); | 40 CGRect SkRectToCGRect(const SkRect& rect); |
37 | 41 |
38 // Converts CGColorRef to the ARGB layout Skia expects. | 42 // Converts CGColorRef to the ARGB layout Skia expects. |
39 SkColor CGColorRefToSkColor(CGColorRef color); | 43 SkColor CGColorRefToSkColor(CGColorRef color); |
40 | 44 |
41 // Converts ARGB to CGColorRef. | 45 // Converts ARGB to CGColorRef. |
42 CGColorRef SkColorToCGColorRef(SkColor color); | 46 CGColorRef SkColorToCGColorRef(SkColor color); |
43 | 47 |
44 } // namespace gfx | 48 } // namespace gfx |
45 | 49 |
46 #endif | 50 #endif |
47 | 51 |
OLD | NEW |