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" |
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/point.h" | 25 #include "ui/gfx/point.h" |
25 #include "ui/gfx/range/range.h" | 26 #include "ui/gfx/range/range.h" |
26 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
27 #include "ui/gfx/selection_model.h" | 28 #include "ui/gfx/selection_model.h" |
28 #include "ui/gfx/shadow_value.h" | 29 #include "ui/gfx/shadow_value.h" |
29 #include "ui/gfx/size_f.h" | 30 #include "ui/gfx/size_f.h" |
30 #include "ui/gfx/text_constants.h" | 31 #include "ui/gfx/text_constants.h" |
31 #include "ui/gfx/text_elider.h" | 32 #include "ui/gfx/text_elider.h" |
32 #include "ui/gfx/vector2d.h" | 33 #include "ui/gfx/vector2d.h" |
33 | 34 |
(...skipping 11 matching lines...) Expand all Loading... |
45 | 46 |
46 namespace internal { | 47 namespace internal { |
47 | 48 |
48 // Internal helper class used by derived classes to draw text through Skia. | 49 // Internal helper class used by derived classes to draw text through Skia. |
49 class SkiaTextRenderer { | 50 class SkiaTextRenderer { |
50 public: | 51 public: |
51 explicit SkiaTextRenderer(Canvas* canvas); | 52 explicit SkiaTextRenderer(Canvas* canvas); |
52 ~SkiaTextRenderer(); | 53 ~SkiaTextRenderer(); |
53 | 54 |
54 void SetDrawLooper(SkDrawLooper* draw_looper); | 55 void SetDrawLooper(SkDrawLooper* draw_looper); |
55 void SetFontSmoothingSettings(bool antialiasing, | 56 void SetFontRenderParams(const FontRenderParams& params, |
56 bool subpixel_rendering, | 57 bool background_is_transparent); |
57 bool subpixel_positioning); | |
58 void SetFontHinting(SkPaint::Hinting hinting); | 58 void SetFontHinting(SkPaint::Hinting hinting); |
59 void SetTypeface(SkTypeface* typeface); | 59 void SetTypeface(SkTypeface* typeface); |
60 void SetTextSize(SkScalar size); | 60 void SetTextSize(SkScalar size); |
61 void SetFontFamilyWithStyle(const std::string& family, int font_style); | 61 void SetFontFamilyWithStyle(const std::string& family, int font_style); |
62 void SetForegroundColor(SkColor foreground); | 62 void SetForegroundColor(SkColor foreground); |
63 void SetShader(SkShader* shader, const Rect& bounds); | 63 void SetShader(SkShader* shader, const Rect& bounds); |
64 // Sets underline metrics to use if the text will be drawn with an underline. | 64 // 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 | 65 // If not set, default values based on the size of the text will be used. The |
66 // two metrics must be set together. | 66 // two metrics must be set together. |
67 void SetUnderlineMetrics(SkScalar thickness, SkScalar position); | 67 void SetUnderlineMetrics(SkScalar thickness, SkScalar position); |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 // Lines computed by EnsureLayout. These should be invalidated with | 700 // Lines computed by EnsureLayout. These should be invalidated with |
701 // ResetLayout and on |display_rect_| changes. | 701 // ResetLayout and on |display_rect_| changes. |
702 std::vector<internal::Line> lines_; | 702 std::vector<internal::Line> lines_; |
703 | 703 |
704 DISALLOW_COPY_AND_ASSIGN(RenderText); | 704 DISALLOW_COPY_AND_ASSIGN(RenderText); |
705 }; | 705 }; |
706 | 706 |
707 } // namespace gfx | 707 } // namespace gfx |
708 | 708 |
709 #endif // UI_GFX_RENDER_TEXT_H_ | 709 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |