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 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 virtual ~SkiaTextRenderer(); | 58 virtual ~SkiaTextRenderer(); |
59 | 59 |
60 void SetDrawLooper(SkDrawLooper* draw_looper); | 60 void SetDrawLooper(SkDrawLooper* draw_looper); |
61 void SetFontRenderParams(const FontRenderParams& params, | 61 void SetFontRenderParams(const FontRenderParams& params, |
62 bool subpixel_rendering_suppressed); | 62 bool subpixel_rendering_suppressed); |
63 void SetTypeface(SkTypeface* typeface); | 63 void SetTypeface(SkTypeface* typeface); |
64 void SetTextSize(SkScalar size); | 64 void SetTextSize(SkScalar size); |
65 void SetFontWithStyle(const Font& font, int font_style); | 65 void SetFontWithStyle(const Font& font, int font_style); |
66 void SetForegroundColor(SkColor foreground); | 66 void SetForegroundColor(SkColor foreground); |
67 void SetShader(SkShader* shader); | 67 void SetShader(SkShader* shader); |
| 68 void SetHaloEffect(); |
68 // Sets underline metrics to use if the text will be drawn with an underline. | 69 // Sets underline metrics to use if the text will be drawn with an underline. |
69 // If not set, default values based on the size of the text will be used. The | 70 // If not set, default values based on the size of the text will be used. The |
70 // two metrics must be set together. | 71 // two metrics must be set together. |
71 void SetUnderlineMetrics(SkScalar thickness, SkScalar position); | 72 void SetUnderlineMetrics(SkScalar thickness, SkScalar position); |
72 void DrawSelection(const std::vector<Rect>& selection, SkColor color); | 73 void DrawSelection(const std::vector<Rect>& selection, SkColor color); |
73 virtual void DrawPosText(const SkPoint* pos, | 74 virtual void DrawPosText(const SkPoint* pos, |
74 const uint16_t* glyphs, | 75 const uint16_t* glyphs, |
75 size_t glyph_count); | 76 size_t glyph_count); |
76 // Draw underline and strike-through text decorations. | 77 // Draw underline and strike-through text decorations. |
77 // Based on |SkCanvas::DrawTextDecorations()| and constants from: | 78 // Based on |SkCanvas::DrawTextDecorations()| and constants from: |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 const Rect& display_rect() const { return display_rect_; } | 294 const Rect& display_rect() const { return display_rect_; } |
294 void SetDisplayRect(const Rect& r); | 295 void SetDisplayRect(const Rect& r); |
295 | 296 |
296 bool subpixel_rendering_suppressed() const { | 297 bool subpixel_rendering_suppressed() const { |
297 return subpixel_rendering_suppressed_; | 298 return subpixel_rendering_suppressed_; |
298 } | 299 } |
299 void set_subpixel_rendering_suppressed(bool suppressed) { | 300 void set_subpixel_rendering_suppressed(bool suppressed) { |
300 subpixel_rendering_suppressed_ = suppressed; | 301 subpixel_rendering_suppressed_ = suppressed; |
301 } | 302 } |
302 | 303 |
| 304 bool halo_effect() const { return halo_effect_; } |
| 305 void set_halo_effect(bool halo_effect) { halo_effect_ = halo_effect; } |
| 306 |
303 const SelectionModel& selection_model() const { return selection_model_; } | 307 const SelectionModel& selection_model() const { return selection_model_; } |
304 | 308 |
305 const Range& selection() const { return selection_model_.selection(); } | 309 const Range& selection() const { return selection_model_.selection(); } |
306 | 310 |
307 size_t cursor_position() const { return selection_model_.caret_pos(); } | 311 size_t cursor_position() const { return selection_model_.caret_pos(); } |
308 void SetCursorPosition(size_t position); | 312 void SetCursorPosition(size_t position); |
309 | 313 |
310 // Moves the cursor left or right. Cursor movement is visual, meaning that | 314 // Moves the cursor left or right. Cursor movement is visual, meaning that |
311 // left and right are relative to screen, not the directionality of the text. | 315 // left and right are relative to screen, not the directionality of the text. |
312 // If |select| is false, the selection start is moved to the same position. | 316 // If |select| is false, the selection start is moved to the same position. |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 // The cached bounds and offset are invalidated by changes to the cursor, | 814 // The cached bounds and offset are invalidated by changes to the cursor, |
811 // selection, font, and other operations that adjust the visible text bounds. | 815 // selection, font, and other operations that adjust the visible text bounds. |
812 bool cached_bounds_and_offset_valid_; | 816 bool cached_bounds_and_offset_valid_; |
813 | 817 |
814 // Text shadows to be drawn. | 818 // Text shadows to be drawn. |
815 ShadowValues shadows_; | 819 ShadowValues shadows_; |
816 | 820 |
817 // A list of valid display text line break positions. | 821 // A list of valid display text line break positions. |
818 BreakList<size_t> line_breaks_; | 822 BreakList<size_t> line_breaks_; |
819 | 823 |
| 824 // Draw text with 1px border. |
| 825 bool halo_effect_ = false; |
| 826 |
820 // Lines computed by EnsureLayout. These should be invalidated upon | 827 // Lines computed by EnsureLayout. These should be invalidated upon |
821 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 828 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
822 std::vector<internal::Line> lines_; | 829 std::vector<internal::Line> lines_; |
823 | 830 |
824 DISALLOW_COPY_AND_ASSIGN(RenderText); | 831 DISALLOW_COPY_AND_ASSIGN(RenderText); |
825 }; | 832 }; |
826 | 833 |
827 } // namespace gfx | 834 } // namespace gfx |
828 | 835 |
829 #endif // UI_GFX_RENDER_TEXT_H_ | 836 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |