| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "ui/gfx/render_text_harfbuzz.h" | 5 #include "ui/gfx/render_text_harfbuzz.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/debug/leak_annotations.h" | 9 #include "base/debug/leak_annotations.h" |
| 10 #include "base/i18n/bidi_line_iterator.h" | 10 #include "base/i18n/bidi_line_iterator.h" |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 } | 771 } |
| 772 } | 772 } |
| 773 | 773 |
| 774 void RenderTextHarfBuzz::DrawVisualText(Canvas* canvas) { | 774 void RenderTextHarfBuzz::DrawVisualText(Canvas* canvas) { |
| 775 DCHECK(!needs_layout_); | 775 DCHECK(!needs_layout_); |
| 776 internal::SkiaTextRenderer renderer(canvas); | 776 internal::SkiaTextRenderer renderer(canvas); |
| 777 ApplyFadeEffects(&renderer); | 777 ApplyFadeEffects(&renderer); |
| 778 ApplyTextShadows(&renderer); | 778 ApplyTextShadows(&renderer); |
| 779 | 779 |
| 780 #if defined(OS_WIN) || defined(OS_LINUX) | 780 #if defined(OS_WIN) || defined(OS_LINUX) |
| 781 // TODO(derat): Use font-specific params: http://crbug.com/125235 | 781 renderer.SetFontRenderParams( |
| 782 renderer.SetFontRenderParams(GetDefaultFontRenderParams(), | 782 font_list().GetPrimaryFont().GetFontRenderParams(), |
| 783 background_is_transparent()); | 783 background_is_transparent()); |
| 784 #endif | 784 #endif |
| 785 | 785 |
| 786 ApplyCompositionAndSelectionStyles(); | 786 ApplyCompositionAndSelectionStyles(); |
| 787 | 787 |
| 788 int current_x = 0; | 788 int current_x = 0; |
| 789 const Vector2d line_offset = GetLineOffset(0); | 789 const Vector2d line_offset = GetLineOffset(0); |
| 790 for (size_t i = 0; i < runs_.size(); ++i) { | 790 for (size_t i = 0; i < runs_.size(); ++i) { |
| 791 const internal::TextRunHarfBuzz& run = *runs_[visual_to_logical_[i]]; | 791 const internal::TextRunHarfBuzz& run = *runs_[visual_to_logical_[i]]; |
| 792 renderer.SetTypeface(run.skia_face.get()); | 792 renderer.SetTypeface(run.skia_face.get()); |
| 793 renderer.SetTextSize(run.font_size); | 793 renderer.SetTextSize(run.font_size); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 run->positions[i].set(run->width + x_offset, -y_offset); | 992 run->positions[i].set(run->width + x_offset, -y_offset); |
| 993 run->width += | 993 run->width += |
| 994 SkScalarRoundToInt(SkFixedToScalar(hb_positions[i].x_advance)); | 994 SkScalarRoundToInt(SkFixedToScalar(hb_positions[i].x_advance)); |
| 995 } | 995 } |
| 996 | 996 |
| 997 hb_buffer_destroy(buffer); | 997 hb_buffer_destroy(buffer); |
| 998 hb_font_destroy(harfbuzz_font); | 998 hb_font_destroy(harfbuzz_font); |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 } // namespace gfx | 1001 } // namespace gfx |
| OLD | NEW |