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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <CoreGraphics/CGColor.h> | 9 #include <CoreGraphics/CGColor.h> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
13 | 13 |
14 struct SkIRect; | 14 struct SkIRect; |
15 struct SkPoint; | 15 struct SkPoint; |
16 struct SkRect; | 16 struct SkRect; |
17 class SkBitmap; | 17 class SkBitmap; |
18 class SkCanvas; | |
18 class SkMatrix; | 19 class SkMatrix; |
19 #ifdef __LP64__ | 20 #ifdef __LP64__ |
20 typedef CGSize NSSize; | 21 typedef CGSize NSSize; |
21 #else | 22 #else |
22 typedef struct _NSSize NSSize; | 23 typedef struct _NSSize NSSize; |
23 #endif | 24 #endif |
24 | 25 |
25 #ifdef __OBJC__ | 26 #ifdef __OBJC__ |
26 @class NSImage; | 27 @class NSImage; |
27 @class NSImageRep; | 28 @class NSImageRep; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 // TODO(thakis): Remove this -- http://crbug.com/69432 | 80 // TODO(thakis): Remove this -- http://crbug.com/69432 |
80 NSImage* SkBitmapToNSImage(const SkBitmap& icon); | 81 NSImage* SkBitmapToNSImage(const SkBitmap& icon); |
81 | 82 |
82 // Given a vector of SkBitmaps, return an NSImage with each bitmap added | 83 // Given a vector of SkBitmaps, return an NSImage with each bitmap added |
83 // as a representation. | 84 // as a representation. |
84 NSImage* SkBitmapsToNSImage(const std::vector<const SkBitmap*>& bitmaps); | 85 NSImage* SkBitmapsToNSImage(const std::vector<const SkBitmap*>& bitmaps); |
85 | 86 |
86 // Returns |[NSImage imageNamed:@"NSApplicationIcon"]| as SkBitmap. | 87 // Returns |[NSImage imageNamed:@"NSApplicationIcon"]| as SkBitmap. |
87 SkBitmap AppplicationIconAtSize(int size); | 88 SkBitmap AppplicationIconAtSize(int size); |
88 | 89 |
90 // Converts a SkCanvas temporarily to a CGContext | |
91 class SkiaBitLocker { | |
92 public: | |
Nico
2011/05/16 15:13:00
indent 1
_cary
2011/05/16 15:58:02
Done.
| |
93 explicit SkiaBitLocker(SkCanvas* canvas); | |
94 ~SkiaBitLocker(); | |
95 CGContextRef cgContext(); | |
96 | |
97 private: | |
Nico
2011/05/16 15:13:00
indent 1
_cary
2011/05/16 15:58:02
Done.
| |
98 void releaseIfNeeded(); | |
99 SkCanvas* m_canvas; | |
Nico
2011/05/16 15:13:00
we name members canvas_, not m_canvas. same in the
_cary
2011/05/16 15:58:02
Done.
| |
100 CGContextRef m_cgContext; | |
101 }; | |
102 | |
103 | |
89 } // namespace gfx | 104 } // namespace gfx |
90 | 105 |
91 #endif // SKIA_EXT_SKIA_UTILS_MAC_H_ | 106 #endif // SKIA_EXT_SKIA_UTILS_MAC_H_ |
OLD | NEW |