| 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_SKIA_H_ | 5 #ifndef UI_GFX_CANVAS_SKIA_H_ |
| 6 #define UI_GFX_CANVAS_SKIA_H_ | 6 #define UI_GFX_CANVAS_SKIA_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 // Compute the size required to draw some text with the provided font. | 64 // Compute the size required to draw some text with the provided font. |
| 65 // Attempts to fit the text with the provided width and height. Increases | 65 // Attempts to fit the text with the provided width and height. Increases |
| 66 // height and then width as needed to make the text fit. This method | 66 // height and then width as needed to make the text fit. This method |
| 67 // supports multiple lines. | 67 // supports multiple lines. |
| 68 static void SizeStringInt(const string16& text, | 68 static void SizeStringInt(const string16& text, |
| 69 const gfx::Font& font, | 69 const gfx::Font& font, |
| 70 int* width, int* height, | 70 int* width, int* height, |
| 71 int flags); | 71 int flags); |
| 72 | 72 |
| 73 // Returns the number of horizontal pixels needed to display the specified |
| 74 // |text| with |font|. |
| 75 static int GetStringWidth(const string16& text, const gfx::Font& font); |
| 76 |
| 73 // Returns the default text alignment to be used when drawing text on a | 77 // Returns the default text alignment to be used when drawing text on a |
| 74 // gfx::CanvasSkia based on the directionality of the system locale language. | 78 // gfx::CanvasSkia based on the directionality of the system locale language. |
| 75 // This function is used by gfx::Canvas::DrawStringInt when the text alignment | 79 // This function is used by gfx::Canvas::DrawStringInt when the text alignment |
| 76 // is not specified. | 80 // is not specified. |
| 77 // | 81 // |
| 78 // This function returns either gfx::Canvas::TEXT_ALIGN_LEFT or | 82 // This function returns either gfx::Canvas::TEXT_ALIGN_LEFT or |
| 79 // gfx::Canvas::TEXT_ALIGN_RIGHT. | 83 // gfx::Canvas::TEXT_ALIGN_RIGHT. |
| 80 static int DefaultCanvasTextAlignment(); | 84 static int DefaultCanvasTextAlignment(); |
| 81 | 85 |
| 82 #if defined(TOOLKIT_USES_GTK) | 86 #if defined(TOOLKIT_USES_GTK) |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 203 |
| 200 scoped_ptr<skia::PlatformCanvas> owned_canvas_; | 204 scoped_ptr<skia::PlatformCanvas> owned_canvas_; |
| 201 SkCanvas* canvas_; | 205 SkCanvas* canvas_; |
| 202 | 206 |
| 203 DISALLOW_COPY_AND_ASSIGN(CanvasSkia); | 207 DISALLOW_COPY_AND_ASSIGN(CanvasSkia); |
| 204 }; | 208 }; |
| 205 | 209 |
| 206 } // namespace gfx | 210 } // namespace gfx |
| 207 | 211 |
| 208 #endif // UI_GFX_CANVAS_SKIA_H_ | 212 #endif // UI_GFX_CANVAS_SKIA_H_ |
| OLD | NEW |