OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_GFX_CANVAS_H_ | 5 #ifndef UI_GFX_CANVAS_H_ |
6 #define UI_GFX_CANVAS_H_ | 6 #define UI_GFX_CANVAS_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 int line_height, | 132 int line_height, |
133 int flags); | 133 int flags); |
134 // Obsolete version. Use the above version which takes FontList. | 134 // Obsolete version. Use the above version which takes FontList. |
135 static void SizeStringInt(const base::string16& text, | 135 static void SizeStringInt(const base::string16& text, |
136 const Font& font, | 136 const Font& font, |
137 int* width, | 137 int* width, |
138 int* height, | 138 int* height, |
139 int line_height, | 139 int line_height, |
140 int flags); | 140 int flags); |
141 | 141 |
142 // This is same as SizeStringInt except that fractional size is returned. | |
143 static void SizeStringFloat(const base::string16& text, | |
144 const FontList& font_list, | |
145 float* width, | |
146 float* height, | |
147 int line_height, | |
148 int flags); | |
149 | |
142 // Returns the number of horizontal pixels needed to display the specified | 150 // Returns the number of horizontal pixels needed to display the specified |
143 // |text| with |font_list|. | 151 // |text| with |font_list|. |
144 static int GetStringWidth(const base::string16& text, | 152 static int GetStringWidth(const base::string16& text, |
145 const FontList& font_list); | 153 const FontList& font_list); |
146 // Obsolete version. Use the above version which takes FontList. | 154 // Obsolete version. Use the above version which takes FontList. |
147 static int GetStringWidth(const base::string16& text, const Font& font); | 155 static int GetStringWidth(const base::string16& text, const Font& font); |
148 | 156 |
157 // Returns the pixel width needed to display the specified |text| with | |
158 // |font_list|. Note that the fractional width might be returned in some | |
Alexei Svitkine (slow)
2013/10/07 23:33:28
Maybe mention explicitly which ones like the rende
jianli
2013/10/08 00:01:18
Done.
| |
159 // platforms. | |
160 static float GetStringWidthF(const base::string16& text, | |
161 const FontList& font_list); | |
162 | |
149 // Returns the default text alignment to be used when drawing text on a | 163 // Returns the default text alignment to be used when drawing text on a |
150 // Canvas based on the directionality of the system locale language. | 164 // Canvas based on the directionality of the system locale language. |
151 // This function is used by Canvas::DrawStringInt when the text alignment | 165 // This function is used by Canvas::DrawStringInt when the text alignment |
152 // is not specified. | 166 // is not specified. |
153 // | 167 // |
154 // This function returns either Canvas::TEXT_ALIGN_LEFT or | 168 // This function returns either Canvas::TEXT_ALIGN_LEFT or |
155 // Canvas::TEXT_ALIGN_RIGHT. | 169 // Canvas::TEXT_ALIGN_RIGHT. |
156 static int DefaultCanvasTextAlignment(); | 170 static int DefaultCanvasTextAlignment(); |
157 | 171 |
158 // Draws text with a 1-pixel halo around it of the given color. | 172 // Draws text with a 1-pixel halo around it of the given color. |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
478 | 492 |
479 skia::RefPtr<skia::PlatformCanvas> owned_canvas_; | 493 skia::RefPtr<skia::PlatformCanvas> owned_canvas_; |
480 SkCanvas* canvas_; | 494 SkCanvas* canvas_; |
481 | 495 |
482 DISALLOW_COPY_AND_ASSIGN(Canvas); | 496 DISALLOW_COPY_AND_ASSIGN(Canvas); |
483 }; | 497 }; |
484 | 498 |
485 } // namespace gfx | 499 } // namespace gfx |
486 | 500 |
487 #endif // UI_GFX_CANVAS_H_ | 501 #endif // UI_GFX_CANVAS_H_ |
OLD | NEW |