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_RENDER_TEXT_H_ | 5 #ifndef UI_GFX_RENDER_TEXT_H_ |
6 #define UI_GFX_RENDER_TEXT_H_ | 6 #define UI_GFX_RENDER_TEXT_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <algorithm> | 11 #include <algorithm> |
9 #include <cstring> | 12 #include <cstring> |
10 #include <string> | 13 #include <string> |
11 #include <utility> | 14 #include <utility> |
12 #include <vector> | 15 #include <vector> |
13 | 16 |
14 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
15 #include "base/i18n/rtl.h" | 18 #include "base/i18n/rtl.h" |
| 19 #include "base/macros.h" |
16 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
17 #include "base/strings/string16.h" | 21 #include "base/strings/string16.h" |
18 #include "skia/ext/refptr.h" | 22 #include "skia/ext/refptr.h" |
19 #include "third_party/skia/include/core/SkColor.h" | 23 #include "third_party/skia/include/core/SkColor.h" |
20 #include "third_party/skia/include/core/SkPaint.h" | 24 #include "third_party/skia/include/core/SkPaint.h" |
21 #include "ui/gfx/break_list.h" | 25 #include "ui/gfx/break_list.h" |
22 #include "ui/gfx/font_list.h" | 26 #include "ui/gfx/font_list.h" |
23 #include "ui/gfx/font_render_params.h" | 27 #include "ui/gfx/font_render_params.h" |
24 #include "ui/gfx/geometry/point.h" | 28 #include "ui/gfx/geometry/point.h" |
25 #include "ui/gfx/geometry/rect.h" | 29 #include "ui/gfx/geometry/rect.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 void SetTextSize(SkScalar size); | 64 void SetTextSize(SkScalar size); |
61 void SetFontWithStyle(const Font& font, int font_style); | 65 void SetFontWithStyle(const Font& font, int font_style); |
62 void SetForegroundColor(SkColor foreground); | 66 void SetForegroundColor(SkColor foreground); |
63 void SetShader(SkShader* shader); | 67 void SetShader(SkShader* shader); |
64 // Sets underline metrics to use if the text will be drawn with an underline. | 68 // Sets underline metrics to use if the text will be drawn with an underline. |
65 // If not set, default values based on the size of the text will be used. The | 69 // If not set, default values based on the size of the text will be used. The |
66 // two metrics must be set together. | 70 // two metrics must be set together. |
67 void SetUnderlineMetrics(SkScalar thickness, SkScalar position); | 71 void SetUnderlineMetrics(SkScalar thickness, SkScalar position); |
68 void DrawSelection(const std::vector<Rect>& selection, SkColor color); | 72 void DrawSelection(const std::vector<Rect>& selection, SkColor color); |
69 virtual void DrawPosText(const SkPoint* pos, | 73 virtual void DrawPosText(const SkPoint* pos, |
70 const uint16* glyphs, | 74 const uint16_t* glyphs, |
71 size_t glyph_count); | 75 size_t glyph_count); |
72 // Draw underline and strike-through text decorations. | 76 // Draw underline and strike-through text decorations. |
73 // Based on |SkCanvas::DrawTextDecorations()| and constants from: | 77 // Based on |SkCanvas::DrawTextDecorations()| and constants from: |
74 // third_party/skia/src/core/SkTextFormatParams.h | 78 // third_party/skia/src/core/SkTextFormatParams.h |
75 virtual void DrawDecorations(int x, int y, int width, bool underline, | 79 virtual void DrawDecorations(int x, int y, int width, bool underline, |
76 bool strike, bool diagonal_strike); | 80 bool strike, bool diagonal_strike); |
77 // Finishes any ongoing diagonal strike run. | 81 // Finishes any ongoing diagonal strike run. |
78 void EndDiagonalStrike(); | 82 void EndDiagonalStrike(); |
79 void DrawUnderline(int x, int y, int width); | 83 void DrawUnderline(int x, int y, int width); |
80 void DrawStrike(int x, int y, int width) const; | 84 void DrawStrike(int x, int y, int width) const; |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 // Lines computed by EnsureLayout. These should be invalidated upon | 820 // Lines computed by EnsureLayout. These should be invalidated upon |
817 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 821 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
818 std::vector<internal::Line> lines_; | 822 std::vector<internal::Line> lines_; |
819 | 823 |
820 DISALLOW_COPY_AND_ASSIGN(RenderText); | 824 DISALLOW_COPY_AND_ASSIGN(RenderText); |
821 }; | 825 }; |
822 | 826 |
823 } // namespace gfx | 827 } // namespace gfx |
824 | 828 |
825 #endif // UI_GFX_RENDER_TEXT_H_ | 829 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |