| 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 #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 <CoreGraphics/CGColor.h> | 8 #include <CoreGraphics/CGColor.h> |
| 9 | 9 |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| 11 | 11 |
| 12 struct SkMatrix; | 12 struct SkMatrix; |
| 13 struct SkIRect; | 13 struct SkIRect; |
| 14 struct SkPoint; | 14 struct SkPoint; |
| 15 struct SkRect; | 15 struct SkRect; |
| 16 class SkBitmap; |
| 17 typedef struct _NSSize NSSize; |
| 18 |
| 19 #ifdef __OBJC__ |
| 20 @class NSImage; |
| 21 #endif |
| 16 | 22 |
| 17 namespace gfx { | 23 namespace gfx { |
| 18 | 24 |
| 19 // Converts a Skia point to a CoreGraphics CGPoint. | 25 // Converts a Skia point to a CoreGraphics CGPoint. |
| 20 // Both use same in-memory format. | 26 // Both use same in-memory format. |
| 21 inline const CGPoint& SkPointToCGPoint(const SkPoint& point) { | 27 inline const CGPoint& SkPointToCGPoint(const SkPoint& point) { |
| 22 return reinterpret_cast<const CGPoint&>(point); | 28 return reinterpret_cast<const CGPoint&>(point); |
| 23 } | 29 } |
| 24 | 30 |
| 25 // Converts a CoreGraphics point to a Skia CGPoint. | 31 // Converts a CoreGraphics point to a Skia CGPoint. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 38 // Converts a Skia rect to a CoreGraphics CGRect. | 44 // Converts a Skia rect to a CoreGraphics CGRect. |
| 39 CGRect SkIRectToCGRect(const SkIRect& rect); | 45 CGRect SkIRectToCGRect(const SkIRect& rect); |
| 40 CGRect SkRectToCGRect(const SkRect& rect); | 46 CGRect SkRectToCGRect(const SkRect& rect); |
| 41 | 47 |
| 42 // Converts CGColorRef to the ARGB layout Skia expects. | 48 // Converts CGColorRef to the ARGB layout Skia expects. |
| 43 SkColor CGColorRefToSkColor(CGColorRef color); | 49 SkColor CGColorRefToSkColor(CGColorRef color); |
| 44 | 50 |
| 45 // Converts ARGB to CGColorRef. | 51 // Converts ARGB to CGColorRef. |
| 46 CGColorRef SkColorToCGColorRef(SkColor color); | 52 CGColorRef SkColorToCGColorRef(SkColor color); |
| 47 | 53 |
| 54 // Converts a CGImage to a SkBitmap. |
| 55 SkBitmap CGImageToSkBitmap(CGImageRef image); |
| 56 |
| 57 #ifdef __OBJC__ |
| 58 // Draws an NSImage with a given size into a SkBitmap. |
| 59 SkBitmap NSImageToSkBitmap(NSImage* image, NSSize size, bool is_opaque); |
| 60 #endif |
| 61 |
| 48 } // namespace gfx | 62 } // namespace gfx |
| 49 | 63 |
| 50 #endif // SKIA_EXT_SKIA_UTILS_MAC_H_ | 64 #endif // SKIA_EXT_SKIA_UTILS_MAC_H_ |
| 51 | 65 |
| OLD | NEW |