Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: skia/ext/skia_utils_mac.h

Issue 7523046: mac: Components build for skia, easy part (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « skia/ext/platform_device_mac.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #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>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 CGRect SkIRectToCGRect(const SkIRect& rect); 58 CGRect SkIRectToCGRect(const SkIRect& rect);
59 CGRect SkRectToCGRect(const SkRect& rect); 59 CGRect SkRectToCGRect(const SkRect& rect);
60 60
61 // Converts CGColorRef to the ARGB layout Skia expects. 61 // Converts CGColorRef to the ARGB layout Skia expects.
62 SkColor CGColorRefToSkColor(CGColorRef color); 62 SkColor CGColorRefToSkColor(CGColorRef color);
63 63
64 // Converts ARGB to CGColorRef. 64 // Converts ARGB to CGColorRef.
65 CGColorRef SkColorToCGColorRef(SkColor color); 65 CGColorRef SkColorToCGColorRef(SkColor color);
66 66
67 // Converts ARGB to NSColor. 67 // Converts ARGB to NSColor.
68 NSColor* SkColorToCalibratedNSColor(SkColor color); 68 SK_API NSColor* SkColorToCalibratedNSColor(SkColor color);
69 69
70 // Converts a CGImage to a SkBitmap. 70 // Converts a CGImage to a SkBitmap.
71 SkBitmap CGImageToSkBitmap(CGImageRef image); 71 SK_API SkBitmap CGImageToSkBitmap(CGImageRef image);
72 72
73 // Draws an NSImage with a given size into a SkBitmap. 73 // Draws an NSImage with a given size into a SkBitmap.
74 SkBitmap NSImageToSkBitmap(NSImage* image, NSSize size, bool is_opaque); 74 SK_API SkBitmap NSImageToSkBitmap(NSImage* image, NSSize size, bool is_opaque);
75 75
76 // Draws an NSImageRep with a given size into a SkBitmap. 76 // Draws an NSImageRep with a given size into a SkBitmap.
77 SkBitmap NSImageRepToSkBitmap(NSImageRep* image, NSSize size, bool is_opaque); 77 SK_API SkBitmap NSImageRepToSkBitmap(
78 NSImageRep* image, NSSize size, bool is_opaque);
78 79
79 // Given an SkBitmap and a color space, return an autoreleased NSImage. 80 // Given an SkBitmap and a color space, return an autoreleased NSImage.
80 NSImage* SkBitmapToNSImageWithColorSpace(const SkBitmap& icon, 81 SK_API NSImage* SkBitmapToNSImageWithColorSpace(const SkBitmap& icon,
81 CGColorSpaceRef colorSpace); 82 CGColorSpaceRef colorSpace);
82 83
83 // Given an SkBitmap, return an autoreleased NSImage in the generic color space. 84 // Given an SkBitmap, return an autoreleased NSImage in the generic color space.
84 // DEPRECATED, use SkBitmapToNSImageWithColorSpace() instead. 85 // DEPRECATED, use SkBitmapToNSImageWithColorSpace() instead.
85 // TODO(thakis): Remove this -- http://crbug.com/69432 86 // TODO(thakis): Remove this -- http://crbug.com/69432
86 NSImage* SkBitmapToNSImage(const SkBitmap& icon); 87 SK_API NSImage* SkBitmapToNSImage(const SkBitmap& icon);
87 88
88 // Given a vector of SkBitmaps, return an NSImage with each bitmap added 89 // Given a vector of SkBitmaps, return an NSImage with each bitmap added
89 // as a representation. 90 // as a representation.
90 NSImage* SkBitmapsToNSImage(const std::vector<const SkBitmap*>& bitmaps); 91 SK_API NSImage* SkBitmapsToNSImage(const std::vector<const SkBitmap*>& bitmaps);
91 92
92 // Returns |[NSImage imageNamed:@"NSApplicationIcon"]| as SkBitmap. 93 // Returns |[NSImage imageNamed:@"NSApplicationIcon"]| as SkBitmap.
93 SkBitmap AppplicationIconAtSize(int size); 94 SK_API SkBitmap AppplicationIconAtSize(int size);
94 95
95 // Converts a SkCanvas temporarily to a CGContext 96 // Converts a SkCanvas temporarily to a CGContext
96 class SkiaBitLocker { 97 class SkiaBitLocker {
97 public: 98 public:
98 explicit SkiaBitLocker(SkCanvas* canvas); 99 explicit SkiaBitLocker(SkCanvas* canvas);
99 ~SkiaBitLocker(); 100 ~SkiaBitLocker();
100 CGContextRef cgContext(); 101 CGContextRef cgContext();
101 102
102 private: 103 private:
103 void releaseIfNeeded(); 104 void releaseIfNeeded();
104 SkCanvas* canvas_; 105 SkCanvas* canvas_;
105 CGContextRef cgContext_; 106 CGContextRef cgContext_;
106 }; 107 };
107 108
108 109
109 } // namespace gfx 110 } // namespace gfx
110 111
111 #endif // SKIA_EXT_SKIA_UTILS_MAC_H_ 112 #endif // SKIA_EXT_SKIA_UTILS_MAC_H_
OLDNEW
« no previous file with comments | « skia/ext/platform_device_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698