OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 SKIA_EXT_SKIA_UTILS_MAC_H_ | 5 #ifndef SKIA_EXT_SKIA_UTILS_MAC_H_ |
6 #define SKIA_EXT_SKIA_UTILS_MAC_H_ | 6 #define SKIA_EXT_SKIA_UTILS_MAC_H_ |
7 | 7 |
8 #include <ApplicationServices/ApplicationServices.h> | 8 #include <ApplicationServices/ApplicationServices.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 @class NSImage; | 28 @class NSImage; |
29 @class NSImageRep; | 29 @class NSImageRep; |
30 @class NSColor; | 30 @class NSColor; |
31 #else | 31 #else |
32 class NSBitmapImageRep; | 32 class NSBitmapImageRep; |
33 class NSImage; | 33 class NSImage; |
34 class NSImageRep; | 34 class NSImageRep; |
35 class NSColor; | 35 class NSColor; |
36 #endif | 36 #endif |
37 | 37 |
38 namespace gfx { | 38 namespace skia { |
39 | |
40 // Converts a Skia point to a CoreGraphics CGPoint. | |
41 // Both use same in-memory format. | |
42 inline const CGPoint& SkPointToCGPoint(const SkPoint& point) { | |
43 return reinterpret_cast<const CGPoint&>(point); | |
44 } | |
45 | |
46 // Converts a CoreGraphics point to a Skia CGPoint. | |
47 // Both use same in-memory format. | |
48 inline const SkPoint& CGPointToSkPoint(const CGPoint& point) { | |
49 return reinterpret_cast<const SkPoint&>(point); | |
50 } | |
51 | 39 |
52 // Matrix converters. | 40 // Matrix converters. |
53 SK_API CGAffineTransform SkMatrixToCGAffineTransform(const SkMatrix& matrix); | 41 SK_API CGAffineTransform SkMatrixToCGAffineTransform(const SkMatrix& matrix); |
54 | 42 |
55 // Rectangle converters. | 43 // Rectangle converters. |
56 SK_API SkRect CGRectToSkRect(const CGRect& rect); | 44 SK_API SkRect CGRectToSkRect(const CGRect& rect); |
57 | 45 |
58 // Converts a Skia rect to a CoreGraphics CGRect. | 46 // Converts a Skia rect to a CoreGraphics CGRect. |
59 CGRect SkIRectToCGRect(const SkIRect& rect); | 47 CGRect SkIRectToCGRect(const SkIRect& rect); |
60 CGRect SkRectToCGRect(const SkRect& rect); | 48 CGRect SkRectToCGRect(const SkRect& rect); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 bool useDeviceBits_; | 129 bool useDeviceBits_; |
142 | 130 |
143 // True if |bitmap_| is a dummy 1x1 bitmap allocated for the sake of creating | 131 // True if |bitmap_| is a dummy 1x1 bitmap allocated for the sake of creating |
144 // a non-NULL CGContext (it is invalid to use a NULL CGContext), and will not | 132 // a non-NULL CGContext (it is invalid to use a NULL CGContext), and will not |
145 // be copied to |canvas_|. This will happen if |canvas_|'s clip region is | 133 // be copied to |canvas_|. This will happen if |canvas_|'s clip region is |
146 // empty. | 134 // empty. |
147 bool bitmapIsDummy_; | 135 bool bitmapIsDummy_; |
148 }; | 136 }; |
149 | 137 |
150 | 138 |
151 } // namespace gfx | 139 } // namespace skia |
152 | 140 |
153 #endif // SKIA_EXT_SKIA_UTILS_MAC_H_ | 141 #endif // SKIA_EXT_SKIA_UTILS_MAC_H_ |
OLD | NEW |