OLD | NEW |
1 // Copyright (c) 2010 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "ui/gfx/canvas_skia.h" | 7 #include "ui/gfx/canvas_skia.h" |
8 | 8 |
9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
11 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
12 #include "third_party/skia/include/core/SkShader.h" | 12 #include "third_party/skia/include/core/SkShader.h" |
13 #include "ui/gfx/font.h" | 13 #include "ui/gfx/font.h" |
14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 | 17 |
18 CanvasSkia::CanvasSkia(int width, int height, bool is_opaque) | |
19 : skia::PlatformCanvas(width, height, is_opaque) { | |
20 } | |
21 | |
22 CanvasSkia::CanvasSkia() : skia::PlatformCanvas() { | |
23 } | |
24 | |
25 CanvasSkia::~CanvasSkia() { | |
26 } | |
27 | |
28 // static | 18 // static |
29 void CanvasSkia::SizeStringInt(const string16& text, | 19 void CanvasSkia::SizeStringInt(const string16& text, |
30 const gfx::Font& font, | 20 const gfx::Font& font, |
31 int* width, int* height, | 21 int* width, int* height, |
32 int flags) { | 22 int flags) { |
33 NSFont* native_font = font.GetNativeFont(); | 23 NSFont* native_font = font.GetNativeFont(); |
34 NSString* ns_string = base::SysUTF16ToNSString(text); | 24 NSString* ns_string = base::SysUTF16ToNSString(text); |
35 NSDictionary* attributes = | 25 NSDictionary* attributes = |
36 [NSDictionary dictionaryWithObject:native_font | 26 [NSDictionary dictionaryWithObject:native_font |
37 forKey:NSFontAttributeName]; | 27 forKey:NSFontAttributeName]; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 CGContextRestoreGState(context); | 75 CGContextRestoreGState(context); |
86 endPlatformPaint(); | 76 endPlatformPaint(); |
87 } | 77 } |
88 | 78 |
89 ui::TextureID CanvasSkia::GetTextureID() { | 79 ui::TextureID CanvasSkia::GetTextureID() { |
90 // TODO(wjmaclean) | 80 // TODO(wjmaclean) |
91 return 0; | 81 return 0; |
92 } | 82 } |
93 | 83 |
94 } // namespace gfx | 84 } // namespace gfx |
OLD | NEW |