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> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <algorithm> | 11 #include <algorithm> |
12 #include <cstring> | 12 #include <cstring> |
| 13 #include <memory> |
13 #include <string> | 14 #include <string> |
14 #include <utility> | 15 #include <utility> |
15 #include <vector> | 16 #include <vector> |
16 | 17 |
17 #include "base/gtest_prod_util.h" | 18 #include "base/gtest_prod_util.h" |
18 #include "base/i18n/rtl.h" | 19 #include "base/i18n/rtl.h" |
19 #include "base/macros.h" | 20 #include "base/macros.h" |
20 #include "base/memory/scoped_ptr.h" | |
21 #include "base/strings/string16.h" | 21 #include "base/strings/string16.h" |
22 #include "skia/ext/refptr.h" | 22 #include "skia/ext/refptr.h" |
23 #include "third_party/skia/include/core/SkColor.h" | 23 #include "third_party/skia/include/core/SkColor.h" |
24 #include "third_party/skia/include/core/SkPaint.h" | 24 #include "third_party/skia/include/core/SkPaint.h" |
25 #include "ui/gfx/break_list.h" | 25 #include "ui/gfx/break_list.h" |
26 #include "ui/gfx/font_list.h" | 26 #include "ui/gfx/font_list.h" |
27 #include "ui/gfx/font_render_params.h" | 27 #include "ui/gfx/font_render_params.h" |
28 #include "ui/gfx/geometry/point.h" | 28 #include "ui/gfx/geometry/point.h" |
29 #include "ui/gfx/geometry/rect.h" | 29 #include "ui/gfx/geometry/rect.h" |
30 #include "ui/gfx/geometry/size_f.h" | 30 #include "ui/gfx/geometry/size_f.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 std::vector<Piece> pieces_; | 106 std::vector<Piece> pieces_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(DiagonalStrike); | 108 DISALLOW_COPY_AND_ASSIGN(DiagonalStrike); |
109 }; | 109 }; |
110 | 110 |
111 Canvas* canvas_; | 111 Canvas* canvas_; |
112 SkCanvas* canvas_skia_; | 112 SkCanvas* canvas_skia_; |
113 SkPaint paint_; | 113 SkPaint paint_; |
114 SkScalar underline_thickness_; | 114 SkScalar underline_thickness_; |
115 SkScalar underline_position_; | 115 SkScalar underline_position_; |
116 scoped_ptr<DiagonalStrike> diagonal_; | 116 std::unique_ptr<DiagonalStrike> diagonal_; |
117 | 117 |
118 DISALLOW_COPY_AND_ASSIGN(SkiaTextRenderer); | 118 DISALLOW_COPY_AND_ASSIGN(SkiaTextRenderer); |
119 }; | 119 }; |
120 | 120 |
121 // Internal helper class used to iterate colors, baselines, and styles. | 121 // Internal helper class used to iterate colors, baselines, and styles. |
122 class StyleIterator { | 122 class StyleIterator { |
123 public: | 123 public: |
124 StyleIterator(const BreakList<SkColor>& colors, | 124 StyleIterator(const BreakList<SkColor>& colors, |
125 const BreakList<BaselineStyle>& baselines, | 125 const BreakList<BaselineStyle>& baselines, |
126 const std::vector<BreakList<bool>>& styles); | 126 const std::vector<BreakList<bool>>& styles); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // for rendering and translation between logical and visual data. | 203 // for rendering and translation between logical and visual data. |
204 class GFX_EXPORT RenderText { | 204 class GFX_EXPORT RenderText { |
205 public: | 205 public: |
206 virtual ~RenderText(); | 206 virtual ~RenderText(); |
207 | 207 |
208 // Creates a platform-specific or cross-platform RenderText instance. | 208 // Creates a platform-specific or cross-platform RenderText instance. |
209 static RenderText* CreateInstance(); | 209 static RenderText* CreateInstance(); |
210 static RenderText* CreateInstanceForEditing(); | 210 static RenderText* CreateInstanceForEditing(); |
211 | 211 |
212 // Creates another instance of the same concrete class. | 212 // Creates another instance of the same concrete class. |
213 virtual scoped_ptr<RenderText> CreateInstanceOfSameType() const = 0; | 213 virtual std::unique_ptr<RenderText> CreateInstanceOfSameType() const = 0; |
214 | 214 |
215 const base::string16& text() const { return text_; } | 215 const base::string16& text() const { return text_; } |
216 void SetText(const base::string16& text); | 216 void SetText(const base::string16& text); |
217 void AppendText(const base::string16& text); | 217 void AppendText(const base::string16& text); |
218 | 218 |
219 HorizontalAlignment horizontal_alignment() const { | 219 HorizontalAlignment horizontal_alignment() const { |
220 return horizontal_alignment_; | 220 return horizontal_alignment_; |
221 } | 221 } |
222 void SetHorizontalAlignment(HorizontalAlignment alignment); | 222 void SetHorizontalAlignment(HorizontalAlignment alignment); |
223 | 223 |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 // Lines computed by EnsureLayout. These should be invalidated upon | 821 // Lines computed by EnsureLayout. These should be invalidated upon |
822 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 822 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
823 std::vector<internal::Line> lines_; | 823 std::vector<internal::Line> lines_; |
824 | 824 |
825 DISALLOW_COPY_AND_ASSIGN(RenderText); | 825 DISALLOW_COPY_AND_ASSIGN(RenderText); |
826 }; | 826 }; |
827 | 827 |
828 } // namespace gfx | 828 } // namespace gfx |
829 | 829 |
830 #endif // UI_GFX_RENDER_TEXT_H_ | 830 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |