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 <algorithm> | 8 #include <algorithm> |
9 #include <cstring> | 9 #include <cstring> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
18 #include "skia/ext/refptr.h" | 18 #include "skia/ext/refptr.h" |
19 #include "third_party/skia/include/core/SkColor.h" | 19 #include "third_party/skia/include/core/SkColor.h" |
20 #include "third_party/skia/include/core/SkPaint.h" | 20 #include "third_party/skia/include/core/SkPaint.h" |
21 #include "third_party/skia/include/core/SkRect.h" | 21 #include "third_party/skia/include/core/SkRect.h" |
msw
2014/08/29 17:00:32
This is no longer needed (at least for the header)
| |
22 #include "ui/gfx/break_list.h" | 22 #include "ui/gfx/break_list.h" |
23 #include "ui/gfx/font_list.h" | 23 #include "ui/gfx/font_list.h" |
24 #include "ui/gfx/font_render_params.h" | 24 #include "ui/gfx/font_render_params.h" |
25 #include "ui/gfx/point.h" | 25 #include "ui/gfx/point.h" |
26 #include "ui/gfx/range/range.h" | 26 #include "ui/gfx/range/range.h" |
27 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
28 #include "ui/gfx/selection_model.h" | 28 #include "ui/gfx/selection_model.h" |
29 #include "ui/gfx/shadow_value.h" | 29 #include "ui/gfx/shadow_value.h" |
30 #include "ui/gfx/size_f.h" | 30 #include "ui/gfx/size_f.h" |
31 #include "ui/gfx/text_constants.h" | 31 #include "ui/gfx/text_constants.h" |
(...skipping 19 matching lines...) Expand all Loading... | |
51 explicit SkiaTextRenderer(Canvas* canvas); | 51 explicit SkiaTextRenderer(Canvas* canvas); |
52 ~SkiaTextRenderer(); | 52 ~SkiaTextRenderer(); |
53 | 53 |
54 void SetDrawLooper(SkDrawLooper* draw_looper); | 54 void SetDrawLooper(SkDrawLooper* draw_looper); |
55 void SetFontRenderParams(const FontRenderParams& params, | 55 void SetFontRenderParams(const FontRenderParams& params, |
56 bool background_is_transparent); | 56 bool background_is_transparent); |
57 void SetTypeface(SkTypeface* typeface); | 57 void SetTypeface(SkTypeface* typeface); |
58 void SetTextSize(SkScalar size); | 58 void SetTextSize(SkScalar size); |
59 void SetFontFamilyWithStyle(const std::string& family, int font_style); | 59 void SetFontFamilyWithStyle(const std::string& family, int font_style); |
60 void SetForegroundColor(SkColor foreground); | 60 void SetForegroundColor(SkColor foreground); |
61 void SetShader(SkShader* shader, const Rect& bounds); | 61 void SetShader(SkShader* shader); |
62 // Sets underline metrics to use if the text will be drawn with an underline. | 62 // Sets underline metrics to use if the text will be drawn with an underline. |
63 // If not set, default values based on the size of the text will be used. The | 63 // If not set, default values based on the size of the text will be used. The |
64 // two metrics must be set together. | 64 // two metrics must be set together. |
65 void SetUnderlineMetrics(SkScalar thickness, SkScalar position); | 65 void SetUnderlineMetrics(SkScalar thickness, SkScalar position); |
66 void DrawSelection(const std::vector<Rect>& selection, SkColor color); | 66 void DrawSelection(const std::vector<Rect>& selection, SkColor color); |
67 void DrawPosText(const SkPoint* pos, | 67 void DrawPosText(const SkPoint* pos, |
68 const uint16* glyphs, | 68 const uint16* glyphs, |
69 size_t glyph_count); | 69 size_t glyph_count); |
70 // Draw underline and strike-through text decorations. | 70 // Draw underline and strike-through text decorations. |
71 // Based on |SkCanvas::DrawTextDecorations()| and constants from: | 71 // Based on |SkCanvas::DrawTextDecorations()| and constants from: |
(...skipping 23 matching lines...) Expand all Loading... | |
95 const Point start_; | 95 const Point start_; |
96 SkPaint paint_; | 96 SkPaint paint_; |
97 int total_length_; | 97 int total_length_; |
98 std::vector<Piece> pieces_; | 98 std::vector<Piece> pieces_; |
99 | 99 |
100 DISALLOW_COPY_AND_ASSIGN(DiagonalStrike); | 100 DISALLOW_COPY_AND_ASSIGN(DiagonalStrike); |
101 }; | 101 }; |
102 | 102 |
103 Canvas* canvas_; | 103 Canvas* canvas_; |
104 SkCanvas* canvas_skia_; | 104 SkCanvas* canvas_skia_; |
105 bool started_drawing_; | 105 bool started_drawing_; |
msw
2014/08/29 17:00:32
This is now unused, can you remove this?
| |
106 SkPaint paint_; | 106 SkPaint paint_; |
107 SkRect bounds_; | |
108 skia::RefPtr<SkShader> deferred_fade_shader_; | |
109 SkScalar underline_thickness_; | 107 SkScalar underline_thickness_; |
110 SkScalar underline_position_; | 108 SkScalar underline_position_; |
111 scoped_ptr<DiagonalStrike> diagonal_; | 109 scoped_ptr<DiagonalStrike> diagonal_; |
112 | 110 |
113 DISALLOW_COPY_AND_ASSIGN(SkiaTextRenderer); | 111 DISALLOW_COPY_AND_ASSIGN(SkiaTextRenderer); |
114 }; | 112 }; |
115 | 113 |
116 // Internal helper class used by derived classes to iterate colors and styles. | 114 // Internal helper class used by derived classes to iterate colors and styles. |
117 class StyleIterator { | 115 class StyleIterator { |
118 public: | 116 public: |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
726 // Lines computed by EnsureLayout. These should be invalidated with | 724 // Lines computed by EnsureLayout. These should be invalidated with |
727 // ResetLayout and on |display_rect_| changes. | 725 // ResetLayout and on |display_rect_| changes. |
728 std::vector<internal::Line> lines_; | 726 std::vector<internal::Line> lines_; |
729 | 727 |
730 DISALLOW_COPY_AND_ASSIGN(RenderText); | 728 DISALLOW_COPY_AND_ASSIGN(RenderText); |
731 }; | 729 }; |
732 | 730 |
733 } // namespace gfx | 731 } // namespace gfx |
734 | 732 |
735 #endif // UI_GFX_RENDER_TEXT_H_ | 733 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |