| 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 19 matching lines...) Expand all Loading... |
| 30 #include "ui/gfx/geometry/size_f.h" | 30 #include "ui/gfx/geometry/size_f.h" |
| 31 #include "ui/gfx/geometry/vector2d.h" | 31 #include "ui/gfx/geometry/vector2d.h" |
| 32 #include "ui/gfx/range/range.h" | 32 #include "ui/gfx/range/range.h" |
| 33 #include "ui/gfx/range/range_f.h" | 33 #include "ui/gfx/range/range_f.h" |
| 34 #include "ui/gfx/selection_model.h" | 34 #include "ui/gfx/selection_model.h" |
| 35 #include "ui/gfx/shadow_value.h" | 35 #include "ui/gfx/shadow_value.h" |
| 36 #include "ui/gfx/text_constants.h" | 36 #include "ui/gfx/text_constants.h" |
| 37 | 37 |
| 38 class SkDrawLooper; | 38 class SkDrawLooper; |
| 39 struct SkPoint; | 39 struct SkPoint; |
| 40 class SkShader; | |
| 41 class SkTypeface; | 40 class SkTypeface; |
| 42 | 41 |
| 43 namespace gfx { | 42 namespace gfx { |
| 44 namespace test { | 43 namespace test { |
| 45 class RenderTextTestApi; | 44 class RenderTextTestApi; |
| 46 } | 45 } |
| 47 | 46 |
| 48 class Canvas; | 47 class Canvas; |
| 49 struct DecoratedText; | 48 struct DecoratedText; |
| 50 class Font; | 49 class Font; |
| 51 | 50 |
| 52 namespace internal { | 51 namespace internal { |
| 53 | 52 |
| 54 // Internal helper class used by derived classes to draw text through Skia. | 53 // Internal helper class used by derived classes to draw text through Skia. |
| 55 class GFX_EXPORT SkiaTextRenderer { | 54 class GFX_EXPORT SkiaTextRenderer { |
| 56 public: | 55 public: |
| 57 explicit SkiaTextRenderer(Canvas* canvas); | 56 explicit SkiaTextRenderer(Canvas* canvas); |
| 58 virtual ~SkiaTextRenderer(); | 57 virtual ~SkiaTextRenderer(); |
| 59 | 58 |
| 60 void SetDrawLooper(sk_sp<SkDrawLooper> draw_looper); | 59 void SetDrawLooper(sk_sp<SkDrawLooper> draw_looper); |
| 61 void SetFontRenderParams(const FontRenderParams& params, | 60 void SetFontRenderParams(const FontRenderParams& params, |
| 62 bool subpixel_rendering_suppressed); | 61 bool subpixel_rendering_suppressed); |
| 63 void SetTypeface(sk_sp<SkTypeface> typeface); | 62 void SetTypeface(sk_sp<SkTypeface> typeface); |
| 64 void SetTextSize(SkScalar size); | 63 void SetTextSize(SkScalar size); |
| 65 void SetForegroundColor(SkColor foreground); | 64 void SetForegroundColor(SkColor foreground); |
| 66 void SetShader(sk_sp<SkShader> shader); | 65 void SetShader(std::unique_ptr<cc::PaintShader> shader); |
| 67 // Sets underline metrics to use if the text will be drawn with an underline. | 66 // Sets underline metrics to use if the text will be drawn with an underline. |
| 68 // If not set, default values based on the size of the text will be used. The | 67 // If not set, default values based on the size of the text will be used. The |
| 69 // two metrics must be set together. | 68 // two metrics must be set together. |
| 70 void SetUnderlineMetrics(SkScalar thickness, SkScalar position); | 69 void SetUnderlineMetrics(SkScalar thickness, SkScalar position); |
| 71 void DrawSelection(const std::vector<Rect>& selection, SkColor color); | 70 void DrawSelection(const std::vector<Rect>& selection, SkColor color); |
| 72 virtual void DrawPosText(const SkPoint* pos, | 71 virtual void DrawPosText(const SkPoint* pos, |
| 73 const uint16_t* glyphs, | 72 const uint16_t* glyphs, |
| 74 size_t glyph_count); | 73 size_t glyph_count); |
| 75 // Draw underline and strike-through text decorations. | 74 // Draw underline and strike-through text decorations. |
| 76 // Based on |SkCanvas::DrawTextDecorations()| and constants from: | 75 // Based on |SkCanvas::DrawTextDecorations()| and constants from: |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 // Lines computed by EnsureLayout. These should be invalidated upon | 856 // Lines computed by EnsureLayout. These should be invalidated upon |
| 858 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 857 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
| 859 std::vector<internal::Line> lines_; | 858 std::vector<internal::Line> lines_; |
| 860 | 859 |
| 861 DISALLOW_COPY_AND_ASSIGN(RenderText); | 860 DISALLOW_COPY_AND_ASSIGN(RenderText); |
| 862 }; | 861 }; |
| 863 | 862 |
| 864 } // namespace gfx | 863 } // namespace gfx |
| 865 | 864 |
| 866 #endif // UI_GFX_RENDER_TEXT_H_ | 865 #endif // UI_GFX_RENDER_TEXT_H_ |
| OLD | NEW |