| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cstring> | 10 #include <cstring> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 // Internal helper class used by derived classes to draw text through Skia. | 42 // Internal helper class used by derived classes to draw text through Skia. |
| 43 class SkiaTextRenderer { | 43 class SkiaTextRenderer { |
| 44 public: | 44 public: |
| 45 explicit SkiaTextRenderer(Canvas* canvas); | 45 explicit SkiaTextRenderer(Canvas* canvas); |
| 46 ~SkiaTextRenderer(); | 46 ~SkiaTextRenderer(); |
| 47 | 47 |
| 48 void SetDrawLooper(SkDrawLooper* draw_looper); | 48 void SetDrawLooper(SkDrawLooper* draw_looper); |
| 49 void SetFontSmoothingSettings(bool enable_smoothing, bool enable_lcd_text); | 49 void SetFontSmoothingSettings(bool enable_smoothing, bool enable_lcd_text); |
| 50 void SetTypeface(SkTypeface* typeface); | 50 void SetTypeface(SkTypeface* typeface); |
| 51 void SetTextSize(int size); | 51 void SetTextSize(SkScalar size); |
| 52 void SetFontFamilyWithStyle(const std::string& family, int font_style); | 52 void SetFontFamilyWithStyle(const std::string& family, int font_style); |
| 53 void SetForegroundColor(SkColor foreground); | 53 void SetForegroundColor(SkColor foreground); |
| 54 void SetShader(SkShader* shader, const Rect& bounds); | 54 void SetShader(SkShader* shader, const Rect& bounds); |
| 55 void SetUnderlineMetrics(SkScalar thickness, SkScalar position); |
| 55 void DrawSelection(const std::vector<Rect>& selection, SkColor color); | 56 void DrawSelection(const std::vector<Rect>& selection, SkColor color); |
| 56 void DrawPosText(const SkPoint* pos, | 57 void DrawPosText(const SkPoint* pos, |
| 57 const uint16* glyphs, | 58 const uint16* glyphs, |
| 58 size_t glyph_count); | 59 size_t glyph_count); |
| 59 void DrawDecorations(int x, int y, int width, const StyleRange& style); | 60 void DrawDecorations(int x, int y, int width, const StyleRange& style); |
| 60 | 61 |
| 61 private: | 62 private: |
| 62 SkCanvas* canvas_skia_; | 63 SkCanvas* canvas_skia_; |
| 63 bool started_drawing_; | 64 bool started_drawing_; |
| 64 SkPaint paint_; | 65 SkPaint paint_; |
| 65 SkRect bounds_; | 66 SkRect bounds_; |
| 66 SkRefPtr<SkShader> deferred_fade_shader_; | 67 SkRefPtr<SkShader> deferred_fade_shader_; |
| 68 SkScalar underline_thickness_; |
| 69 SkScalar underline_position_; |
| 67 | 70 |
| 68 DISALLOW_COPY_AND_ASSIGN(SkiaTextRenderer); | 71 DISALLOW_COPY_AND_ASSIGN(SkiaTextRenderer); |
| 69 }; | 72 }; |
| 70 | 73 |
| 71 } // namespace internal | 74 } // namespace internal |
| 72 | 75 |
| 73 // A visual style applicable to a range of text. | 76 // A visual style applicable to a range of text. |
| 74 struct UI_EXPORT StyleRange { | 77 struct UI_EXPORT StyleRange { |
| 75 StyleRange(); | 78 StyleRange(); |
| 76 | 79 |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 | 487 |
| 485 // Text shadows to be drawn. | 488 // Text shadows to be drawn. |
| 486 ShadowValues text_shadows_; | 489 ShadowValues text_shadows_; |
| 487 | 490 |
| 488 DISALLOW_COPY_AND_ASSIGN(RenderText); | 491 DISALLOW_COPY_AND_ASSIGN(RenderText); |
| 489 }; | 492 }; |
| 490 | 493 |
| 491 } // namespace gfx | 494 } // namespace gfx |
| 492 | 495 |
| 493 #endif // UI_GFX_RENDER_TEXT_H_ | 496 #endif // UI_GFX_RENDER_TEXT_H_ |
| OLD | NEW |