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 #include "ui/gfx/render_text.h" | 5 #include "ui/gfx/render_text.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <climits> | 8 #include <climits> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/i18n/break_iterator.h" | 11 #include "base/i18n/break_iterator.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 17 #include "build/build_config.h" |
17 #include "third_party/icu/source/common/unicode/rbbi.h" | 18 #include "third_party/icu/source/common/unicode/rbbi.h" |
18 #include "third_party/icu/source/common/unicode/utf16.h" | 19 #include "third_party/icu/source/common/unicode/utf16.h" |
19 #include "third_party/skia/include/core/SkDrawLooper.h" | 20 #include "third_party/skia/include/core/SkDrawLooper.h" |
20 #include "third_party/skia/include/core/SkTypeface.h" | 21 #include "third_party/skia/include/core/SkTypeface.h" |
21 #include "third_party/skia/include/effects/SkGradientShader.h" | 22 #include "third_party/skia/include/effects/SkGradientShader.h" |
22 #include "ui/gfx/canvas.h" | 23 #include "ui/gfx/canvas.h" |
23 #include "ui/gfx/geometry/insets.h" | 24 #include "ui/gfx/geometry/insets.h" |
24 #include "ui/gfx/geometry/safe_integer_conversions.h" | 25 #include "ui/gfx/geometry/safe_integer_conversions.h" |
25 #include "ui/gfx/platform_font.h" | 26 #include "ui/gfx/platform_font.h" |
26 #include "ui/gfx/render_text_harfbuzz.h" | 27 #include "ui/gfx/render_text_harfbuzz.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 paint_.setShader(shader); | 271 paint_.setShader(shader); |
271 } | 272 } |
272 | 273 |
273 void SkiaTextRenderer::SetUnderlineMetrics(SkScalar thickness, | 274 void SkiaTextRenderer::SetUnderlineMetrics(SkScalar thickness, |
274 SkScalar position) { | 275 SkScalar position) { |
275 underline_thickness_ = thickness; | 276 underline_thickness_ = thickness; |
276 underline_position_ = position; | 277 underline_position_ = position; |
277 } | 278 } |
278 | 279 |
279 void SkiaTextRenderer::DrawPosText(const SkPoint* pos, | 280 void SkiaTextRenderer::DrawPosText(const SkPoint* pos, |
280 const uint16* glyphs, | 281 const uint16_t* glyphs, |
281 size_t glyph_count) { | 282 size_t glyph_count) { |
282 const size_t byte_length = glyph_count * sizeof(glyphs[0]); | 283 const size_t byte_length = glyph_count * sizeof(glyphs[0]); |
283 canvas_skia_->drawPosText(&glyphs[0], byte_length, &pos[0], paint_); | 284 canvas_skia_->drawPosText(&glyphs[0], byte_length, &pos[0], paint_); |
284 } | 285 } |
285 | 286 |
286 void SkiaTextRenderer::DrawDecorations(int x, int y, int width, bool underline, | 287 void SkiaTextRenderer::DrawDecorations(int x, int y, int width, bool underline, |
287 bool strike, bool diagonal_strike) { | 288 bool strike, bool diagonal_strike) { |
288 if (underline) | 289 if (underline) |
289 DrawUnderline(x, y, width); | 290 DrawUnderline(x, y, width); |
290 if (strike) | 291 if (strike) |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 | 1538 |
1538 SetDisplayOffset(display_offset_.x() + delta_x); | 1539 SetDisplayOffset(display_offset_.x() + delta_x); |
1539 } | 1540 } |
1540 | 1541 |
1541 void RenderText::DrawSelection(Canvas* canvas) { | 1542 void RenderText::DrawSelection(Canvas* canvas) { |
1542 for (const Rect& s : GetSubstringBounds(selection())) | 1543 for (const Rect& s : GetSubstringBounds(selection())) |
1543 canvas->FillRect(s, selection_background_focused_color_); | 1544 canvas->FillRect(s, selection_background_focused_color_); |
1544 } | 1545 } |
1545 | 1546 |
1546 } // namespace gfx | 1547 } // namespace gfx |
OLD | NEW |