Chromium Code Reviews| 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. | |
|
sky
2013/10/08 02:12:56
Please add a comment here and any public API you'r
jianli
2013/10/08 18:29:48
Added comment in Canvas::GetStringWidthF. We do no
| |
| 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 // This is same as GetStringWidth except that fractional width is returned. | |
| 158 static float GetStringWidthF(const base::string16& text, | |
| 159 const FontList& font_list); | |
| 160 | |
| 149 // Returns the default text alignment to be used when drawing text on a | 161 // Returns the default text alignment to be used when drawing text on a |
| 150 // Canvas based on the directionality of the system locale language. | 162 // Canvas based on the directionality of the system locale language. |
| 151 // This function is used by Canvas::DrawStringInt when the text alignment | 163 // This function is used by Canvas::DrawStringInt when the text alignment |
| 152 // is not specified. | 164 // is not specified. |
| 153 // | 165 // |
| 154 // This function returns either Canvas::TEXT_ALIGN_LEFT or | 166 // This function returns either Canvas::TEXT_ALIGN_LEFT or |
| 155 // Canvas::TEXT_ALIGN_RIGHT. | 167 // Canvas::TEXT_ALIGN_RIGHT. |
| 156 static int DefaultCanvasTextAlignment(); | 168 static int DefaultCanvasTextAlignment(); |
| 157 | 169 |
| 158 // Draws text with a 1-pixel halo around it of the given color. | 170 // 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 | 490 |
| 479 skia::RefPtr<skia::PlatformCanvas> owned_canvas_; | 491 skia::RefPtr<skia::PlatformCanvas> owned_canvas_; |
| 480 SkCanvas* canvas_; | 492 SkCanvas* canvas_; |
| 481 | 493 |
| 482 DISALLOW_COPY_AND_ASSIGN(Canvas); | 494 DISALLOW_COPY_AND_ASSIGN(Canvas); |
| 483 }; | 495 }; |
| 484 | 496 |
| 485 } // namespace gfx | 497 } // namespace gfx |
| 486 | 498 |
| 487 #endif // UI_GFX_CANVAS_H_ | 499 #endif // UI_GFX_CANVAS_H_ |
| OLD | NEW |