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

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

Issue 118488: Add file icons to chrome://downloads/ on the Mac. Add Skia helper CGImageToSkBitmap(). (Closed)
Patch Set: Switch to using |-drawInRect:| rather than |-drawAtPoint:| Created 11 years, 6 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
« no previous file with comments | « chrome/browser/icon_manager_mac.mm ('k') | skia/ext/skia_utils_mac.cc » ('j') | 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) 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
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
OLDNEW
« no previous file with comments | « chrome/browser/icon_manager_mac.mm ('k') | skia/ext/skia_utils_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698